diff --git a/.gitignore b/.gitignore index 547adf1ce..0992ac15c 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,8 @@ .idea .DS_Store +.cache + # Composer files. vendor/ diff --git a/docs/.cache/plugin/privacy/assets/external/fonts.googleapis.com/css.49ea35f2 b/docs/.cache/plugin/privacy/assets/external/fonts.googleapis.com/css.49ea35f2 deleted file mode 120000 index 3ce7db2a2..000000000 --- a/docs/.cache/plugin/privacy/assets/external/fonts.googleapis.com/css.49ea35f2 +++ /dev/null @@ -1 +0,0 @@ -css.49ea35f2.css \ No newline at end of file diff --git a/docs/404.html b/docs/404.html new file mode 100644 index 000000000..3cf916b70 --- /dev/null +++ b/docs/404.html @@ -0,0 +1,2048 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + wp-browser docs + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ +
+ + + + + + +
+ + +
+ +
+ + + + + + +
+
+ + + +
+
+
+ + + + + +
+
+
+ + + +
+
+
+ + + +
+
+
+ + + +
+ +
+ +

404 - Not found

+ +
+
+ + + +
+ + + +
+ + + +
+
+
+
+ + + + + + + + + \ No newline at end of file diff --git a/docs/.cache/plugin/privacy/assets/external/fonts.googleapis.com/css.49ea35f2.css b/docs/assets/external/fonts.googleapis.com/css.49ea35f2.css similarity index 66% rename from docs/.cache/plugin/privacy/assets/external/fonts.googleapis.com/css.49ea35f2.css rename to docs/assets/external/fonts.googleapis.com/css.49ea35f2.css index c38b0fbd4..7f47d3e20 100644 --- a/docs/.cache/plugin/privacy/assets/external/fonts.googleapis.com/css.49ea35f2.css +++ b/docs/assets/external/fonts.googleapis.com/css.49ea35f2.css @@ -4,7 +4,7 @@ font-style: italic; font-weight: 300; font-display: fallback; - src: url(https://fonts.gstatic.com/s/roboto/v30/KFOjCnqEu92Fr1Mu51TjASc3CsTKlA.woff2) format('woff2'); + src: url(../fonts.gstatic.com/s/roboto/v30/KFOjCnqEu92Fr1Mu51TjASc3CsTKlA.woff2) format('woff2'); unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F; } /* cyrillic */ @@ -13,7 +13,7 @@ font-style: italic; font-weight: 300; font-display: fallback; - src: url(https://fonts.gstatic.com/s/roboto/v30/KFOjCnqEu92Fr1Mu51TjASc-CsTKlA.woff2) format('woff2'); + src: url(../fonts.gstatic.com/s/roboto/v30/KFOjCnqEu92Fr1Mu51TjASc-CsTKlA.woff2) format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; } /* greek-ext */ @@ -22,7 +22,7 @@ font-style: italic; font-weight: 300; font-display: fallback; - src: url(https://fonts.gstatic.com/s/roboto/v30/KFOjCnqEu92Fr1Mu51TjASc2CsTKlA.woff2) format('woff2'); + src: url(../fonts.gstatic.com/s/roboto/v30/KFOjCnqEu92Fr1Mu51TjASc2CsTKlA.woff2) format('woff2'); unicode-range: U+1F00-1FFF; } /* greek */ @@ -31,7 +31,7 @@ font-style: italic; font-weight: 300; font-display: fallback; - src: url(https://fonts.gstatic.com/s/roboto/v30/KFOjCnqEu92Fr1Mu51TjASc5CsTKlA.woff2) format('woff2'); + src: url(../fonts.gstatic.com/s/roboto/v30/KFOjCnqEu92Fr1Mu51TjASc5CsTKlA.woff2) format('woff2'); unicode-range: U+0370-03FF; } /* vietnamese */ @@ -40,7 +40,7 @@ font-style: italic; font-weight: 300; font-display: fallback; - src: url(https://fonts.gstatic.com/s/roboto/v30/KFOjCnqEu92Fr1Mu51TjASc1CsTKlA.woff2) format('woff2'); + src: url(../fonts.gstatic.com/s/roboto/v30/KFOjCnqEu92Fr1Mu51TjASc1CsTKlA.woff2) format('woff2'); unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB; } /* latin-ext */ @@ -49,7 +49,7 @@ font-style: italic; font-weight: 300; font-display: fallback; - src: url(https://fonts.gstatic.com/s/roboto/v30/KFOjCnqEu92Fr1Mu51TjASc0CsTKlA.woff2) format('woff2'); + src: url(../fonts.gstatic.com/s/roboto/v30/KFOjCnqEu92Fr1Mu51TjASc0CsTKlA.woff2) format('woff2'); unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF; } /* latin */ @@ -58,7 +58,7 @@ font-style: italic; font-weight: 300; font-display: fallback; - src: url(https://fonts.gstatic.com/s/roboto/v30/KFOjCnqEu92Fr1Mu51TjASc6CsQ.woff2) format('woff2'); + src: url(../fonts.gstatic.com/s/roboto/v30/KFOjCnqEu92Fr1Mu51TjASc6CsQ.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; } /* cyrillic-ext */ @@ -67,7 +67,7 @@ font-style: italic; font-weight: 400; font-display: fallback; - src: url(https://fonts.gstatic.com/s/roboto/v30/KFOkCnqEu92Fr1Mu51xFIzIFKw.woff2) format('woff2'); + src: url(../fonts.gstatic.com/s/roboto/v30/KFOkCnqEu92Fr1Mu51xFIzIFKw.woff2) format('woff2'); unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F; } /* cyrillic */ @@ -76,7 +76,7 @@ font-style: italic; font-weight: 400; font-display: fallback; - src: url(https://fonts.gstatic.com/s/roboto/v30/KFOkCnqEu92Fr1Mu51xMIzIFKw.woff2) format('woff2'); + src: url(../fonts.gstatic.com/s/roboto/v30/KFOkCnqEu92Fr1Mu51xMIzIFKw.woff2) format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; } /* greek-ext */ @@ -85,7 +85,7 @@ font-style: italic; font-weight: 400; font-display: fallback; - src: url(https://fonts.gstatic.com/s/roboto/v30/KFOkCnqEu92Fr1Mu51xEIzIFKw.woff2) format('woff2'); + src: url(../fonts.gstatic.com/s/roboto/v30/KFOkCnqEu92Fr1Mu51xEIzIFKw.woff2) format('woff2'); unicode-range: U+1F00-1FFF; } /* greek */ @@ -94,7 +94,7 @@ font-style: italic; font-weight: 400; font-display: fallback; - src: url(https://fonts.gstatic.com/s/roboto/v30/KFOkCnqEu92Fr1Mu51xLIzIFKw.woff2) format('woff2'); + src: url(../fonts.gstatic.com/s/roboto/v30/KFOkCnqEu92Fr1Mu51xLIzIFKw.woff2) format('woff2'); unicode-range: U+0370-03FF; } /* vietnamese */ @@ -103,7 +103,7 @@ font-style: italic; font-weight: 400; font-display: fallback; - src: url(https://fonts.gstatic.com/s/roboto/v30/KFOkCnqEu92Fr1Mu51xHIzIFKw.woff2) format('woff2'); + src: url(../fonts.gstatic.com/s/roboto/v30/KFOkCnqEu92Fr1Mu51xHIzIFKw.woff2) format('woff2'); unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB; } /* latin-ext */ @@ -112,7 +112,7 @@ font-style: italic; font-weight: 400; font-display: fallback; - src: url(https://fonts.gstatic.com/s/roboto/v30/KFOkCnqEu92Fr1Mu51xGIzIFKw.woff2) format('woff2'); + src: url(../fonts.gstatic.com/s/roboto/v30/KFOkCnqEu92Fr1Mu51xGIzIFKw.woff2) format('woff2'); unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF; } /* latin */ @@ -121,7 +121,7 @@ font-style: italic; font-weight: 400; font-display: fallback; - src: url(https://fonts.gstatic.com/s/roboto/v30/KFOkCnqEu92Fr1Mu51xIIzI.woff2) format('woff2'); + src: url(../fonts.gstatic.com/s/roboto/v30/KFOkCnqEu92Fr1Mu51xIIzI.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; } /* cyrillic-ext */ @@ -130,7 +130,7 @@ font-style: italic; font-weight: 700; font-display: fallback; - src: url(https://fonts.gstatic.com/s/roboto/v30/KFOjCnqEu92Fr1Mu51TzBic3CsTKlA.woff2) format('woff2'); + src: url(../fonts.gstatic.com/s/roboto/v30/KFOjCnqEu92Fr1Mu51TzBic3CsTKlA.woff2) format('woff2'); unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F; } /* cyrillic */ @@ -139,7 +139,7 @@ font-style: italic; font-weight: 700; font-display: fallback; - src: url(https://fonts.gstatic.com/s/roboto/v30/KFOjCnqEu92Fr1Mu51TzBic-CsTKlA.woff2) format('woff2'); + src: url(../fonts.gstatic.com/s/roboto/v30/KFOjCnqEu92Fr1Mu51TzBic-CsTKlA.woff2) format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; } /* greek-ext */ @@ -148,7 +148,7 @@ font-style: italic; font-weight: 700; font-display: fallback; - src: url(https://fonts.gstatic.com/s/roboto/v30/KFOjCnqEu92Fr1Mu51TzBic2CsTKlA.woff2) format('woff2'); + src: url(../fonts.gstatic.com/s/roboto/v30/KFOjCnqEu92Fr1Mu51TzBic2CsTKlA.woff2) format('woff2'); unicode-range: U+1F00-1FFF; } /* greek */ @@ -157,7 +157,7 @@ font-style: italic; font-weight: 700; font-display: fallback; - src: url(https://fonts.gstatic.com/s/roboto/v30/KFOjCnqEu92Fr1Mu51TzBic5CsTKlA.woff2) format('woff2'); + src: url(../fonts.gstatic.com/s/roboto/v30/KFOjCnqEu92Fr1Mu51TzBic5CsTKlA.woff2) format('woff2'); unicode-range: U+0370-03FF; } /* vietnamese */ @@ -166,7 +166,7 @@ font-style: italic; font-weight: 700; font-display: fallback; - src: url(https://fonts.gstatic.com/s/roboto/v30/KFOjCnqEu92Fr1Mu51TzBic1CsTKlA.woff2) format('woff2'); + src: url(../fonts.gstatic.com/s/roboto/v30/KFOjCnqEu92Fr1Mu51TzBic1CsTKlA.woff2) format('woff2'); unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB; } /* latin-ext */ @@ -175,7 +175,7 @@ font-style: italic; font-weight: 700; font-display: fallback; - src: url(https://fonts.gstatic.com/s/roboto/v30/KFOjCnqEu92Fr1Mu51TzBic0CsTKlA.woff2) format('woff2'); + src: url(../fonts.gstatic.com/s/roboto/v30/KFOjCnqEu92Fr1Mu51TzBic0CsTKlA.woff2) format('woff2'); unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF; } /* latin */ @@ -184,7 +184,7 @@ font-style: italic; font-weight: 700; font-display: fallback; - src: url(https://fonts.gstatic.com/s/roboto/v30/KFOjCnqEu92Fr1Mu51TzBic6CsQ.woff2) format('woff2'); + src: url(../fonts.gstatic.com/s/roboto/v30/KFOjCnqEu92Fr1Mu51TzBic6CsQ.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; } /* cyrillic-ext */ @@ -193,7 +193,7 @@ font-style: normal; font-weight: 300; font-display: fallback; - src: url(https://fonts.gstatic.com/s/roboto/v30/KFOlCnqEu92Fr1MmSU5fCRc4EsA.woff2) format('woff2'); + src: url(../fonts.gstatic.com/s/roboto/v30/KFOlCnqEu92Fr1MmSU5fCRc4EsA.woff2) format('woff2'); unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F; } /* cyrillic */ @@ -202,7 +202,7 @@ font-style: normal; font-weight: 300; font-display: fallback; - src: url(https://fonts.gstatic.com/s/roboto/v30/KFOlCnqEu92Fr1MmSU5fABc4EsA.woff2) format('woff2'); + src: url(../fonts.gstatic.com/s/roboto/v30/KFOlCnqEu92Fr1MmSU5fABc4EsA.woff2) format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; } /* greek-ext */ @@ -211,7 +211,7 @@ font-style: normal; font-weight: 300; font-display: fallback; - src: url(https://fonts.gstatic.com/s/roboto/v30/KFOlCnqEu92Fr1MmSU5fCBc4EsA.woff2) format('woff2'); + src: url(../fonts.gstatic.com/s/roboto/v30/KFOlCnqEu92Fr1MmSU5fCBc4EsA.woff2) format('woff2'); unicode-range: U+1F00-1FFF; } /* greek */ @@ -220,7 +220,7 @@ font-style: normal; font-weight: 300; font-display: fallback; - src: url(https://fonts.gstatic.com/s/roboto/v30/KFOlCnqEu92Fr1MmSU5fBxc4EsA.woff2) format('woff2'); + src: url(../fonts.gstatic.com/s/roboto/v30/KFOlCnqEu92Fr1MmSU5fBxc4EsA.woff2) format('woff2'); unicode-range: U+0370-03FF; } /* vietnamese */ @@ -229,7 +229,7 @@ font-style: normal; font-weight: 300; font-display: fallback; - src: url(https://fonts.gstatic.com/s/roboto/v30/KFOlCnqEu92Fr1MmSU5fCxc4EsA.woff2) format('woff2'); + src: url(../fonts.gstatic.com/s/roboto/v30/KFOlCnqEu92Fr1MmSU5fCxc4EsA.woff2) format('woff2'); unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB; } /* latin-ext */ @@ -238,7 +238,7 @@ font-style: normal; font-weight: 300; font-display: fallback; - src: url(https://fonts.gstatic.com/s/roboto/v30/KFOlCnqEu92Fr1MmSU5fChc4EsA.woff2) format('woff2'); + src: url(../fonts.gstatic.com/s/roboto/v30/KFOlCnqEu92Fr1MmSU5fChc4EsA.woff2) format('woff2'); unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF; } /* latin */ @@ -247,7 +247,7 @@ font-style: normal; font-weight: 300; font-display: fallback; - src: url(https://fonts.gstatic.com/s/roboto/v30/KFOlCnqEu92Fr1MmSU5fBBc4.woff2) format('woff2'); + src: url(../fonts.gstatic.com/s/roboto/v30/KFOlCnqEu92Fr1MmSU5fBBc4.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; } /* cyrillic-ext */ @@ -256,7 +256,7 @@ font-style: normal; font-weight: 400; font-display: fallback; - src: url(https://fonts.gstatic.com/s/roboto/v30/KFOmCnqEu92Fr1Mu72xKOzY.woff2) format('woff2'); + src: url(../fonts.gstatic.com/s/roboto/v30/KFOmCnqEu92Fr1Mu72xKOzY.woff2) format('woff2'); unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F; } /* cyrillic */ @@ -265,7 +265,7 @@ font-style: normal; font-weight: 400; font-display: fallback; - src: url(https://fonts.gstatic.com/s/roboto/v30/KFOmCnqEu92Fr1Mu5mxKOzY.woff2) format('woff2'); + src: url(../fonts.gstatic.com/s/roboto/v30/KFOmCnqEu92Fr1Mu5mxKOzY.woff2) format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; } /* greek-ext */ @@ -274,7 +274,7 @@ font-style: normal; font-weight: 400; font-display: fallback; - src: url(https://fonts.gstatic.com/s/roboto/v30/KFOmCnqEu92Fr1Mu7mxKOzY.woff2) format('woff2'); + src: url(../fonts.gstatic.com/s/roboto/v30/KFOmCnqEu92Fr1Mu7mxKOzY.woff2) format('woff2'); unicode-range: U+1F00-1FFF; } /* greek */ @@ -283,7 +283,7 @@ font-style: normal; font-weight: 400; font-display: fallback; - src: url(https://fonts.gstatic.com/s/roboto/v30/KFOmCnqEu92Fr1Mu4WxKOzY.woff2) format('woff2'); + src: url(../fonts.gstatic.com/s/roboto/v30/KFOmCnqEu92Fr1Mu4WxKOzY.woff2) format('woff2'); unicode-range: U+0370-03FF; } /* vietnamese */ @@ -292,7 +292,7 @@ font-style: normal; font-weight: 400; font-display: fallback; - src: url(https://fonts.gstatic.com/s/roboto/v30/KFOmCnqEu92Fr1Mu7WxKOzY.woff2) format('woff2'); + src: url(../fonts.gstatic.com/s/roboto/v30/KFOmCnqEu92Fr1Mu7WxKOzY.woff2) format('woff2'); unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB; } /* latin-ext */ @@ -301,7 +301,7 @@ font-style: normal; font-weight: 400; font-display: fallback; - src: url(https://fonts.gstatic.com/s/roboto/v30/KFOmCnqEu92Fr1Mu7GxKOzY.woff2) format('woff2'); + src: url(../fonts.gstatic.com/s/roboto/v30/KFOmCnqEu92Fr1Mu7GxKOzY.woff2) format('woff2'); unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF; } /* latin */ @@ -310,7 +310,7 @@ font-style: normal; font-weight: 400; font-display: fallback; - src: url(https://fonts.gstatic.com/s/roboto/v30/KFOmCnqEu92Fr1Mu4mxK.woff2) format('woff2'); + src: url(../fonts.gstatic.com/s/roboto/v30/KFOmCnqEu92Fr1Mu4mxK.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; } /* cyrillic-ext */ @@ -319,7 +319,7 @@ font-style: normal; font-weight: 700; font-display: fallback; - src: url(https://fonts.gstatic.com/s/roboto/v30/KFOlCnqEu92Fr1MmWUlfCRc4EsA.woff2) format('woff2'); + src: url(../fonts.gstatic.com/s/roboto/v30/KFOlCnqEu92Fr1MmWUlfCRc4EsA.woff2) format('woff2'); unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F; } /* cyrillic */ @@ -328,7 +328,7 @@ font-style: normal; font-weight: 700; font-display: fallback; - src: url(https://fonts.gstatic.com/s/roboto/v30/KFOlCnqEu92Fr1MmWUlfABc4EsA.woff2) format('woff2'); + src: url(../fonts.gstatic.com/s/roboto/v30/KFOlCnqEu92Fr1MmWUlfABc4EsA.woff2) format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; } /* greek-ext */ @@ -337,7 +337,7 @@ font-style: normal; font-weight: 700; font-display: fallback; - src: url(https://fonts.gstatic.com/s/roboto/v30/KFOlCnqEu92Fr1MmWUlfCBc4EsA.woff2) format('woff2'); + src: url(../fonts.gstatic.com/s/roboto/v30/KFOlCnqEu92Fr1MmWUlfCBc4EsA.woff2) format('woff2'); unicode-range: U+1F00-1FFF; } /* greek */ @@ -346,7 +346,7 @@ font-style: normal; font-weight: 700; font-display: fallback; - src: url(https://fonts.gstatic.com/s/roboto/v30/KFOlCnqEu92Fr1MmWUlfBxc4EsA.woff2) format('woff2'); + src: url(../fonts.gstatic.com/s/roboto/v30/KFOlCnqEu92Fr1MmWUlfBxc4EsA.woff2) format('woff2'); unicode-range: U+0370-03FF; } /* vietnamese */ @@ -355,7 +355,7 @@ font-style: normal; font-weight: 700; font-display: fallback; - src: url(https://fonts.gstatic.com/s/roboto/v30/KFOlCnqEu92Fr1MmWUlfCxc4EsA.woff2) format('woff2'); + src: url(../fonts.gstatic.com/s/roboto/v30/KFOlCnqEu92Fr1MmWUlfCxc4EsA.woff2) format('woff2'); unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB; } /* latin-ext */ @@ -364,7 +364,7 @@ font-style: normal; font-weight: 700; font-display: fallback; - src: url(https://fonts.gstatic.com/s/roboto/v30/KFOlCnqEu92Fr1MmWUlfChc4EsA.woff2) format('woff2'); + src: url(../fonts.gstatic.com/s/roboto/v30/KFOlCnqEu92Fr1MmWUlfChc4EsA.woff2) format('woff2'); unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF; } /* latin */ @@ -373,7 +373,7 @@ font-style: normal; font-weight: 700; font-display: fallback; - src: url(https://fonts.gstatic.com/s/roboto/v30/KFOlCnqEu92Fr1MmWUlfBBc4.woff2) format('woff2'); + src: url(../fonts.gstatic.com/s/roboto/v30/KFOlCnqEu92Fr1MmWUlfBBc4.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; } /* cyrillic-ext */ @@ -382,7 +382,7 @@ font-style: italic; font-weight: 400; font-display: fallback; - src: url(https://fonts.gstatic.com/s/robotomono/v22/L0xdDF4xlVMF-BfR8bXMIjhOsXG-q2oeuFoqFrlnAIe2Imhk1T8rbociImtEluUlYIw.woff2) format('woff2'); + src: url(../fonts.gstatic.com/s/robotomono/v22/L0xdDF4xlVMF-BfR8bXMIjhOsXG-q2oeuFoqFrlnAIe2Imhk1T8rbociImtEluUlYIw.woff2) format('woff2'); unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F; } /* cyrillic */ @@ -391,7 +391,7 @@ font-style: italic; font-weight: 400; font-display: fallback; - src: url(https://fonts.gstatic.com/s/robotomono/v22/L0xdDF4xlVMF-BfR8bXMIjhOsXG-q2oeuFoqFrlnAIe2Imhk1T8rbociImtEn-UlYIw.woff2) format('woff2'); + src: url(../fonts.gstatic.com/s/robotomono/v22/L0xdDF4xlVMF-BfR8bXMIjhOsXG-q2oeuFoqFrlnAIe2Imhk1T8rbociImtEn-UlYIw.woff2) format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; } /* greek */ @@ -400,7 +400,7 @@ font-style: italic; font-weight: 400; font-display: fallback; - src: url(https://fonts.gstatic.com/s/robotomono/v22/L0xdDF4xlVMF-BfR8bXMIjhOsXG-q2oeuFoqFrlnAIe2Imhk1T8rbociImtEmOUlYIw.woff2) format('woff2'); + src: url(../fonts.gstatic.com/s/robotomono/v22/L0xdDF4xlVMF-BfR8bXMIjhOsXG-q2oeuFoqFrlnAIe2Imhk1T8rbociImtEmOUlYIw.woff2) format('woff2'); unicode-range: U+0370-03FF; } /* vietnamese */ @@ -409,7 +409,7 @@ font-style: italic; font-weight: 400; font-display: fallback; - src: url(https://fonts.gstatic.com/s/robotomono/v22/L0xdDF4xlVMF-BfR8bXMIjhOsXG-q2oeuFoqFrlnAIe2Imhk1T8rbociImtElOUlYIw.woff2) format('woff2'); + src: url(../fonts.gstatic.com/s/robotomono/v22/L0xdDF4xlVMF-BfR8bXMIjhOsXG-q2oeuFoqFrlnAIe2Imhk1T8rbociImtElOUlYIw.woff2) format('woff2'); unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB; } /* latin-ext */ @@ -418,7 +418,7 @@ font-style: italic; font-weight: 400; font-display: fallback; - src: url(https://fonts.gstatic.com/s/robotomono/v22/L0xdDF4xlVMF-BfR8bXMIjhOsXG-q2oeuFoqFrlnAIe2Imhk1T8rbociImtEleUlYIw.woff2) format('woff2'); + src: url(../fonts.gstatic.com/s/robotomono/v22/L0xdDF4xlVMF-BfR8bXMIjhOsXG-q2oeuFoqFrlnAIe2Imhk1T8rbociImtEleUlYIw.woff2) format('woff2'); unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF; } /* latin */ @@ -427,7 +427,7 @@ font-style: italic; font-weight: 400; font-display: fallback; - src: url(https://fonts.gstatic.com/s/robotomono/v22/L0xdDF4xlVMF-BfR8bXMIjhOsXG-q2oeuFoqFrlnAIe2Imhk1T8rbociImtEm-Ul.woff2) format('woff2'); + src: url(../fonts.gstatic.com/s/robotomono/v22/L0xdDF4xlVMF-BfR8bXMIjhOsXG-q2oeuFoqFrlnAIe2Imhk1T8rbociImtEm-Ul.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; } /* cyrillic-ext */ @@ -436,7 +436,7 @@ font-style: italic; font-weight: 700; font-display: fallback; - src: url(https://fonts.gstatic.com/s/robotomono/v22/L0xdDF4xlVMF-BfR8bXMIjhOsXG-q2oeuFoqFrlnAIe2Imhk1T8rbociImtEluUlYIw.woff2) format('woff2'); + src: url(../fonts.gstatic.com/s/robotomono/v22/L0xdDF4xlVMF-BfR8bXMIjhOsXG-q2oeuFoqFrlnAIe2Imhk1T8rbociImtEluUlYIw.woff2) format('woff2'); unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F; } /* cyrillic */ @@ -445,7 +445,7 @@ font-style: italic; font-weight: 700; font-display: fallback; - src: url(https://fonts.gstatic.com/s/robotomono/v22/L0xdDF4xlVMF-BfR8bXMIjhOsXG-q2oeuFoqFrlnAIe2Imhk1T8rbociImtEn-UlYIw.woff2) format('woff2'); + src: url(../fonts.gstatic.com/s/robotomono/v22/L0xdDF4xlVMF-BfR8bXMIjhOsXG-q2oeuFoqFrlnAIe2Imhk1T8rbociImtEn-UlYIw.woff2) format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; } /* greek */ @@ -454,7 +454,7 @@ font-style: italic; font-weight: 700; font-display: fallback; - src: url(https://fonts.gstatic.com/s/robotomono/v22/L0xdDF4xlVMF-BfR8bXMIjhOsXG-q2oeuFoqFrlnAIe2Imhk1T8rbociImtEmOUlYIw.woff2) format('woff2'); + src: url(../fonts.gstatic.com/s/robotomono/v22/L0xdDF4xlVMF-BfR8bXMIjhOsXG-q2oeuFoqFrlnAIe2Imhk1T8rbociImtEmOUlYIw.woff2) format('woff2'); unicode-range: U+0370-03FF; } /* vietnamese */ @@ -463,7 +463,7 @@ font-style: italic; font-weight: 700; font-display: fallback; - src: url(https://fonts.gstatic.com/s/robotomono/v22/L0xdDF4xlVMF-BfR8bXMIjhOsXG-q2oeuFoqFrlnAIe2Imhk1T8rbociImtElOUlYIw.woff2) format('woff2'); + src: url(../fonts.gstatic.com/s/robotomono/v22/L0xdDF4xlVMF-BfR8bXMIjhOsXG-q2oeuFoqFrlnAIe2Imhk1T8rbociImtElOUlYIw.woff2) format('woff2'); unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB; } /* latin-ext */ @@ -472,7 +472,7 @@ font-style: italic; font-weight: 700; font-display: fallback; - src: url(https://fonts.gstatic.com/s/robotomono/v22/L0xdDF4xlVMF-BfR8bXMIjhOsXG-q2oeuFoqFrlnAIe2Imhk1T8rbociImtEleUlYIw.woff2) format('woff2'); + src: url(../fonts.gstatic.com/s/robotomono/v22/L0xdDF4xlVMF-BfR8bXMIjhOsXG-q2oeuFoqFrlnAIe2Imhk1T8rbociImtEleUlYIw.woff2) format('woff2'); unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF; } /* latin */ @@ -481,7 +481,7 @@ font-style: italic; font-weight: 700; font-display: fallback; - src: url(https://fonts.gstatic.com/s/robotomono/v22/L0xdDF4xlVMF-BfR8bXMIjhOsXG-q2oeuFoqFrlnAIe2Imhk1T8rbociImtEm-Ul.woff2) format('woff2'); + src: url(../fonts.gstatic.com/s/robotomono/v22/L0xdDF4xlVMF-BfR8bXMIjhOsXG-q2oeuFoqFrlnAIe2Imhk1T8rbociImtEm-Ul.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; } /* cyrillic-ext */ @@ -490,7 +490,7 @@ font-style: normal; font-weight: 400; font-display: fallback; - src: url(https://fonts.gstatic.com/s/robotomono/v22/L0xTDF4xlVMF-BfR8bXMIhJHg45mwgGEFl0_3vrtSM1J-gEPT5Ese6hmHSV0mf0h.woff2) format('woff2'); + src: url(../fonts.gstatic.com/s/robotomono/v22/L0xTDF4xlVMF-BfR8bXMIhJHg45mwgGEFl0_3vrtSM1J-gEPT5Ese6hmHSV0mf0h.woff2) format('woff2'); unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F; } /* cyrillic */ @@ -499,7 +499,7 @@ font-style: normal; font-weight: 400; font-display: fallback; - src: url(https://fonts.gstatic.com/s/robotomono/v22/L0xTDF4xlVMF-BfR8bXMIhJHg45mwgGEFl0_3vrtSM1J-gEPT5Ese6hmHSx0mf0h.woff2) format('woff2'); + src: url(../fonts.gstatic.com/s/robotomono/v22/L0xTDF4xlVMF-BfR8bXMIhJHg45mwgGEFl0_3vrtSM1J-gEPT5Ese6hmHSx0mf0h.woff2) format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; } /* greek */ @@ -508,7 +508,7 @@ font-style: normal; font-weight: 400; font-display: fallback; - src: url(https://fonts.gstatic.com/s/robotomono/v22/L0xTDF4xlVMF-BfR8bXMIhJHg45mwgGEFl0_3vrtSM1J-gEPT5Ese6hmHSt0mf0h.woff2) format('woff2'); + src: url(../fonts.gstatic.com/s/robotomono/v22/L0xTDF4xlVMF-BfR8bXMIhJHg45mwgGEFl0_3vrtSM1J-gEPT5Ese6hmHSt0mf0h.woff2) format('woff2'); unicode-range: U+0370-03FF; } /* vietnamese */ @@ -517,7 +517,7 @@ font-style: normal; font-weight: 400; font-display: fallback; - src: url(https://fonts.gstatic.com/s/robotomono/v22/L0xTDF4xlVMF-BfR8bXMIhJHg45mwgGEFl0_3vrtSM1J-gEPT5Ese6hmHSd0mf0h.woff2) format('woff2'); + src: url(../fonts.gstatic.com/s/robotomono/v22/L0xTDF4xlVMF-BfR8bXMIhJHg45mwgGEFl0_3vrtSM1J-gEPT5Ese6hmHSd0mf0h.woff2) format('woff2'); unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB; } /* latin-ext */ @@ -526,7 +526,7 @@ font-style: normal; font-weight: 400; font-display: fallback; - src: url(https://fonts.gstatic.com/s/robotomono/v22/L0xTDF4xlVMF-BfR8bXMIhJHg45mwgGEFl0_3vrtSM1J-gEPT5Ese6hmHSZ0mf0h.woff2) format('woff2'); + src: url(../fonts.gstatic.com/s/robotomono/v22/L0xTDF4xlVMF-BfR8bXMIhJHg45mwgGEFl0_3vrtSM1J-gEPT5Ese6hmHSZ0mf0h.woff2) format('woff2'); unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF; } /* latin */ @@ -535,7 +535,7 @@ font-style: normal; font-weight: 400; font-display: fallback; - src: url(https://fonts.gstatic.com/s/robotomono/v22/L0xTDF4xlVMF-BfR8bXMIhJHg45mwgGEFl0_3vrtSM1J-gEPT5Ese6hmHSh0mQ.woff2) format('woff2'); + src: url(../fonts.gstatic.com/s/robotomono/v22/L0xTDF4xlVMF-BfR8bXMIhJHg45mwgGEFl0_3vrtSM1J-gEPT5Ese6hmHSh0mQ.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; } /* cyrillic-ext */ @@ -544,7 +544,7 @@ font-style: normal; font-weight: 700; font-display: fallback; - src: url(https://fonts.gstatic.com/s/robotomono/v22/L0xTDF4xlVMF-BfR8bXMIhJHg45mwgGEFl0_3vrtSM1J-gEPT5Ese6hmHSV0mf0h.woff2) format('woff2'); + src: url(../fonts.gstatic.com/s/robotomono/v22/L0xTDF4xlVMF-BfR8bXMIhJHg45mwgGEFl0_3vrtSM1J-gEPT5Ese6hmHSV0mf0h.woff2) format('woff2'); unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F; } /* cyrillic */ @@ -553,7 +553,7 @@ font-style: normal; font-weight: 700; font-display: fallback; - src: url(https://fonts.gstatic.com/s/robotomono/v22/L0xTDF4xlVMF-BfR8bXMIhJHg45mwgGEFl0_3vrtSM1J-gEPT5Ese6hmHSx0mf0h.woff2) format('woff2'); + src: url(../fonts.gstatic.com/s/robotomono/v22/L0xTDF4xlVMF-BfR8bXMIhJHg45mwgGEFl0_3vrtSM1J-gEPT5Ese6hmHSx0mf0h.woff2) format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; } /* greek */ @@ -562,7 +562,7 @@ font-style: normal; font-weight: 700; font-display: fallback; - src: url(https://fonts.gstatic.com/s/robotomono/v22/L0xTDF4xlVMF-BfR8bXMIhJHg45mwgGEFl0_3vrtSM1J-gEPT5Ese6hmHSt0mf0h.woff2) format('woff2'); + src: url(../fonts.gstatic.com/s/robotomono/v22/L0xTDF4xlVMF-BfR8bXMIhJHg45mwgGEFl0_3vrtSM1J-gEPT5Ese6hmHSt0mf0h.woff2) format('woff2'); unicode-range: U+0370-03FF; } /* vietnamese */ @@ -571,7 +571,7 @@ font-style: normal; font-weight: 700; font-display: fallback; - src: url(https://fonts.gstatic.com/s/robotomono/v22/L0xTDF4xlVMF-BfR8bXMIhJHg45mwgGEFl0_3vrtSM1J-gEPT5Ese6hmHSd0mf0h.woff2) format('woff2'); + src: url(../fonts.gstatic.com/s/robotomono/v22/L0xTDF4xlVMF-BfR8bXMIhJHg45mwgGEFl0_3vrtSM1J-gEPT5Ese6hmHSd0mf0h.woff2) format('woff2'); unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB; } /* latin-ext */ @@ -580,7 +580,7 @@ font-style: normal; font-weight: 700; font-display: fallback; - src: url(https://fonts.gstatic.com/s/robotomono/v22/L0xTDF4xlVMF-BfR8bXMIhJHg45mwgGEFl0_3vrtSM1J-gEPT5Ese6hmHSZ0mf0h.woff2) format('woff2'); + src: url(../fonts.gstatic.com/s/robotomono/v22/L0xTDF4xlVMF-BfR8bXMIhJHg45mwgGEFl0_3vrtSM1J-gEPT5Ese6hmHSZ0mf0h.woff2) format('woff2'); unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF; } /* latin */ @@ -589,6 +589,6 @@ font-style: normal; font-weight: 700; font-display: fallback; - src: url(https://fonts.gstatic.com/s/robotomono/v22/L0xTDF4xlVMF-BfR8bXMIhJHg45mwgGEFl0_3vrtSM1J-gEPT5Ese6hmHSh0mQ.woff2) format('woff2'); + src: url(../fonts.gstatic.com/s/robotomono/v22/L0xTDF4xlVMF-BfR8bXMIhJHg45mwgGEFl0_3vrtSM1J-gEPT5Ese6hmHSh0mQ.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; } diff --git a/docs/.cache/plugin/privacy/assets/external/fonts.gstatic.com/s/roboto/v30/KFOjCnqEu92Fr1Mu51TjASc-CsTKlA.woff2 b/docs/assets/external/fonts.gstatic.com/s/roboto/v30/KFOjCnqEu92Fr1Mu51TjASc-CsTKlA.woff2 similarity index 100% rename from docs/.cache/plugin/privacy/assets/external/fonts.gstatic.com/s/roboto/v30/KFOjCnqEu92Fr1Mu51TjASc-CsTKlA.woff2 rename to docs/assets/external/fonts.gstatic.com/s/roboto/v30/KFOjCnqEu92Fr1Mu51TjASc-CsTKlA.woff2 diff --git a/docs/.cache/plugin/privacy/assets/external/fonts.gstatic.com/s/roboto/v30/KFOjCnqEu92Fr1Mu51TjASc0CsTKlA.woff2 b/docs/assets/external/fonts.gstatic.com/s/roboto/v30/KFOjCnqEu92Fr1Mu51TjASc0CsTKlA.woff2 similarity index 100% rename from docs/.cache/plugin/privacy/assets/external/fonts.gstatic.com/s/roboto/v30/KFOjCnqEu92Fr1Mu51TjASc0CsTKlA.woff2 rename to docs/assets/external/fonts.gstatic.com/s/roboto/v30/KFOjCnqEu92Fr1Mu51TjASc0CsTKlA.woff2 diff --git a/docs/.cache/plugin/privacy/assets/external/fonts.gstatic.com/s/roboto/v30/KFOjCnqEu92Fr1Mu51TjASc1CsTKlA.woff2 b/docs/assets/external/fonts.gstatic.com/s/roboto/v30/KFOjCnqEu92Fr1Mu51TjASc1CsTKlA.woff2 similarity index 100% rename from docs/.cache/plugin/privacy/assets/external/fonts.gstatic.com/s/roboto/v30/KFOjCnqEu92Fr1Mu51TjASc1CsTKlA.woff2 rename to docs/assets/external/fonts.gstatic.com/s/roboto/v30/KFOjCnqEu92Fr1Mu51TjASc1CsTKlA.woff2 diff --git a/docs/.cache/plugin/privacy/assets/external/fonts.gstatic.com/s/roboto/v30/KFOjCnqEu92Fr1Mu51TjASc2CsTKlA.woff2 b/docs/assets/external/fonts.gstatic.com/s/roboto/v30/KFOjCnqEu92Fr1Mu51TjASc2CsTKlA.woff2 similarity index 100% rename from docs/.cache/plugin/privacy/assets/external/fonts.gstatic.com/s/roboto/v30/KFOjCnqEu92Fr1Mu51TjASc2CsTKlA.woff2 rename to docs/assets/external/fonts.gstatic.com/s/roboto/v30/KFOjCnqEu92Fr1Mu51TjASc2CsTKlA.woff2 diff --git a/docs/.cache/plugin/privacy/assets/external/fonts.gstatic.com/s/roboto/v30/KFOjCnqEu92Fr1Mu51TjASc3CsTKlA.woff2 b/docs/assets/external/fonts.gstatic.com/s/roboto/v30/KFOjCnqEu92Fr1Mu51TjASc3CsTKlA.woff2 similarity index 100% rename from docs/.cache/plugin/privacy/assets/external/fonts.gstatic.com/s/roboto/v30/KFOjCnqEu92Fr1Mu51TjASc3CsTKlA.woff2 rename to docs/assets/external/fonts.gstatic.com/s/roboto/v30/KFOjCnqEu92Fr1Mu51TjASc3CsTKlA.woff2 diff --git a/docs/.cache/plugin/privacy/assets/external/fonts.gstatic.com/s/roboto/v30/KFOjCnqEu92Fr1Mu51TjASc5CsTKlA.woff2 b/docs/assets/external/fonts.gstatic.com/s/roboto/v30/KFOjCnqEu92Fr1Mu51TjASc5CsTKlA.woff2 similarity index 100% rename from docs/.cache/plugin/privacy/assets/external/fonts.gstatic.com/s/roboto/v30/KFOjCnqEu92Fr1Mu51TjASc5CsTKlA.woff2 rename to docs/assets/external/fonts.gstatic.com/s/roboto/v30/KFOjCnqEu92Fr1Mu51TjASc5CsTKlA.woff2 diff --git a/docs/.cache/plugin/privacy/assets/external/fonts.gstatic.com/s/roboto/v30/KFOjCnqEu92Fr1Mu51TjASc6CsQ.woff2 b/docs/assets/external/fonts.gstatic.com/s/roboto/v30/KFOjCnqEu92Fr1Mu51TjASc6CsQ.woff2 similarity index 100% rename from docs/.cache/plugin/privacy/assets/external/fonts.gstatic.com/s/roboto/v30/KFOjCnqEu92Fr1Mu51TjASc6CsQ.woff2 rename to docs/assets/external/fonts.gstatic.com/s/roboto/v30/KFOjCnqEu92Fr1Mu51TjASc6CsQ.woff2 diff --git a/docs/.cache/plugin/privacy/assets/external/fonts.gstatic.com/s/roboto/v30/KFOjCnqEu92Fr1Mu51TzBic-CsTKlA.woff2 b/docs/assets/external/fonts.gstatic.com/s/roboto/v30/KFOjCnqEu92Fr1Mu51TzBic-CsTKlA.woff2 similarity index 100% rename from docs/.cache/plugin/privacy/assets/external/fonts.gstatic.com/s/roboto/v30/KFOjCnqEu92Fr1Mu51TzBic-CsTKlA.woff2 rename to docs/assets/external/fonts.gstatic.com/s/roboto/v30/KFOjCnqEu92Fr1Mu51TzBic-CsTKlA.woff2 diff --git a/docs/.cache/plugin/privacy/assets/external/fonts.gstatic.com/s/roboto/v30/KFOjCnqEu92Fr1Mu51TzBic0CsTKlA.woff2 b/docs/assets/external/fonts.gstatic.com/s/roboto/v30/KFOjCnqEu92Fr1Mu51TzBic0CsTKlA.woff2 similarity index 100% rename from docs/.cache/plugin/privacy/assets/external/fonts.gstatic.com/s/roboto/v30/KFOjCnqEu92Fr1Mu51TzBic0CsTKlA.woff2 rename to docs/assets/external/fonts.gstatic.com/s/roboto/v30/KFOjCnqEu92Fr1Mu51TzBic0CsTKlA.woff2 diff --git a/docs/.cache/plugin/privacy/assets/external/fonts.gstatic.com/s/roboto/v30/KFOjCnqEu92Fr1Mu51TzBic1CsTKlA.woff2 b/docs/assets/external/fonts.gstatic.com/s/roboto/v30/KFOjCnqEu92Fr1Mu51TzBic1CsTKlA.woff2 similarity index 100% rename from docs/.cache/plugin/privacy/assets/external/fonts.gstatic.com/s/roboto/v30/KFOjCnqEu92Fr1Mu51TzBic1CsTKlA.woff2 rename to docs/assets/external/fonts.gstatic.com/s/roboto/v30/KFOjCnqEu92Fr1Mu51TzBic1CsTKlA.woff2 diff --git a/docs/.cache/plugin/privacy/assets/external/fonts.gstatic.com/s/roboto/v30/KFOjCnqEu92Fr1Mu51TzBic2CsTKlA.woff2 b/docs/assets/external/fonts.gstatic.com/s/roboto/v30/KFOjCnqEu92Fr1Mu51TzBic2CsTKlA.woff2 similarity index 100% rename from docs/.cache/plugin/privacy/assets/external/fonts.gstatic.com/s/roboto/v30/KFOjCnqEu92Fr1Mu51TzBic2CsTKlA.woff2 rename to docs/assets/external/fonts.gstatic.com/s/roboto/v30/KFOjCnqEu92Fr1Mu51TzBic2CsTKlA.woff2 diff --git a/docs/.cache/plugin/privacy/assets/external/fonts.gstatic.com/s/roboto/v30/KFOjCnqEu92Fr1Mu51TzBic3CsTKlA.woff2 b/docs/assets/external/fonts.gstatic.com/s/roboto/v30/KFOjCnqEu92Fr1Mu51TzBic3CsTKlA.woff2 similarity index 100% rename from docs/.cache/plugin/privacy/assets/external/fonts.gstatic.com/s/roboto/v30/KFOjCnqEu92Fr1Mu51TzBic3CsTKlA.woff2 rename to docs/assets/external/fonts.gstatic.com/s/roboto/v30/KFOjCnqEu92Fr1Mu51TzBic3CsTKlA.woff2 diff --git a/docs/.cache/plugin/privacy/assets/external/fonts.gstatic.com/s/roboto/v30/KFOjCnqEu92Fr1Mu51TzBic5CsTKlA.woff2 b/docs/assets/external/fonts.gstatic.com/s/roboto/v30/KFOjCnqEu92Fr1Mu51TzBic5CsTKlA.woff2 similarity index 100% rename from docs/.cache/plugin/privacy/assets/external/fonts.gstatic.com/s/roboto/v30/KFOjCnqEu92Fr1Mu51TzBic5CsTKlA.woff2 rename to docs/assets/external/fonts.gstatic.com/s/roboto/v30/KFOjCnqEu92Fr1Mu51TzBic5CsTKlA.woff2 diff --git a/docs/.cache/plugin/privacy/assets/external/fonts.gstatic.com/s/roboto/v30/KFOjCnqEu92Fr1Mu51TzBic6CsQ.woff2 b/docs/assets/external/fonts.gstatic.com/s/roboto/v30/KFOjCnqEu92Fr1Mu51TzBic6CsQ.woff2 similarity index 100% rename from docs/.cache/plugin/privacy/assets/external/fonts.gstatic.com/s/roboto/v30/KFOjCnqEu92Fr1Mu51TzBic6CsQ.woff2 rename to docs/assets/external/fonts.gstatic.com/s/roboto/v30/KFOjCnqEu92Fr1Mu51TzBic6CsQ.woff2 diff --git a/docs/.cache/plugin/privacy/assets/external/fonts.gstatic.com/s/roboto/v30/KFOkCnqEu92Fr1Mu51xEIzIFKw.woff2 b/docs/assets/external/fonts.gstatic.com/s/roboto/v30/KFOkCnqEu92Fr1Mu51xEIzIFKw.woff2 similarity index 100% rename from docs/.cache/plugin/privacy/assets/external/fonts.gstatic.com/s/roboto/v30/KFOkCnqEu92Fr1Mu51xEIzIFKw.woff2 rename to docs/assets/external/fonts.gstatic.com/s/roboto/v30/KFOkCnqEu92Fr1Mu51xEIzIFKw.woff2 diff --git a/docs/.cache/plugin/privacy/assets/external/fonts.gstatic.com/s/roboto/v30/KFOkCnqEu92Fr1Mu51xFIzIFKw.woff2 b/docs/assets/external/fonts.gstatic.com/s/roboto/v30/KFOkCnqEu92Fr1Mu51xFIzIFKw.woff2 similarity index 100% rename from docs/.cache/plugin/privacy/assets/external/fonts.gstatic.com/s/roboto/v30/KFOkCnqEu92Fr1Mu51xFIzIFKw.woff2 rename to docs/assets/external/fonts.gstatic.com/s/roboto/v30/KFOkCnqEu92Fr1Mu51xFIzIFKw.woff2 diff --git a/docs/.cache/plugin/privacy/assets/external/fonts.gstatic.com/s/roboto/v30/KFOkCnqEu92Fr1Mu51xGIzIFKw.woff2 b/docs/assets/external/fonts.gstatic.com/s/roboto/v30/KFOkCnqEu92Fr1Mu51xGIzIFKw.woff2 similarity index 100% rename from docs/.cache/plugin/privacy/assets/external/fonts.gstatic.com/s/roboto/v30/KFOkCnqEu92Fr1Mu51xGIzIFKw.woff2 rename to docs/assets/external/fonts.gstatic.com/s/roboto/v30/KFOkCnqEu92Fr1Mu51xGIzIFKw.woff2 diff --git a/docs/.cache/plugin/privacy/assets/external/fonts.gstatic.com/s/roboto/v30/KFOkCnqEu92Fr1Mu51xHIzIFKw.woff2 b/docs/assets/external/fonts.gstatic.com/s/roboto/v30/KFOkCnqEu92Fr1Mu51xHIzIFKw.woff2 similarity index 100% rename from docs/.cache/plugin/privacy/assets/external/fonts.gstatic.com/s/roboto/v30/KFOkCnqEu92Fr1Mu51xHIzIFKw.woff2 rename to docs/assets/external/fonts.gstatic.com/s/roboto/v30/KFOkCnqEu92Fr1Mu51xHIzIFKw.woff2 diff --git a/docs/.cache/plugin/privacy/assets/external/fonts.gstatic.com/s/roboto/v30/KFOkCnqEu92Fr1Mu51xIIzI.woff2 b/docs/assets/external/fonts.gstatic.com/s/roboto/v30/KFOkCnqEu92Fr1Mu51xIIzI.woff2 similarity index 100% rename from docs/.cache/plugin/privacy/assets/external/fonts.gstatic.com/s/roboto/v30/KFOkCnqEu92Fr1Mu51xIIzI.woff2 rename to docs/assets/external/fonts.gstatic.com/s/roboto/v30/KFOkCnqEu92Fr1Mu51xIIzI.woff2 diff --git a/docs/.cache/plugin/privacy/assets/external/fonts.gstatic.com/s/roboto/v30/KFOkCnqEu92Fr1Mu51xLIzIFKw.woff2 b/docs/assets/external/fonts.gstatic.com/s/roboto/v30/KFOkCnqEu92Fr1Mu51xLIzIFKw.woff2 similarity index 100% rename from docs/.cache/plugin/privacy/assets/external/fonts.gstatic.com/s/roboto/v30/KFOkCnqEu92Fr1Mu51xLIzIFKw.woff2 rename to docs/assets/external/fonts.gstatic.com/s/roboto/v30/KFOkCnqEu92Fr1Mu51xLIzIFKw.woff2 diff --git a/docs/.cache/plugin/privacy/assets/external/fonts.gstatic.com/s/roboto/v30/KFOkCnqEu92Fr1Mu51xMIzIFKw.woff2 b/docs/assets/external/fonts.gstatic.com/s/roboto/v30/KFOkCnqEu92Fr1Mu51xMIzIFKw.woff2 similarity index 100% rename from docs/.cache/plugin/privacy/assets/external/fonts.gstatic.com/s/roboto/v30/KFOkCnqEu92Fr1Mu51xMIzIFKw.woff2 rename to docs/assets/external/fonts.gstatic.com/s/roboto/v30/KFOkCnqEu92Fr1Mu51xMIzIFKw.woff2 diff --git a/docs/.cache/plugin/privacy/assets/external/fonts.gstatic.com/s/roboto/v30/KFOlCnqEu92Fr1MmSU5fABc4EsA.woff2 b/docs/assets/external/fonts.gstatic.com/s/roboto/v30/KFOlCnqEu92Fr1MmSU5fABc4EsA.woff2 similarity index 100% rename from docs/.cache/plugin/privacy/assets/external/fonts.gstatic.com/s/roboto/v30/KFOlCnqEu92Fr1MmSU5fABc4EsA.woff2 rename to docs/assets/external/fonts.gstatic.com/s/roboto/v30/KFOlCnqEu92Fr1MmSU5fABc4EsA.woff2 diff --git a/docs/.cache/plugin/privacy/assets/external/fonts.gstatic.com/s/roboto/v30/KFOlCnqEu92Fr1MmSU5fBBc4.woff2 b/docs/assets/external/fonts.gstatic.com/s/roboto/v30/KFOlCnqEu92Fr1MmSU5fBBc4.woff2 similarity index 100% rename from docs/.cache/plugin/privacy/assets/external/fonts.gstatic.com/s/roboto/v30/KFOlCnqEu92Fr1MmSU5fBBc4.woff2 rename to docs/assets/external/fonts.gstatic.com/s/roboto/v30/KFOlCnqEu92Fr1MmSU5fBBc4.woff2 diff --git a/docs/.cache/plugin/privacy/assets/external/fonts.gstatic.com/s/roboto/v30/KFOlCnqEu92Fr1MmSU5fBxc4EsA.woff2 b/docs/assets/external/fonts.gstatic.com/s/roboto/v30/KFOlCnqEu92Fr1MmSU5fBxc4EsA.woff2 similarity index 100% rename from docs/.cache/plugin/privacy/assets/external/fonts.gstatic.com/s/roboto/v30/KFOlCnqEu92Fr1MmSU5fBxc4EsA.woff2 rename to docs/assets/external/fonts.gstatic.com/s/roboto/v30/KFOlCnqEu92Fr1MmSU5fBxc4EsA.woff2 diff --git a/docs/.cache/plugin/privacy/assets/external/fonts.gstatic.com/s/roboto/v30/KFOlCnqEu92Fr1MmSU5fCBc4EsA.woff2 b/docs/assets/external/fonts.gstatic.com/s/roboto/v30/KFOlCnqEu92Fr1MmSU5fCBc4EsA.woff2 similarity index 100% rename from docs/.cache/plugin/privacy/assets/external/fonts.gstatic.com/s/roboto/v30/KFOlCnqEu92Fr1MmSU5fCBc4EsA.woff2 rename to docs/assets/external/fonts.gstatic.com/s/roboto/v30/KFOlCnqEu92Fr1MmSU5fCBc4EsA.woff2 diff --git a/docs/.cache/plugin/privacy/assets/external/fonts.gstatic.com/s/roboto/v30/KFOlCnqEu92Fr1MmSU5fCRc4EsA.woff2 b/docs/assets/external/fonts.gstatic.com/s/roboto/v30/KFOlCnqEu92Fr1MmSU5fCRc4EsA.woff2 similarity index 100% rename from docs/.cache/plugin/privacy/assets/external/fonts.gstatic.com/s/roboto/v30/KFOlCnqEu92Fr1MmSU5fCRc4EsA.woff2 rename to docs/assets/external/fonts.gstatic.com/s/roboto/v30/KFOlCnqEu92Fr1MmSU5fCRc4EsA.woff2 diff --git a/docs/.cache/plugin/privacy/assets/external/fonts.gstatic.com/s/roboto/v30/KFOlCnqEu92Fr1MmSU5fChc4EsA.woff2 b/docs/assets/external/fonts.gstatic.com/s/roboto/v30/KFOlCnqEu92Fr1MmSU5fChc4EsA.woff2 similarity index 100% rename from docs/.cache/plugin/privacy/assets/external/fonts.gstatic.com/s/roboto/v30/KFOlCnqEu92Fr1MmSU5fChc4EsA.woff2 rename to docs/assets/external/fonts.gstatic.com/s/roboto/v30/KFOlCnqEu92Fr1MmSU5fChc4EsA.woff2 diff --git a/docs/.cache/plugin/privacy/assets/external/fonts.gstatic.com/s/roboto/v30/KFOlCnqEu92Fr1MmSU5fCxc4EsA.woff2 b/docs/assets/external/fonts.gstatic.com/s/roboto/v30/KFOlCnqEu92Fr1MmSU5fCxc4EsA.woff2 similarity index 100% rename from docs/.cache/plugin/privacy/assets/external/fonts.gstatic.com/s/roboto/v30/KFOlCnqEu92Fr1MmSU5fCxc4EsA.woff2 rename to docs/assets/external/fonts.gstatic.com/s/roboto/v30/KFOlCnqEu92Fr1MmSU5fCxc4EsA.woff2 diff --git a/docs/.cache/plugin/privacy/assets/external/fonts.gstatic.com/s/roboto/v30/KFOlCnqEu92Fr1MmWUlfABc4EsA.woff2 b/docs/assets/external/fonts.gstatic.com/s/roboto/v30/KFOlCnqEu92Fr1MmWUlfABc4EsA.woff2 similarity index 100% rename from docs/.cache/plugin/privacy/assets/external/fonts.gstatic.com/s/roboto/v30/KFOlCnqEu92Fr1MmWUlfABc4EsA.woff2 rename to docs/assets/external/fonts.gstatic.com/s/roboto/v30/KFOlCnqEu92Fr1MmWUlfABc4EsA.woff2 diff --git a/docs/.cache/plugin/privacy/assets/external/fonts.gstatic.com/s/roboto/v30/KFOlCnqEu92Fr1MmWUlfBBc4.woff2 b/docs/assets/external/fonts.gstatic.com/s/roboto/v30/KFOlCnqEu92Fr1MmWUlfBBc4.woff2 similarity index 100% rename from docs/.cache/plugin/privacy/assets/external/fonts.gstatic.com/s/roboto/v30/KFOlCnqEu92Fr1MmWUlfBBc4.woff2 rename to docs/assets/external/fonts.gstatic.com/s/roboto/v30/KFOlCnqEu92Fr1MmWUlfBBc4.woff2 diff --git a/docs/.cache/plugin/privacy/assets/external/fonts.gstatic.com/s/roboto/v30/KFOlCnqEu92Fr1MmWUlfBxc4EsA.woff2 b/docs/assets/external/fonts.gstatic.com/s/roboto/v30/KFOlCnqEu92Fr1MmWUlfBxc4EsA.woff2 similarity index 100% rename from docs/.cache/plugin/privacy/assets/external/fonts.gstatic.com/s/roboto/v30/KFOlCnqEu92Fr1MmWUlfBxc4EsA.woff2 rename to docs/assets/external/fonts.gstatic.com/s/roboto/v30/KFOlCnqEu92Fr1MmWUlfBxc4EsA.woff2 diff --git a/docs/.cache/plugin/privacy/assets/external/fonts.gstatic.com/s/roboto/v30/KFOlCnqEu92Fr1MmWUlfCBc4EsA.woff2 b/docs/assets/external/fonts.gstatic.com/s/roboto/v30/KFOlCnqEu92Fr1MmWUlfCBc4EsA.woff2 similarity index 100% rename from docs/.cache/plugin/privacy/assets/external/fonts.gstatic.com/s/roboto/v30/KFOlCnqEu92Fr1MmWUlfCBc4EsA.woff2 rename to docs/assets/external/fonts.gstatic.com/s/roboto/v30/KFOlCnqEu92Fr1MmWUlfCBc4EsA.woff2 diff --git a/docs/.cache/plugin/privacy/assets/external/fonts.gstatic.com/s/roboto/v30/KFOlCnqEu92Fr1MmWUlfCRc4EsA.woff2 b/docs/assets/external/fonts.gstatic.com/s/roboto/v30/KFOlCnqEu92Fr1MmWUlfCRc4EsA.woff2 similarity index 100% rename from docs/.cache/plugin/privacy/assets/external/fonts.gstatic.com/s/roboto/v30/KFOlCnqEu92Fr1MmWUlfCRc4EsA.woff2 rename to docs/assets/external/fonts.gstatic.com/s/roboto/v30/KFOlCnqEu92Fr1MmWUlfCRc4EsA.woff2 diff --git a/docs/.cache/plugin/privacy/assets/external/fonts.gstatic.com/s/roboto/v30/KFOlCnqEu92Fr1MmWUlfChc4EsA.woff2 b/docs/assets/external/fonts.gstatic.com/s/roboto/v30/KFOlCnqEu92Fr1MmWUlfChc4EsA.woff2 similarity index 100% rename from docs/.cache/plugin/privacy/assets/external/fonts.gstatic.com/s/roboto/v30/KFOlCnqEu92Fr1MmWUlfChc4EsA.woff2 rename to docs/assets/external/fonts.gstatic.com/s/roboto/v30/KFOlCnqEu92Fr1MmWUlfChc4EsA.woff2 diff --git a/docs/.cache/plugin/privacy/assets/external/fonts.gstatic.com/s/roboto/v30/KFOlCnqEu92Fr1MmWUlfCxc4EsA.woff2 b/docs/assets/external/fonts.gstatic.com/s/roboto/v30/KFOlCnqEu92Fr1MmWUlfCxc4EsA.woff2 similarity index 100% rename from docs/.cache/plugin/privacy/assets/external/fonts.gstatic.com/s/roboto/v30/KFOlCnqEu92Fr1MmWUlfCxc4EsA.woff2 rename to docs/assets/external/fonts.gstatic.com/s/roboto/v30/KFOlCnqEu92Fr1MmWUlfCxc4EsA.woff2 diff --git a/docs/.cache/plugin/privacy/assets/external/fonts.gstatic.com/s/roboto/v30/KFOmCnqEu92Fr1Mu4WxKOzY.woff2 b/docs/assets/external/fonts.gstatic.com/s/roboto/v30/KFOmCnqEu92Fr1Mu4WxKOzY.woff2 similarity index 100% rename from docs/.cache/plugin/privacy/assets/external/fonts.gstatic.com/s/roboto/v30/KFOmCnqEu92Fr1Mu4WxKOzY.woff2 rename to docs/assets/external/fonts.gstatic.com/s/roboto/v30/KFOmCnqEu92Fr1Mu4WxKOzY.woff2 diff --git a/docs/.cache/plugin/privacy/assets/external/fonts.gstatic.com/s/roboto/v30/KFOmCnqEu92Fr1Mu4mxK.woff2 b/docs/assets/external/fonts.gstatic.com/s/roboto/v30/KFOmCnqEu92Fr1Mu4mxK.woff2 similarity index 100% rename from docs/.cache/plugin/privacy/assets/external/fonts.gstatic.com/s/roboto/v30/KFOmCnqEu92Fr1Mu4mxK.woff2 rename to docs/assets/external/fonts.gstatic.com/s/roboto/v30/KFOmCnqEu92Fr1Mu4mxK.woff2 diff --git a/docs/.cache/plugin/privacy/assets/external/fonts.gstatic.com/s/roboto/v30/KFOmCnqEu92Fr1Mu5mxKOzY.woff2 b/docs/assets/external/fonts.gstatic.com/s/roboto/v30/KFOmCnqEu92Fr1Mu5mxKOzY.woff2 similarity index 100% rename from docs/.cache/plugin/privacy/assets/external/fonts.gstatic.com/s/roboto/v30/KFOmCnqEu92Fr1Mu5mxKOzY.woff2 rename to docs/assets/external/fonts.gstatic.com/s/roboto/v30/KFOmCnqEu92Fr1Mu5mxKOzY.woff2 diff --git a/docs/.cache/plugin/privacy/assets/external/fonts.gstatic.com/s/roboto/v30/KFOmCnqEu92Fr1Mu72xKOzY.woff2 b/docs/assets/external/fonts.gstatic.com/s/roboto/v30/KFOmCnqEu92Fr1Mu72xKOzY.woff2 similarity index 100% rename from docs/.cache/plugin/privacy/assets/external/fonts.gstatic.com/s/roboto/v30/KFOmCnqEu92Fr1Mu72xKOzY.woff2 rename to docs/assets/external/fonts.gstatic.com/s/roboto/v30/KFOmCnqEu92Fr1Mu72xKOzY.woff2 diff --git a/docs/.cache/plugin/privacy/assets/external/fonts.gstatic.com/s/roboto/v30/KFOmCnqEu92Fr1Mu7GxKOzY.woff2 b/docs/assets/external/fonts.gstatic.com/s/roboto/v30/KFOmCnqEu92Fr1Mu7GxKOzY.woff2 similarity index 100% rename from docs/.cache/plugin/privacy/assets/external/fonts.gstatic.com/s/roboto/v30/KFOmCnqEu92Fr1Mu7GxKOzY.woff2 rename to docs/assets/external/fonts.gstatic.com/s/roboto/v30/KFOmCnqEu92Fr1Mu7GxKOzY.woff2 diff --git a/docs/.cache/plugin/privacy/assets/external/fonts.gstatic.com/s/roboto/v30/KFOmCnqEu92Fr1Mu7WxKOzY.woff2 b/docs/assets/external/fonts.gstatic.com/s/roboto/v30/KFOmCnqEu92Fr1Mu7WxKOzY.woff2 similarity index 100% rename from docs/.cache/plugin/privacy/assets/external/fonts.gstatic.com/s/roboto/v30/KFOmCnqEu92Fr1Mu7WxKOzY.woff2 rename to docs/assets/external/fonts.gstatic.com/s/roboto/v30/KFOmCnqEu92Fr1Mu7WxKOzY.woff2 diff --git a/docs/.cache/plugin/privacy/assets/external/fonts.gstatic.com/s/roboto/v30/KFOmCnqEu92Fr1Mu7mxKOzY.woff2 b/docs/assets/external/fonts.gstatic.com/s/roboto/v30/KFOmCnqEu92Fr1Mu7mxKOzY.woff2 similarity index 100% rename from docs/.cache/plugin/privacy/assets/external/fonts.gstatic.com/s/roboto/v30/KFOmCnqEu92Fr1Mu7mxKOzY.woff2 rename to docs/assets/external/fonts.gstatic.com/s/roboto/v30/KFOmCnqEu92Fr1Mu7mxKOzY.woff2 diff --git a/docs/.cache/plugin/privacy/assets/external/fonts.gstatic.com/s/robotomono/v22/L0xTDF4xlVMF-BfR8bXMIhJHg45mwgGEFl0_3vrtSM1J-gEPT5Ese6hmHSV0mf0h.woff2 b/docs/assets/external/fonts.gstatic.com/s/robotomono/v22/L0xTDF4xlVMF-BfR8bXMIhJHg45mwgGEFl0_3vrtSM1J-gEPT5Ese6hmHSV0mf0h.woff2 similarity index 100% rename from docs/.cache/plugin/privacy/assets/external/fonts.gstatic.com/s/robotomono/v22/L0xTDF4xlVMF-BfR8bXMIhJHg45mwgGEFl0_3vrtSM1J-gEPT5Ese6hmHSV0mf0h.woff2 rename to docs/assets/external/fonts.gstatic.com/s/robotomono/v22/L0xTDF4xlVMF-BfR8bXMIhJHg45mwgGEFl0_3vrtSM1J-gEPT5Ese6hmHSV0mf0h.woff2 diff --git a/docs/.cache/plugin/privacy/assets/external/fonts.gstatic.com/s/robotomono/v22/L0xTDF4xlVMF-BfR8bXMIhJHg45mwgGEFl0_3vrtSM1J-gEPT5Ese6hmHSZ0mf0h.woff2 b/docs/assets/external/fonts.gstatic.com/s/robotomono/v22/L0xTDF4xlVMF-BfR8bXMIhJHg45mwgGEFl0_3vrtSM1J-gEPT5Ese6hmHSZ0mf0h.woff2 similarity index 100% rename from docs/.cache/plugin/privacy/assets/external/fonts.gstatic.com/s/robotomono/v22/L0xTDF4xlVMF-BfR8bXMIhJHg45mwgGEFl0_3vrtSM1J-gEPT5Ese6hmHSZ0mf0h.woff2 rename to docs/assets/external/fonts.gstatic.com/s/robotomono/v22/L0xTDF4xlVMF-BfR8bXMIhJHg45mwgGEFl0_3vrtSM1J-gEPT5Ese6hmHSZ0mf0h.woff2 diff --git a/docs/.cache/plugin/privacy/assets/external/fonts.gstatic.com/s/robotomono/v22/L0xTDF4xlVMF-BfR8bXMIhJHg45mwgGEFl0_3vrtSM1J-gEPT5Ese6hmHSd0mf0h.woff2 b/docs/assets/external/fonts.gstatic.com/s/robotomono/v22/L0xTDF4xlVMF-BfR8bXMIhJHg45mwgGEFl0_3vrtSM1J-gEPT5Ese6hmHSd0mf0h.woff2 similarity index 100% rename from docs/.cache/plugin/privacy/assets/external/fonts.gstatic.com/s/robotomono/v22/L0xTDF4xlVMF-BfR8bXMIhJHg45mwgGEFl0_3vrtSM1J-gEPT5Ese6hmHSd0mf0h.woff2 rename to docs/assets/external/fonts.gstatic.com/s/robotomono/v22/L0xTDF4xlVMF-BfR8bXMIhJHg45mwgGEFl0_3vrtSM1J-gEPT5Ese6hmHSd0mf0h.woff2 diff --git a/docs/.cache/plugin/privacy/assets/external/fonts.gstatic.com/s/robotomono/v22/L0xTDF4xlVMF-BfR8bXMIhJHg45mwgGEFl0_3vrtSM1J-gEPT5Ese6hmHSh0mQ.woff2 b/docs/assets/external/fonts.gstatic.com/s/robotomono/v22/L0xTDF4xlVMF-BfR8bXMIhJHg45mwgGEFl0_3vrtSM1J-gEPT5Ese6hmHSh0mQ.woff2 similarity index 100% rename from docs/.cache/plugin/privacy/assets/external/fonts.gstatic.com/s/robotomono/v22/L0xTDF4xlVMF-BfR8bXMIhJHg45mwgGEFl0_3vrtSM1J-gEPT5Ese6hmHSh0mQ.woff2 rename to docs/assets/external/fonts.gstatic.com/s/robotomono/v22/L0xTDF4xlVMF-BfR8bXMIhJHg45mwgGEFl0_3vrtSM1J-gEPT5Ese6hmHSh0mQ.woff2 diff --git a/docs/.cache/plugin/privacy/assets/external/fonts.gstatic.com/s/robotomono/v22/L0xTDF4xlVMF-BfR8bXMIhJHg45mwgGEFl0_3vrtSM1J-gEPT5Ese6hmHSt0mf0h.woff2 b/docs/assets/external/fonts.gstatic.com/s/robotomono/v22/L0xTDF4xlVMF-BfR8bXMIhJHg45mwgGEFl0_3vrtSM1J-gEPT5Ese6hmHSt0mf0h.woff2 similarity index 100% rename from docs/.cache/plugin/privacy/assets/external/fonts.gstatic.com/s/robotomono/v22/L0xTDF4xlVMF-BfR8bXMIhJHg45mwgGEFl0_3vrtSM1J-gEPT5Ese6hmHSt0mf0h.woff2 rename to docs/assets/external/fonts.gstatic.com/s/robotomono/v22/L0xTDF4xlVMF-BfR8bXMIhJHg45mwgGEFl0_3vrtSM1J-gEPT5Ese6hmHSt0mf0h.woff2 diff --git a/docs/.cache/plugin/privacy/assets/external/fonts.gstatic.com/s/robotomono/v22/L0xTDF4xlVMF-BfR8bXMIhJHg45mwgGEFl0_3vrtSM1J-gEPT5Ese6hmHSx0mf0h.woff2 b/docs/assets/external/fonts.gstatic.com/s/robotomono/v22/L0xTDF4xlVMF-BfR8bXMIhJHg45mwgGEFl0_3vrtSM1J-gEPT5Ese6hmHSx0mf0h.woff2 similarity index 100% rename from docs/.cache/plugin/privacy/assets/external/fonts.gstatic.com/s/robotomono/v22/L0xTDF4xlVMF-BfR8bXMIhJHg45mwgGEFl0_3vrtSM1J-gEPT5Ese6hmHSx0mf0h.woff2 rename to docs/assets/external/fonts.gstatic.com/s/robotomono/v22/L0xTDF4xlVMF-BfR8bXMIhJHg45mwgGEFl0_3vrtSM1J-gEPT5Ese6hmHSx0mf0h.woff2 diff --git a/docs/.cache/plugin/privacy/assets/external/fonts.gstatic.com/s/robotomono/v22/L0xdDF4xlVMF-BfR8bXMIjhOsXG-q2oeuFoqFrlnAIe2Imhk1T8rbociImtElOUlYIw.woff2 b/docs/assets/external/fonts.gstatic.com/s/robotomono/v22/L0xdDF4xlVMF-BfR8bXMIjhOsXG-q2oeuFoqFrlnAIe2Imhk1T8rbociImtElOUlYIw.woff2 similarity index 100% rename from docs/.cache/plugin/privacy/assets/external/fonts.gstatic.com/s/robotomono/v22/L0xdDF4xlVMF-BfR8bXMIjhOsXG-q2oeuFoqFrlnAIe2Imhk1T8rbociImtElOUlYIw.woff2 rename to docs/assets/external/fonts.gstatic.com/s/robotomono/v22/L0xdDF4xlVMF-BfR8bXMIjhOsXG-q2oeuFoqFrlnAIe2Imhk1T8rbociImtElOUlYIw.woff2 diff --git a/docs/.cache/plugin/privacy/assets/external/fonts.gstatic.com/s/robotomono/v22/L0xdDF4xlVMF-BfR8bXMIjhOsXG-q2oeuFoqFrlnAIe2Imhk1T8rbociImtEleUlYIw.woff2 b/docs/assets/external/fonts.gstatic.com/s/robotomono/v22/L0xdDF4xlVMF-BfR8bXMIjhOsXG-q2oeuFoqFrlnAIe2Imhk1T8rbociImtEleUlYIw.woff2 similarity index 100% rename from docs/.cache/plugin/privacy/assets/external/fonts.gstatic.com/s/robotomono/v22/L0xdDF4xlVMF-BfR8bXMIjhOsXG-q2oeuFoqFrlnAIe2Imhk1T8rbociImtEleUlYIw.woff2 rename to docs/assets/external/fonts.gstatic.com/s/robotomono/v22/L0xdDF4xlVMF-BfR8bXMIjhOsXG-q2oeuFoqFrlnAIe2Imhk1T8rbociImtEleUlYIw.woff2 diff --git a/docs/.cache/plugin/privacy/assets/external/fonts.gstatic.com/s/robotomono/v22/L0xdDF4xlVMF-BfR8bXMIjhOsXG-q2oeuFoqFrlnAIe2Imhk1T8rbociImtEluUlYIw.woff2 b/docs/assets/external/fonts.gstatic.com/s/robotomono/v22/L0xdDF4xlVMF-BfR8bXMIjhOsXG-q2oeuFoqFrlnAIe2Imhk1T8rbociImtEluUlYIw.woff2 similarity index 100% rename from docs/.cache/plugin/privacy/assets/external/fonts.gstatic.com/s/robotomono/v22/L0xdDF4xlVMF-BfR8bXMIjhOsXG-q2oeuFoqFrlnAIe2Imhk1T8rbociImtEluUlYIw.woff2 rename to docs/assets/external/fonts.gstatic.com/s/robotomono/v22/L0xdDF4xlVMF-BfR8bXMIjhOsXG-q2oeuFoqFrlnAIe2Imhk1T8rbociImtEluUlYIw.woff2 diff --git a/docs/.cache/plugin/privacy/assets/external/fonts.gstatic.com/s/robotomono/v22/L0xdDF4xlVMF-BfR8bXMIjhOsXG-q2oeuFoqFrlnAIe2Imhk1T8rbociImtEm-Ul.woff2 b/docs/assets/external/fonts.gstatic.com/s/robotomono/v22/L0xdDF4xlVMF-BfR8bXMIjhOsXG-q2oeuFoqFrlnAIe2Imhk1T8rbociImtEm-Ul.woff2 similarity index 100% rename from docs/.cache/plugin/privacy/assets/external/fonts.gstatic.com/s/robotomono/v22/L0xdDF4xlVMF-BfR8bXMIjhOsXG-q2oeuFoqFrlnAIe2Imhk1T8rbociImtEm-Ul.woff2 rename to docs/assets/external/fonts.gstatic.com/s/robotomono/v22/L0xdDF4xlVMF-BfR8bXMIjhOsXG-q2oeuFoqFrlnAIe2Imhk1T8rbociImtEm-Ul.woff2 diff --git a/docs/.cache/plugin/privacy/assets/external/fonts.gstatic.com/s/robotomono/v22/L0xdDF4xlVMF-BfR8bXMIjhOsXG-q2oeuFoqFrlnAIe2Imhk1T8rbociImtEmOUlYIw.woff2 b/docs/assets/external/fonts.gstatic.com/s/robotomono/v22/L0xdDF4xlVMF-BfR8bXMIjhOsXG-q2oeuFoqFrlnAIe2Imhk1T8rbociImtEmOUlYIw.woff2 similarity index 100% rename from docs/.cache/plugin/privacy/assets/external/fonts.gstatic.com/s/robotomono/v22/L0xdDF4xlVMF-BfR8bXMIjhOsXG-q2oeuFoqFrlnAIe2Imhk1T8rbociImtEmOUlYIw.woff2 rename to docs/assets/external/fonts.gstatic.com/s/robotomono/v22/L0xdDF4xlVMF-BfR8bXMIjhOsXG-q2oeuFoqFrlnAIe2Imhk1T8rbociImtEmOUlYIw.woff2 diff --git a/docs/.cache/plugin/privacy/assets/external/fonts.gstatic.com/s/robotomono/v22/L0xdDF4xlVMF-BfR8bXMIjhOsXG-q2oeuFoqFrlnAIe2Imhk1T8rbociImtEn-UlYIw.woff2 b/docs/assets/external/fonts.gstatic.com/s/robotomono/v22/L0xdDF4xlVMF-BfR8bXMIjhOsXG-q2oeuFoqFrlnAIe2Imhk1T8rbociImtEn-UlYIw.woff2 similarity index 100% rename from docs/.cache/plugin/privacy/assets/external/fonts.gstatic.com/s/robotomono/v22/L0xdDF4xlVMF-BfR8bXMIjhOsXG-q2oeuFoqFrlnAIe2Imhk1T8rbociImtEn-UlYIw.woff2 rename to docs/assets/external/fonts.gstatic.com/s/robotomono/v22/L0xdDF4xlVMF-BfR8bXMIjhOsXG-q2oeuFoqFrlnAIe2Imhk1T8rbociImtEn-UlYIw.woff2 diff --git a/docs/.cache/plugin/privacy/assets/external/unpkg.com/mermaid@9.4.3/dist/mermaid.min.js b/docs/assets/external/unpkg.com/mermaid@9.4.3/dist/mermaid.min.js similarity index 100% rename from docs/.cache/plugin/privacy/assets/external/unpkg.com/mermaid@9.4.3/dist/mermaid.min.js rename to docs/assets/external/unpkg.com/mermaid@9.4.3/dist/mermaid.min.js diff --git a/docs/.cache/plugin/privacy/assets/external/unpkg.com/resize-observer-polyfill/dist/ResizeObserver.js b/docs/assets/external/unpkg.com/resize-observer-polyfill/dist/ResizeObserver.js similarity index 97% rename from docs/.cache/plugin/privacy/assets/external/unpkg.com/resize-observer-polyfill/dist/ResizeObserver.js rename to docs/assets/external/unpkg.com/resize-observer-polyfill/dist/ResizeObserver.js index d4388e4b4..d72927e85 100644 --- a/docs/.cache/plugin/privacy/assets/external/unpkg.com/resize-observer-polyfill/dist/ResizeObserver.js +++ b/docs/assets/external/unpkg.com/resize-observer-polyfill/dist/ResizeObserver.js @@ -4,931 +4,931 @@ (global.ResizeObserver = factory()); }(this, (function () { 'use strict'; - /** - * A collection of shims that provide minimal functionality of the ES6 collections. - * - * These implementations are not meant to be used outside of the ResizeObserver - * modules as they cover only a limited range of use cases. - */ - /* eslint-disable require-jsdoc, valid-jsdoc */ - var MapShim = (function () { - if (typeof Map !== 'undefined') { - return Map; - } - /** - * Returns index in provided array that matches the specified key. - * - * @param {Array} arr - * @param {*} key - * @returns {number} - */ - function getIndex(arr, key) { - var result = -1; - arr.some(function (entry, index) { - if (entry[0] === key) { - result = index; - return true; - } - return false; - }); - return result; - } - return /** @class */ (function () { - function class_1() { - this.__entries__ = []; - } - Object.defineProperty(class_1.prototype, "size", { - /** - * @returns {boolean} - */ - get: function () { - return this.__entries__.length; - }, - enumerable: true, - configurable: true - }); - /** - * @param {*} key - * @returns {*} - */ - class_1.prototype.get = function (key) { - var index = getIndex(this.__entries__, key); - var entry = this.__entries__[index]; - return entry && entry[1]; - }; - /** - * @param {*} key - * @param {*} value - * @returns {void} - */ - class_1.prototype.set = function (key, value) { - var index = getIndex(this.__entries__, key); - if (~index) { - this.__entries__[index][1] = value; - } - else { - this.__entries__.push([key, value]); - } - }; - /** - * @param {*} key - * @returns {void} - */ - class_1.prototype.delete = function (key) { - var entries = this.__entries__; - var index = getIndex(entries, key); - if (~index) { - entries.splice(index, 1); - } - }; - /** - * @param {*} key - * @returns {void} - */ - class_1.prototype.has = function (key) { - return !!~getIndex(this.__entries__, key); - }; - /** - * @returns {void} - */ - class_1.prototype.clear = function () { - this.__entries__.splice(0); - }; - /** - * @param {Function} callback - * @param {*} [ctx=null] - * @returns {void} - */ - class_1.prototype.forEach = function (callback, ctx) { - if (ctx === void 0) { ctx = null; } - for (var _i = 0, _a = this.__entries__; _i < _a.length; _i++) { - var entry = _a[_i]; - callback.call(ctx, entry[1], entry[0]); - } - }; - return class_1; - }()); + /** + * A collection of shims that provide minimal functionality of the ES6 collections. + * + * These implementations are not meant to be used outside of the ResizeObserver + * modules as they cover only a limited range of use cases. + */ + /* eslint-disable require-jsdoc, valid-jsdoc */ + var MapShim = (function () { + if (typeof Map !== 'undefined') { + return Map; + } + /** + * Returns index in provided array that matches the specified key. + * + * @param {Array} arr + * @param {*} key + * @returns {number} + */ + function getIndex(arr, key) { + var result = -1; + arr.some(function (entry, index) { + if (entry[0] === key) { + result = index; + return true; + } + return false; + }); + return result; + } + return /** @class */ (function () { + function class_1() { + this.__entries__ = []; + } + Object.defineProperty(class_1.prototype, "size", { + /** + * @returns {boolean} + */ + get: function () { + return this.__entries__.length; + }, + enumerable: true, + configurable: true + }); + /** + * @param {*} key + * @returns {*} + */ + class_1.prototype.get = function (key) { + var index = getIndex(this.__entries__, key); + var entry = this.__entries__[index]; + return entry && entry[1]; + }; + /** + * @param {*} key + * @param {*} value + * @returns {void} + */ + class_1.prototype.set = function (key, value) { + var index = getIndex(this.__entries__, key); + if (~index) { + this.__entries__[index][1] = value; + } + else { + this.__entries__.push([key, value]); + } + }; + /** + * @param {*} key + * @returns {void} + */ + class_1.prototype.delete = function (key) { + var entries = this.__entries__; + var index = getIndex(entries, key); + if (~index) { + entries.splice(index, 1); + } + }; + /** + * @param {*} key + * @returns {void} + */ + class_1.prototype.has = function (key) { + return !!~getIndex(this.__entries__, key); + }; + /** + * @returns {void} + */ + class_1.prototype.clear = function () { + this.__entries__.splice(0); + }; + /** + * @param {Function} callback + * @param {*} [ctx=null] + * @returns {void} + */ + class_1.prototype.forEach = function (callback, ctx) { + if (ctx === void 0) { ctx = null; } + for (var _i = 0, _a = this.__entries__; _i < _a.length; _i++) { + var entry = _a[_i]; + callback.call(ctx, entry[1], entry[0]); + } + }; + return class_1; + }()); })(); - /** - * Detects whether window and document objects are available in current environment. - */ + /** + * Detects whether window and document objects are available in current environment. + */ var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined' && window.document === document; - // Returns global object of a current environment. - var global$1 = (function () { - if (typeof global !== 'undefined' && global.Math === Math) { - return global; - } - if (typeof self !== 'undefined' && self.Math === Math) { - return self; - } - if (typeof window !== 'undefined' && window.Math === Math) { - return window; - } - // eslint-disable-next-line no-new-func - return Function('return this')(); + // Returns global object of a current environment. + var global$1 = (function () { + if (typeof global !== 'undefined' && global.Math === Math) { + return global; + } + if (typeof self !== 'undefined' && self.Math === Math) { + return self; + } + if (typeof window !== 'undefined' && window.Math === Math) { + return window; + } + // eslint-disable-next-line no-new-func + return Function('return this')(); })(); - /** - * A shim for the requestAnimationFrame which falls back to the setTimeout if - * first one is not supported. - * - * @returns {number} Requests' identifier. - */ - var requestAnimationFrame$1 = (function () { - if (typeof requestAnimationFrame === 'function') { - // It's required to use a bounded function because IE sometimes throws - // an "Invalid calling object" error if rAF is invoked without the global - // object on the left hand side. - return requestAnimationFrame.bind(global$1); - } - return function (callback) { return setTimeout(function () { return callback(Date.now()); }, 1000 / 60); }; + /** + * A shim for the requestAnimationFrame which falls back to the setTimeout if + * first one is not supported. + * + * @returns {number} Requests' identifier. + */ + var requestAnimationFrame$1 = (function () { + if (typeof requestAnimationFrame === 'function') { + // It's required to use a bounded function because IE sometimes throws + // an "Invalid calling object" error if rAF is invoked without the global + // object on the left hand side. + return requestAnimationFrame.bind(global$1); + } + return function (callback) { return setTimeout(function () { return callback(Date.now()); }, 1000 / 60); }; })(); - // Defines minimum timeout before adding a trailing call. - var trailingTimeout = 2; - /** - * Creates a wrapper function which ensures that provided callback will be - * invoked only once during the specified delay period. - * - * @param {Function} callback - Function to be invoked after the delay period. - * @param {number} delay - Delay after which to invoke callback. - * @returns {Function} - */ - function throttle (callback, delay) { - var leadingCall = false, trailingCall = false, lastCallTime = 0; - /** - * Invokes the original callback function and schedules new invocation if - * the "proxy" was called during current request. - * - * @returns {void} - */ - function resolvePending() { - if (leadingCall) { - leadingCall = false; - callback(); - } - if (trailingCall) { - proxy(); - } - } - /** - * Callback invoked after the specified delay. It will further postpone - * invocation of the original function delegating it to the - * requestAnimationFrame. - * - * @returns {void} - */ - function timeoutCallback() { - requestAnimationFrame$1(resolvePending); - } - /** - * Schedules invocation of the original function. - * - * @returns {void} - */ - function proxy() { - var timeStamp = Date.now(); - if (leadingCall) { - // Reject immediately following calls. - if (timeStamp - lastCallTime < trailingTimeout) { - return; - } - // Schedule new call to be in invoked when the pending one is resolved. - // This is important for "transitions" which never actually start - // immediately so there is a chance that we might miss one if change - // happens amids the pending invocation. - trailingCall = true; - } - else { - leadingCall = true; - trailingCall = false; - setTimeout(timeoutCallback, delay); - } - lastCallTime = timeStamp; - } - return proxy; + // Defines minimum timeout before adding a trailing call. + var trailingTimeout = 2; + /** + * Creates a wrapper function which ensures that provided callback will be + * invoked only once during the specified delay period. + * + * @param {Function} callback - Function to be invoked after the delay period. + * @param {number} delay - Delay after which to invoke callback. + * @returns {Function} + */ + function throttle (callback, delay) { + var leadingCall = false, trailingCall = false, lastCallTime = 0; + /** + * Invokes the original callback function and schedules new invocation if + * the "proxy" was called during current request. + * + * @returns {void} + */ + function resolvePending() { + if (leadingCall) { + leadingCall = false; + callback(); + } + if (trailingCall) { + proxy(); + } + } + /** + * Callback invoked after the specified delay. It will further postpone + * invocation of the original function delegating it to the + * requestAnimationFrame. + * + * @returns {void} + */ + function timeoutCallback() { + requestAnimationFrame$1(resolvePending); + } + /** + * Schedules invocation of the original function. + * + * @returns {void} + */ + function proxy() { + var timeStamp = Date.now(); + if (leadingCall) { + // Reject immediately following calls. + if (timeStamp - lastCallTime < trailingTimeout) { + return; + } + // Schedule new call to be in invoked when the pending one is resolved. + // This is important for "transitions" which never actually start + // immediately so there is a chance that we might miss one if change + // happens amids the pending invocation. + trailingCall = true; + } + else { + leadingCall = true; + trailingCall = false; + setTimeout(timeoutCallback, delay); + } + lastCallTime = timeStamp; + } + return proxy; } - // Minimum delay before invoking the update of observers. - var REFRESH_DELAY = 20; - // A list of substrings of CSS properties used to find transition events that - // might affect dimensions of observed elements. - var transitionKeys = ['top', 'right', 'bottom', 'left', 'width', 'height', 'size', 'weight']; - // Check if MutationObserver is available. - var mutationObserverSupported = typeof MutationObserver !== 'undefined'; - /** - * Singleton controller class which handles updates of ResizeObserver instances. - */ - var ResizeObserverController = /** @class */ (function () { - /** - * Creates a new instance of ResizeObserverController. - * - * @private - */ - function ResizeObserverController() { - /** - * Indicates whether DOM listeners have been added. - * - * @private {boolean} - */ - this.connected_ = false; - /** - * Tells that controller has subscribed for Mutation Events. - * - * @private {boolean} - */ - this.mutationEventsAdded_ = false; - /** - * Keeps reference to the instance of MutationObserver. - * - * @private {MutationObserver} - */ - this.mutationsObserver_ = null; - /** - * A list of connected observers. - * - * @private {Array} - */ - this.observers_ = []; - this.onTransitionEnd_ = this.onTransitionEnd_.bind(this); - this.refresh = throttle(this.refresh.bind(this), REFRESH_DELAY); - } - /** - * Adds observer to observers list. - * - * @param {ResizeObserverSPI} observer - Observer to be added. - * @returns {void} - */ - ResizeObserverController.prototype.addObserver = function (observer) { - if (!~this.observers_.indexOf(observer)) { - this.observers_.push(observer); - } - // Add listeners if they haven't been added yet. - if (!this.connected_) { - this.connect_(); - } - }; - /** - * Removes observer from observers list. - * - * @param {ResizeObserverSPI} observer - Observer to be removed. - * @returns {void} - */ - ResizeObserverController.prototype.removeObserver = function (observer) { - var observers = this.observers_; - var index = observers.indexOf(observer); - // Remove observer if it's present in registry. - if (~index) { - observers.splice(index, 1); - } - // Remove listeners if controller has no connected observers. - if (!observers.length && this.connected_) { - this.disconnect_(); - } - }; - /** - * Invokes the update of observers. It will continue running updates insofar - * it detects changes. - * - * @returns {void} - */ - ResizeObserverController.prototype.refresh = function () { - var changesDetected = this.updateObservers_(); - // Continue running updates if changes have been detected as there might - // be future ones caused by CSS transitions. - if (changesDetected) { - this.refresh(); - } - }; - /** - * Updates every observer from observers list and notifies them of queued - * entries. - * - * @private - * @returns {boolean} Returns "true" if any observer has detected changes in - * dimensions of it's elements. - */ - ResizeObserverController.prototype.updateObservers_ = function () { - // Collect observers that have active observations. - var activeObservers = this.observers_.filter(function (observer) { - return observer.gatherActive(), observer.hasActive(); - }); - // Deliver notifications in a separate cycle in order to avoid any - // collisions between observers, e.g. when multiple instances of - // ResizeObserver are tracking the same element and the callback of one - // of them changes content dimensions of the observed target. Sometimes - // this may result in notifications being blocked for the rest of observers. - activeObservers.forEach(function (observer) { return observer.broadcastActive(); }); - return activeObservers.length > 0; - }; - /** - * Initializes DOM listeners. - * - * @private - * @returns {void} - */ - ResizeObserverController.prototype.connect_ = function () { - // Do nothing if running in a non-browser environment or if listeners - // have been already added. - if (!isBrowser || this.connected_) { - return; - } - // Subscription to the "Transitionend" event is used as a workaround for - // delayed transitions. This way it's possible to capture at least the - // final state of an element. - document.addEventListener('transitionend', this.onTransitionEnd_); - window.addEventListener('resize', this.refresh); - if (mutationObserverSupported) { - this.mutationsObserver_ = new MutationObserver(this.refresh); - this.mutationsObserver_.observe(document, { - attributes: true, - childList: true, - characterData: true, - subtree: true - }); - } - else { - document.addEventListener('DOMSubtreeModified', this.refresh); - this.mutationEventsAdded_ = true; - } - this.connected_ = true; - }; - /** - * Removes DOM listeners. - * - * @private - * @returns {void} - */ - ResizeObserverController.prototype.disconnect_ = function () { - // Do nothing if running in a non-browser environment or if listeners - // have been already removed. - if (!isBrowser || !this.connected_) { - return; - } - document.removeEventListener('transitionend', this.onTransitionEnd_); - window.removeEventListener('resize', this.refresh); - if (this.mutationsObserver_) { - this.mutationsObserver_.disconnect(); - } - if (this.mutationEventsAdded_) { - document.removeEventListener('DOMSubtreeModified', this.refresh); - } - this.mutationsObserver_ = null; - this.mutationEventsAdded_ = false; - this.connected_ = false; - }; - /** - * "Transitionend" event handler. - * - * @private - * @param {TransitionEvent} event - * @returns {void} - */ - ResizeObserverController.prototype.onTransitionEnd_ = function (_a) { - var _b = _a.propertyName, propertyName = _b === void 0 ? '' : _b; - // Detect whether transition may affect dimensions of an element. - var isReflowProperty = transitionKeys.some(function (key) { - return !!~propertyName.indexOf(key); - }); - if (isReflowProperty) { - this.refresh(); - } - }; - /** - * Returns instance of the ResizeObserverController. - * - * @returns {ResizeObserverController} - */ - ResizeObserverController.getInstance = function () { - if (!this.instance_) { - this.instance_ = new ResizeObserverController(); - } - return this.instance_; - }; - /** - * Holds reference to the controller's instance. - * - * @private {ResizeObserverController} - */ - ResizeObserverController.instance_ = null; - return ResizeObserverController; + // Minimum delay before invoking the update of observers. + var REFRESH_DELAY = 20; + // A list of substrings of CSS properties used to find transition events that + // might affect dimensions of observed elements. + var transitionKeys = ['top', 'right', 'bottom', 'left', 'width', 'height', 'size', 'weight']; + // Check if MutationObserver is available. + var mutationObserverSupported = typeof MutationObserver !== 'undefined'; + /** + * Singleton controller class which handles updates of ResizeObserver instances. + */ + var ResizeObserverController = /** @class */ (function () { + /** + * Creates a new instance of ResizeObserverController. + * + * @private + */ + function ResizeObserverController() { + /** + * Indicates whether DOM listeners have been added. + * + * @private {boolean} + */ + this.connected_ = false; + /** + * Tells that controller has subscribed for Mutation Events. + * + * @private {boolean} + */ + this.mutationEventsAdded_ = false; + /** + * Keeps reference to the instance of MutationObserver. + * + * @private {MutationObserver} + */ + this.mutationsObserver_ = null; + /** + * A list of connected observers. + * + * @private {Array} + */ + this.observers_ = []; + this.onTransitionEnd_ = this.onTransitionEnd_.bind(this); + this.refresh = throttle(this.refresh.bind(this), REFRESH_DELAY); + } + /** + * Adds observer to observers list. + * + * @param {ResizeObserverSPI} observer - Observer to be added. + * @returns {void} + */ + ResizeObserverController.prototype.addObserver = function (observer) { + if (!~this.observers_.indexOf(observer)) { + this.observers_.push(observer); + } + // Add listeners if they haven't been added yet. + if (!this.connected_) { + this.connect_(); + } + }; + /** + * Removes observer from observers list. + * + * @param {ResizeObserverSPI} observer - Observer to be removed. + * @returns {void} + */ + ResizeObserverController.prototype.removeObserver = function (observer) { + var observers = this.observers_; + var index = observers.indexOf(observer); + // Remove observer if it's present in registry. + if (~index) { + observers.splice(index, 1); + } + // Remove listeners if controller has no connected observers. + if (!observers.length && this.connected_) { + this.disconnect_(); + } + }; + /** + * Invokes the update of observers. It will continue running updates insofar + * it detects changes. + * + * @returns {void} + */ + ResizeObserverController.prototype.refresh = function () { + var changesDetected = this.updateObservers_(); + // Continue running updates if changes have been detected as there might + // be future ones caused by CSS transitions. + if (changesDetected) { + this.refresh(); + } + }; + /** + * Updates every observer from observers list and notifies them of queued + * entries. + * + * @private + * @returns {boolean} Returns "true" if any observer has detected changes in + * dimensions of it's elements. + */ + ResizeObserverController.prototype.updateObservers_ = function () { + // Collect observers that have active observations. + var activeObservers = this.observers_.filter(function (observer) { + return observer.gatherActive(), observer.hasActive(); + }); + // Deliver notifications in a separate cycle in order to avoid any + // collisions between observers, e.g. when multiple instances of + // ResizeObserver are tracking the same element and the callback of one + // of them changes content dimensions of the observed target. Sometimes + // this may result in notifications being blocked for the rest of observers. + activeObservers.forEach(function (observer) { return observer.broadcastActive(); }); + return activeObservers.length > 0; + }; + /** + * Initializes DOM listeners. + * + * @private + * @returns {void} + */ + ResizeObserverController.prototype.connect_ = function () { + // Do nothing if running in a non-browser environment or if listeners + // have been already added. + if (!isBrowser || this.connected_) { + return; + } + // Subscription to the "Transitionend" event is used as a workaround for + // delayed transitions. This way it's possible to capture at least the + // final state of an element. + document.addEventListener('transitionend', this.onTransitionEnd_); + window.addEventListener('resize', this.refresh); + if (mutationObserverSupported) { + this.mutationsObserver_ = new MutationObserver(this.refresh); + this.mutationsObserver_.observe(document, { + attributes: true, + childList: true, + characterData: true, + subtree: true + }); + } + else { + document.addEventListener('DOMSubtreeModified', this.refresh); + this.mutationEventsAdded_ = true; + } + this.connected_ = true; + }; + /** + * Removes DOM listeners. + * + * @private + * @returns {void} + */ + ResizeObserverController.prototype.disconnect_ = function () { + // Do nothing if running in a non-browser environment or if listeners + // have been already removed. + if (!isBrowser || !this.connected_) { + return; + } + document.removeEventListener('transitionend', this.onTransitionEnd_); + window.removeEventListener('resize', this.refresh); + if (this.mutationsObserver_) { + this.mutationsObserver_.disconnect(); + } + if (this.mutationEventsAdded_) { + document.removeEventListener('DOMSubtreeModified', this.refresh); + } + this.mutationsObserver_ = null; + this.mutationEventsAdded_ = false; + this.connected_ = false; + }; + /** + * "Transitionend" event handler. + * + * @private + * @param {TransitionEvent} event + * @returns {void} + */ + ResizeObserverController.prototype.onTransitionEnd_ = function (_a) { + var _b = _a.propertyName, propertyName = _b === void 0 ? '' : _b; + // Detect whether transition may affect dimensions of an element. + var isReflowProperty = transitionKeys.some(function (key) { + return !!~propertyName.indexOf(key); + }); + if (isReflowProperty) { + this.refresh(); + } + }; + /** + * Returns instance of the ResizeObserverController. + * + * @returns {ResizeObserverController} + */ + ResizeObserverController.getInstance = function () { + if (!this.instance_) { + this.instance_ = new ResizeObserverController(); + } + return this.instance_; + }; + /** + * Holds reference to the controller's instance. + * + * @private {ResizeObserverController} + */ + ResizeObserverController.instance_ = null; + return ResizeObserverController; }()); - /** - * Defines non-writable/enumerable properties of the provided target object. - * - * @param {Object} target - Object for which to define properties. - * @param {Object} props - Properties to be defined. - * @returns {Object} Target object. - */ - var defineConfigurable = (function (target, props) { - for (var _i = 0, _a = Object.keys(props); _i < _a.length; _i++) { - var key = _a[_i]; - Object.defineProperty(target, key, { - value: props[key], - enumerable: false, - writable: false, - configurable: true - }); - } - return target; + /** + * Defines non-writable/enumerable properties of the provided target object. + * + * @param {Object} target - Object for which to define properties. + * @param {Object} props - Properties to be defined. + * @returns {Object} Target object. + */ + var defineConfigurable = (function (target, props) { + for (var _i = 0, _a = Object.keys(props); _i < _a.length; _i++) { + var key = _a[_i]; + Object.defineProperty(target, key, { + value: props[key], + enumerable: false, + writable: false, + configurable: true + }); + } + return target; }); - /** - * Returns the global object associated with provided element. - * - * @param {Object} target - * @returns {Object} - */ - var getWindowOf = (function (target) { - // Assume that the element is an instance of Node, which means that it - // has the "ownerDocument" property from which we can retrieve a - // corresponding global object. - var ownerGlobal = target && target.ownerDocument && target.ownerDocument.defaultView; - // Return the local global object if it's not possible extract one from - // provided element. - return ownerGlobal || global$1; + /** + * Returns the global object associated with provided element. + * + * @param {Object} target + * @returns {Object} + */ + var getWindowOf = (function (target) { + // Assume that the element is an instance of Node, which means that it + // has the "ownerDocument" property from which we can retrieve a + // corresponding global object. + var ownerGlobal = target && target.ownerDocument && target.ownerDocument.defaultView; + // Return the local global object if it's not possible extract one from + // provided element. + return ownerGlobal || global$1; }); - // Placeholder of an empty content rectangle. - var emptyRect = createRectInit(0, 0, 0, 0); - /** - * Converts provided string to a number. - * - * @param {number|string} value - * @returns {number} - */ - function toFloat(value) { - return parseFloat(value) || 0; - } - /** - * Extracts borders size from provided styles. - * - * @param {CSSStyleDeclaration} styles - * @param {...string} positions - Borders positions (top, right, ...) - * @returns {number} - */ - function getBordersSize(styles) { - var positions = []; - for (var _i = 1; _i < arguments.length; _i++) { - positions[_i - 1] = arguments[_i]; - } - return positions.reduce(function (size, position) { - var value = styles['border-' + position + '-width']; - return size + toFloat(value); - }, 0); - } - /** - * Extracts paddings sizes from provided styles. - * - * @param {CSSStyleDeclaration} styles - * @returns {Object} Paddings box. - */ - function getPaddings(styles) { - var positions = ['top', 'right', 'bottom', 'left']; - var paddings = {}; - for (var _i = 0, positions_1 = positions; _i < positions_1.length; _i++) { - var position = positions_1[_i]; - var value = styles['padding-' + position]; - paddings[position] = toFloat(value); - } - return paddings; - } - /** - * Calculates content rectangle of provided SVG element. - * - * @param {SVGGraphicsElement} target - Element content rectangle of which needs - * to be calculated. - * @returns {DOMRectInit} - */ - function getSVGContentRect(target) { - var bbox = target.getBBox(); - return createRectInit(0, 0, bbox.width, bbox.height); - } - /** - * Calculates content rectangle of provided HTMLElement. - * - * @param {HTMLElement} target - Element for which to calculate the content rectangle. - * @returns {DOMRectInit} - */ - function getHTMLElementContentRect(target) { - // Client width & height properties can't be - // used exclusively as they provide rounded values. - var clientWidth = target.clientWidth, clientHeight = target.clientHeight; - // By this condition we can catch all non-replaced inline, hidden and - // detached elements. Though elements with width & height properties less - // than 0.5 will be discarded as well. - // - // Without it we would need to implement separate methods for each of - // those cases and it's not possible to perform a precise and performance - // effective test for hidden elements. E.g. even jQuery's ':visible' filter - // gives wrong results for elements with width & height less than 0.5. - if (!clientWidth && !clientHeight) { - return emptyRect; - } - var styles = getWindowOf(target).getComputedStyle(target); - var paddings = getPaddings(styles); - var horizPad = paddings.left + paddings.right; - var vertPad = paddings.top + paddings.bottom; - // Computed styles of width & height are being used because they are the - // only dimensions available to JS that contain non-rounded values. It could - // be possible to utilize the getBoundingClientRect if only it's data wasn't - // affected by CSS transformations let alone paddings, borders and scroll bars. - var width = toFloat(styles.width), height = toFloat(styles.height); - // Width & height include paddings and borders when the 'border-box' box - // model is applied (except for IE). - if (styles.boxSizing === 'border-box') { - // Following conditions are required to handle Internet Explorer which - // doesn't include paddings and borders to computed CSS dimensions. - // - // We can say that if CSS dimensions + paddings are equal to the "client" - // properties then it's either IE, and thus we don't need to subtract - // anything, or an element merely doesn't have paddings/borders styles. - if (Math.round(width + horizPad) !== clientWidth) { - width -= getBordersSize(styles, 'left', 'right') + horizPad; - } - if (Math.round(height + vertPad) !== clientHeight) { - height -= getBordersSize(styles, 'top', 'bottom') + vertPad; - } - } - // Following steps can't be applied to the document's root element as its - // client[Width/Height] properties represent viewport area of the window. - // Besides, it's as well not necessary as the itself neither has - // rendered scroll bars nor it can be clipped. - if (!isDocumentElement(target)) { - // In some browsers (only in Firefox, actually) CSS width & height - // include scroll bars size which can be removed at this step as scroll - // bars are the only difference between rounded dimensions + paddings - // and "client" properties, though that is not always true in Chrome. - var vertScrollbar = Math.round(width + horizPad) - clientWidth; - var horizScrollbar = Math.round(height + vertPad) - clientHeight; - // Chrome has a rather weird rounding of "client" properties. - // E.g. for an element with content width of 314.2px it sometimes gives - // the client width of 315px and for the width of 314.7px it may give - // 314px. And it doesn't happen all the time. So just ignore this delta - // as a non-relevant. - if (Math.abs(vertScrollbar) !== 1) { - width -= vertScrollbar; - } - if (Math.abs(horizScrollbar) !== 1) { - height -= horizScrollbar; - } - } - return createRectInit(paddings.left, paddings.top, width, height); - } - /** - * Checks whether provided element is an instance of the SVGGraphicsElement. - * - * @param {Element} target - Element to be checked. - * @returns {boolean} - */ - var isSVGGraphicsElement = (function () { - // Some browsers, namely IE and Edge, don't have the SVGGraphicsElement - // interface. - if (typeof SVGGraphicsElement !== 'undefined') { - return function (target) { return target instanceof getWindowOf(target).SVGGraphicsElement; }; - } - // If it's so, then check that element is at least an instance of the - // SVGElement and that it has the "getBBox" method. - // eslint-disable-next-line no-extra-parens - return function (target) { return (target instanceof getWindowOf(target).SVGElement && - typeof target.getBBox === 'function'); }; - })(); - /** - * Checks whether provided element is a document element (). - * - * @param {Element} target - Element to be checked. - * @returns {boolean} - */ - function isDocumentElement(target) { - return target === getWindowOf(target).document.documentElement; - } - /** - * Calculates an appropriate content rectangle for provided html or svg element. - * - * @param {Element} target - Element content rectangle of which needs to be calculated. - * @returns {DOMRectInit} - */ - function getContentRect(target) { - if (!isBrowser) { - return emptyRect; - } - if (isSVGGraphicsElement(target)) { - return getSVGContentRect(target); - } - return getHTMLElementContentRect(target); - } - /** - * Creates rectangle with an interface of the DOMRectReadOnly. - * Spec: https://drafts.fxtf.org/geometry/#domrectreadonly - * - * @param {DOMRectInit} rectInit - Object with rectangle's x/y coordinates and dimensions. - * @returns {DOMRectReadOnly} - */ - function createReadOnlyRect(_a) { - var x = _a.x, y = _a.y, width = _a.width, height = _a.height; - // If DOMRectReadOnly is available use it as a prototype for the rectangle. - var Constr = typeof DOMRectReadOnly !== 'undefined' ? DOMRectReadOnly : Object; - var rect = Object.create(Constr.prototype); - // Rectangle's properties are not writable and non-enumerable. - defineConfigurable(rect, { - x: x, y: y, width: width, height: height, - top: y, - right: x + width, - bottom: height + y, - left: x - }); - return rect; - } - /** - * Creates DOMRectInit object based on the provided dimensions and the x/y coordinates. - * Spec: https://drafts.fxtf.org/geometry/#dictdef-domrectinit - * - * @param {number} x - X coordinate. - * @param {number} y - Y coordinate. - * @param {number} width - Rectangle's width. - * @param {number} height - Rectangle's height. - * @returns {DOMRectInit} - */ - function createRectInit(x, y, width, height) { - return { x: x, y: y, width: width, height: height }; + // Placeholder of an empty content rectangle. + var emptyRect = createRectInit(0, 0, 0, 0); + /** + * Converts provided string to a number. + * + * @param {number|string} value + * @returns {number} + */ + function toFloat(value) { + return parseFloat(value) || 0; + } + /** + * Extracts borders size from provided styles. + * + * @param {CSSStyleDeclaration} styles + * @param {...string} positions - Borders positions (top, right, ...) + * @returns {number} + */ + function getBordersSize(styles) { + var positions = []; + for (var _i = 1; _i < arguments.length; _i++) { + positions[_i - 1] = arguments[_i]; + } + return positions.reduce(function (size, position) { + var value = styles['border-' + position + '-width']; + return size + toFloat(value); + }, 0); + } + /** + * Extracts paddings sizes from provided styles. + * + * @param {CSSStyleDeclaration} styles + * @returns {Object} Paddings box. + */ + function getPaddings(styles) { + var positions = ['top', 'right', 'bottom', 'left']; + var paddings = {}; + for (var _i = 0, positions_1 = positions; _i < positions_1.length; _i++) { + var position = positions_1[_i]; + var value = styles['padding-' + position]; + paddings[position] = toFloat(value); + } + return paddings; + } + /** + * Calculates content rectangle of provided SVG element. + * + * @param {SVGGraphicsElement} target - Element content rectangle of which needs + * to be calculated. + * @returns {DOMRectInit} + */ + function getSVGContentRect(target) { + var bbox = target.getBBox(); + return createRectInit(0, 0, bbox.width, bbox.height); + } + /** + * Calculates content rectangle of provided HTMLElement. + * + * @param {HTMLElement} target - Element for which to calculate the content rectangle. + * @returns {DOMRectInit} + */ + function getHTMLElementContentRect(target) { + // Client width & height properties can't be + // used exclusively as they provide rounded values. + var clientWidth = target.clientWidth, clientHeight = target.clientHeight; + // By this condition we can catch all non-replaced inline, hidden and + // detached elements. Though elements with width & height properties less + // than 0.5 will be discarded as well. + // + // Without it we would need to implement separate methods for each of + // those cases and it's not possible to perform a precise and performance + // effective test for hidden elements. E.g. even jQuery's ':visible' filter + // gives wrong results for elements with width & height less than 0.5. + if (!clientWidth && !clientHeight) { + return emptyRect; + } + var styles = getWindowOf(target).getComputedStyle(target); + var paddings = getPaddings(styles); + var horizPad = paddings.left + paddings.right; + var vertPad = paddings.top + paddings.bottom; + // Computed styles of width & height are being used because they are the + // only dimensions available to JS that contain non-rounded values. It could + // be possible to utilize the getBoundingClientRect if only it's data wasn't + // affected by CSS transformations let alone paddings, borders and scroll bars. + var width = toFloat(styles.width), height = toFloat(styles.height); + // Width & height include paddings and borders when the 'border-box' box + // model is applied (except for IE). + if (styles.boxSizing === 'border-box') { + // Following conditions are required to handle Internet Explorer which + // doesn't include paddings and borders to computed CSS dimensions. + // + // We can say that if CSS dimensions + paddings are equal to the "client" + // properties then it's either IE, and thus we don't need to subtract + // anything, or an element merely doesn't have paddings/borders styles. + if (Math.round(width + horizPad) !== clientWidth) { + width -= getBordersSize(styles, 'left', 'right') + horizPad; + } + if (Math.round(height + vertPad) !== clientHeight) { + height -= getBordersSize(styles, 'top', 'bottom') + vertPad; + } + } + // Following steps can't be applied to the document's root element as its + // client[Width/Height] properties represent viewport area of the window. + // Besides, it's as well not necessary as the itself neither has + // rendered scroll bars nor it can be clipped. + if (!isDocumentElement(target)) { + // In some browsers (only in Firefox, actually) CSS width & height + // include scroll bars size which can be removed at this step as scroll + // bars are the only difference between rounded dimensions + paddings + // and "client" properties, though that is not always true in Chrome. + var vertScrollbar = Math.round(width + horizPad) - clientWidth; + var horizScrollbar = Math.round(height + vertPad) - clientHeight; + // Chrome has a rather weird rounding of "client" properties. + // E.g. for an element with content width of 314.2px it sometimes gives + // the client width of 315px and for the width of 314.7px it may give + // 314px. And it doesn't happen all the time. So just ignore this delta + // as a non-relevant. + if (Math.abs(vertScrollbar) !== 1) { + width -= vertScrollbar; + } + if (Math.abs(horizScrollbar) !== 1) { + height -= horizScrollbar; + } + } + return createRectInit(paddings.left, paddings.top, width, height); + } + /** + * Checks whether provided element is an instance of the SVGGraphicsElement. + * + * @param {Element} target - Element to be checked. + * @returns {boolean} + */ + var isSVGGraphicsElement = (function () { + // Some browsers, namely IE and Edge, don't have the SVGGraphicsElement + // interface. + if (typeof SVGGraphicsElement !== 'undefined') { + return function (target) { return target instanceof getWindowOf(target).SVGGraphicsElement; }; + } + // If it's so, then check that element is at least an instance of the + // SVGElement and that it has the "getBBox" method. + // eslint-disable-next-line no-extra-parens + return function (target) { return (target instanceof getWindowOf(target).SVGElement && + typeof target.getBBox === 'function'); }; + })(); + /** + * Checks whether provided element is a document element (). + * + * @param {Element} target - Element to be checked. + * @returns {boolean} + */ + function isDocumentElement(target) { + return target === getWindowOf(target).document.documentElement; + } + /** + * Calculates an appropriate content rectangle for provided html or svg element. + * + * @param {Element} target - Element content rectangle of which needs to be calculated. + * @returns {DOMRectInit} + */ + function getContentRect(target) { + if (!isBrowser) { + return emptyRect; + } + if (isSVGGraphicsElement(target)) { + return getSVGContentRect(target); + } + return getHTMLElementContentRect(target); + } + /** + * Creates rectangle with an interface of the DOMRectReadOnly. + * Spec: https://drafts.fxtf.org/geometry/#domrectreadonly + * + * @param {DOMRectInit} rectInit - Object with rectangle's x/y coordinates and dimensions. + * @returns {DOMRectReadOnly} + */ + function createReadOnlyRect(_a) { + var x = _a.x, y = _a.y, width = _a.width, height = _a.height; + // If DOMRectReadOnly is available use it as a prototype for the rectangle. + var Constr = typeof DOMRectReadOnly !== 'undefined' ? DOMRectReadOnly : Object; + var rect = Object.create(Constr.prototype); + // Rectangle's properties are not writable and non-enumerable. + defineConfigurable(rect, { + x: x, y: y, width: width, height: height, + top: y, + right: x + width, + bottom: height + y, + left: x + }); + return rect; + } + /** + * Creates DOMRectInit object based on the provided dimensions and the x/y coordinates. + * Spec: https://drafts.fxtf.org/geometry/#dictdef-domrectinit + * + * @param {number} x - X coordinate. + * @param {number} y - Y coordinate. + * @param {number} width - Rectangle's width. + * @param {number} height - Rectangle's height. + * @returns {DOMRectInit} + */ + function createRectInit(x, y, width, height) { + return { x: x, y: y, width: width, height: height }; } - /** - * Class that is responsible for computations of the content rectangle of - * provided DOM element and for keeping track of it's changes. - */ - var ResizeObservation = /** @class */ (function () { - /** - * Creates an instance of ResizeObservation. - * - * @param {Element} target - Element to be observed. - */ - function ResizeObservation(target) { - /** - * Broadcasted width of content rectangle. - * - * @type {number} - */ - this.broadcastWidth = 0; - /** - * Broadcasted height of content rectangle. - * - * @type {number} - */ - this.broadcastHeight = 0; - /** - * Reference to the last observed content rectangle. - * - * @private {DOMRectInit} - */ - this.contentRect_ = createRectInit(0, 0, 0, 0); - this.target = target; - } - /** - * Updates content rectangle and tells whether it's width or height properties - * have changed since the last broadcast. - * - * @returns {boolean} - */ - ResizeObservation.prototype.isActive = function () { - var rect = getContentRect(this.target); - this.contentRect_ = rect; - return (rect.width !== this.broadcastWidth || - rect.height !== this.broadcastHeight); - }; - /** - * Updates 'broadcastWidth' and 'broadcastHeight' properties with a data - * from the corresponding properties of the last observed content rectangle. - * - * @returns {DOMRectInit} Last observed content rectangle. - */ - ResizeObservation.prototype.broadcastRect = function () { - var rect = this.contentRect_; - this.broadcastWidth = rect.width; - this.broadcastHeight = rect.height; - return rect; - }; - return ResizeObservation; + /** + * Class that is responsible for computations of the content rectangle of + * provided DOM element and for keeping track of it's changes. + */ + var ResizeObservation = /** @class */ (function () { + /** + * Creates an instance of ResizeObservation. + * + * @param {Element} target - Element to be observed. + */ + function ResizeObservation(target) { + /** + * Broadcasted width of content rectangle. + * + * @type {number} + */ + this.broadcastWidth = 0; + /** + * Broadcasted height of content rectangle. + * + * @type {number} + */ + this.broadcastHeight = 0; + /** + * Reference to the last observed content rectangle. + * + * @private {DOMRectInit} + */ + this.contentRect_ = createRectInit(0, 0, 0, 0); + this.target = target; + } + /** + * Updates content rectangle and tells whether it's width or height properties + * have changed since the last broadcast. + * + * @returns {boolean} + */ + ResizeObservation.prototype.isActive = function () { + var rect = getContentRect(this.target); + this.contentRect_ = rect; + return (rect.width !== this.broadcastWidth || + rect.height !== this.broadcastHeight); + }; + /** + * Updates 'broadcastWidth' and 'broadcastHeight' properties with a data + * from the corresponding properties of the last observed content rectangle. + * + * @returns {DOMRectInit} Last observed content rectangle. + */ + ResizeObservation.prototype.broadcastRect = function () { + var rect = this.contentRect_; + this.broadcastWidth = rect.width; + this.broadcastHeight = rect.height; + return rect; + }; + return ResizeObservation; }()); - var ResizeObserverEntry = /** @class */ (function () { - /** - * Creates an instance of ResizeObserverEntry. - * - * @param {Element} target - Element that is being observed. - * @param {DOMRectInit} rectInit - Data of the element's content rectangle. - */ - function ResizeObserverEntry(target, rectInit) { - var contentRect = createReadOnlyRect(rectInit); - // According to the specification following properties are not writable - // and are also not enumerable in the native implementation. - // - // Property accessors are not being used as they'd require to define a - // private WeakMap storage which may cause memory leaks in browsers that - // don't support this type of collections. - defineConfigurable(this, { target: target, contentRect: contentRect }); - } - return ResizeObserverEntry; + var ResizeObserverEntry = /** @class */ (function () { + /** + * Creates an instance of ResizeObserverEntry. + * + * @param {Element} target - Element that is being observed. + * @param {DOMRectInit} rectInit - Data of the element's content rectangle. + */ + function ResizeObserverEntry(target, rectInit) { + var contentRect = createReadOnlyRect(rectInit); + // According to the specification following properties are not writable + // and are also not enumerable in the native implementation. + // + // Property accessors are not being used as they'd require to define a + // private WeakMap storage which may cause memory leaks in browsers that + // don't support this type of collections. + defineConfigurable(this, { target: target, contentRect: contentRect }); + } + return ResizeObserverEntry; }()); - var ResizeObserverSPI = /** @class */ (function () { - /** - * Creates a new instance of ResizeObserver. - * - * @param {ResizeObserverCallback} callback - Callback function that is invoked - * when one of the observed elements changes it's content dimensions. - * @param {ResizeObserverController} controller - Controller instance which - * is responsible for the updates of observer. - * @param {ResizeObserver} callbackCtx - Reference to the public - * ResizeObserver instance which will be passed to callback function. - */ - function ResizeObserverSPI(callback, controller, callbackCtx) { - /** - * Collection of resize observations that have detected changes in dimensions - * of elements. - * - * @private {Array} - */ - this.activeObservations_ = []; - /** - * Registry of the ResizeObservation instances. - * - * @private {Map} - */ - this.observations_ = new MapShim(); - if (typeof callback !== 'function') { - throw new TypeError('The callback provided as parameter 1 is not a function.'); - } - this.callback_ = callback; - this.controller_ = controller; - this.callbackCtx_ = callbackCtx; - } - /** - * Starts observing provided element. - * - * @param {Element} target - Element to be observed. - * @returns {void} - */ - ResizeObserverSPI.prototype.observe = function (target) { - if (!arguments.length) { - throw new TypeError('1 argument required, but only 0 present.'); - } - // Do nothing if current environment doesn't have the Element interface. - if (typeof Element === 'undefined' || !(Element instanceof Object)) { - return; - } - if (!(target instanceof getWindowOf(target).Element)) { - throw new TypeError('parameter 1 is not of type "Element".'); - } - var observations = this.observations_; - // Do nothing if element is already being observed. - if (observations.has(target)) { - return; - } - observations.set(target, new ResizeObservation(target)); - this.controller_.addObserver(this); - // Force the update of observations. - this.controller_.refresh(); - }; - /** - * Stops observing provided element. - * - * @param {Element} target - Element to stop observing. - * @returns {void} - */ - ResizeObserverSPI.prototype.unobserve = function (target) { - if (!arguments.length) { - throw new TypeError('1 argument required, but only 0 present.'); - } - // Do nothing if current environment doesn't have the Element interface. - if (typeof Element === 'undefined' || !(Element instanceof Object)) { - return; - } - if (!(target instanceof getWindowOf(target).Element)) { - throw new TypeError('parameter 1 is not of type "Element".'); - } - var observations = this.observations_; - // Do nothing if element is not being observed. - if (!observations.has(target)) { - return; - } - observations.delete(target); - if (!observations.size) { - this.controller_.removeObserver(this); - } - }; - /** - * Stops observing all elements. - * - * @returns {void} - */ - ResizeObserverSPI.prototype.disconnect = function () { - this.clearActive(); - this.observations_.clear(); - this.controller_.removeObserver(this); - }; - /** - * Collects observation instances the associated element of which has changed - * it's content rectangle. - * - * @returns {void} - */ - ResizeObserverSPI.prototype.gatherActive = function () { - var _this = this; - this.clearActive(); - this.observations_.forEach(function (observation) { - if (observation.isActive()) { - _this.activeObservations_.push(observation); - } - }); - }; - /** - * Invokes initial callback function with a list of ResizeObserverEntry - * instances collected from active resize observations. - * - * @returns {void} - */ - ResizeObserverSPI.prototype.broadcastActive = function () { - // Do nothing if observer doesn't have active observations. - if (!this.hasActive()) { - return; - } - var ctx = this.callbackCtx_; - // Create ResizeObserverEntry instance for every active observation. - var entries = this.activeObservations_.map(function (observation) { - return new ResizeObserverEntry(observation.target, observation.broadcastRect()); - }); - this.callback_.call(ctx, entries, ctx); - this.clearActive(); - }; - /** - * Clears the collection of active observations. - * - * @returns {void} - */ - ResizeObserverSPI.prototype.clearActive = function () { - this.activeObservations_.splice(0); - }; - /** - * Tells whether observer has active observations. - * - * @returns {boolean} - */ - ResizeObserverSPI.prototype.hasActive = function () { - return this.activeObservations_.length > 0; - }; - return ResizeObserverSPI; + var ResizeObserverSPI = /** @class */ (function () { + /** + * Creates a new instance of ResizeObserver. + * + * @param {ResizeObserverCallback} callback - Callback function that is invoked + * when one of the observed elements changes it's content dimensions. + * @param {ResizeObserverController} controller - Controller instance which + * is responsible for the updates of observer. + * @param {ResizeObserver} callbackCtx - Reference to the public + * ResizeObserver instance which will be passed to callback function. + */ + function ResizeObserverSPI(callback, controller, callbackCtx) { + /** + * Collection of resize observations that have detected changes in dimensions + * of elements. + * + * @private {Array} + */ + this.activeObservations_ = []; + /** + * Registry of the ResizeObservation instances. + * + * @private {Map} + */ + this.observations_ = new MapShim(); + if (typeof callback !== 'function') { + throw new TypeError('The callback provided as parameter 1 is not a function.'); + } + this.callback_ = callback; + this.controller_ = controller; + this.callbackCtx_ = callbackCtx; + } + /** + * Starts observing provided element. + * + * @param {Element} target - Element to be observed. + * @returns {void} + */ + ResizeObserverSPI.prototype.observe = function (target) { + if (!arguments.length) { + throw new TypeError('1 argument required, but only 0 present.'); + } + // Do nothing if current environment doesn't have the Element interface. + if (typeof Element === 'undefined' || !(Element instanceof Object)) { + return; + } + if (!(target instanceof getWindowOf(target).Element)) { + throw new TypeError('parameter 1 is not of type "Element".'); + } + var observations = this.observations_; + // Do nothing if element is already being observed. + if (observations.has(target)) { + return; + } + observations.set(target, new ResizeObservation(target)); + this.controller_.addObserver(this); + // Force the update of observations. + this.controller_.refresh(); + }; + /** + * Stops observing provided element. + * + * @param {Element} target - Element to stop observing. + * @returns {void} + */ + ResizeObserverSPI.prototype.unobserve = function (target) { + if (!arguments.length) { + throw new TypeError('1 argument required, but only 0 present.'); + } + // Do nothing if current environment doesn't have the Element interface. + if (typeof Element === 'undefined' || !(Element instanceof Object)) { + return; + } + if (!(target instanceof getWindowOf(target).Element)) { + throw new TypeError('parameter 1 is not of type "Element".'); + } + var observations = this.observations_; + // Do nothing if element is not being observed. + if (!observations.has(target)) { + return; + } + observations.delete(target); + if (!observations.size) { + this.controller_.removeObserver(this); + } + }; + /** + * Stops observing all elements. + * + * @returns {void} + */ + ResizeObserverSPI.prototype.disconnect = function () { + this.clearActive(); + this.observations_.clear(); + this.controller_.removeObserver(this); + }; + /** + * Collects observation instances the associated element of which has changed + * it's content rectangle. + * + * @returns {void} + */ + ResizeObserverSPI.prototype.gatherActive = function () { + var _this = this; + this.clearActive(); + this.observations_.forEach(function (observation) { + if (observation.isActive()) { + _this.activeObservations_.push(observation); + } + }); + }; + /** + * Invokes initial callback function with a list of ResizeObserverEntry + * instances collected from active resize observations. + * + * @returns {void} + */ + ResizeObserverSPI.prototype.broadcastActive = function () { + // Do nothing if observer doesn't have active observations. + if (!this.hasActive()) { + return; + } + var ctx = this.callbackCtx_; + // Create ResizeObserverEntry instance for every active observation. + var entries = this.activeObservations_.map(function (observation) { + return new ResizeObserverEntry(observation.target, observation.broadcastRect()); + }); + this.callback_.call(ctx, entries, ctx); + this.clearActive(); + }; + /** + * Clears the collection of active observations. + * + * @returns {void} + */ + ResizeObserverSPI.prototype.clearActive = function () { + this.activeObservations_.splice(0); + }; + /** + * Tells whether observer has active observations. + * + * @returns {boolean} + */ + ResizeObserverSPI.prototype.hasActive = function () { + return this.activeObservations_.length > 0; + }; + return ResizeObserverSPI; }()); - // Registry of internal observers. If WeakMap is not available use current shim - // for the Map collection as it has all required methods and because WeakMap - // can't be fully polyfilled anyway. - var observers = typeof WeakMap !== 'undefined' ? new WeakMap() : new MapShim(); - /** - * ResizeObserver API. Encapsulates the ResizeObserver SPI implementation - * exposing only those methods and properties that are defined in the spec. - */ - var ResizeObserver = /** @class */ (function () { - /** - * Creates a new instance of ResizeObserver. - * - * @param {ResizeObserverCallback} callback - Callback that is invoked when - * dimensions of the observed elements change. - */ - function ResizeObserver(callback) { - if (!(this instanceof ResizeObserver)) { - throw new TypeError('Cannot call a class as a function.'); - } - if (!arguments.length) { - throw new TypeError('1 argument required, but only 0 present.'); - } - var controller = ResizeObserverController.getInstance(); - var observer = new ResizeObserverSPI(callback, controller, this); - observers.set(this, observer); - } - return ResizeObserver; - }()); - // Expose public methods of ResizeObserver. - [ - 'observe', - 'unobserve', - 'disconnect' - ].forEach(function (method) { - ResizeObserver.prototype[method] = function () { - var _a; - return (_a = observers.get(this))[method].apply(_a, arguments); - }; + // Registry of internal observers. If WeakMap is not available use current shim + // for the Map collection as it has all required methods and because WeakMap + // can't be fully polyfilled anyway. + var observers = typeof WeakMap !== 'undefined' ? new WeakMap() : new MapShim(); + /** + * ResizeObserver API. Encapsulates the ResizeObserver SPI implementation + * exposing only those methods and properties that are defined in the spec. + */ + var ResizeObserver = /** @class */ (function () { + /** + * Creates a new instance of ResizeObserver. + * + * @param {ResizeObserverCallback} callback - Callback that is invoked when + * dimensions of the observed elements change. + */ + function ResizeObserver(callback) { + if (!(this instanceof ResizeObserver)) { + throw new TypeError('Cannot call a class as a function.'); + } + if (!arguments.length) { + throw new TypeError('1 argument required, but only 0 present.'); + } + var controller = ResizeObserverController.getInstance(); + var observer = new ResizeObserverSPI(callback, controller, this); + observers.set(this, observer); + } + return ResizeObserver; + }()); + // Expose public methods of ResizeObserver. + [ + 'observe', + 'unobserve', + 'disconnect' + ].forEach(function (method) { + ResizeObserver.prototype[method] = function () { + var _a; + return (_a = observers.get(this))[method].apply(_a, arguments); + }; }); - var index = (function () { - // Export existing implementation if available. - if (typeof global$1.ResizeObserver !== 'undefined') { - return global$1.ResizeObserver; - } - return ResizeObserver; + var index = (function () { + // Export existing implementation if available. + if (typeof global$1.ResizeObserver !== 'undefined') { + return global$1.ResizeObserver; + } + return ResizeObserver; })(); return index; diff --git a/docs/public/assets/images/favicon.png b/docs/assets/images/favicon.png similarity index 100% rename from docs/public/assets/images/favicon.png rename to docs/assets/images/favicon.png diff --git a/docs/assets/javascripts/bundle.d7e51e09.min.js b/docs/assets/javascripts/bundle.d7e51e09.min.js new file mode 100644 index 000000000..1a6056fb8 --- /dev/null +++ b/docs/assets/javascripts/bundle.d7e51e09.min.js @@ -0,0 +1,3 @@ +"use strict";(()=>{var _i=Object.create;var Or=Object.defineProperty;var Ai=Object.getOwnPropertyDescriptor;var Ci=Object.getOwnPropertyNames,zt=Object.getOwnPropertySymbols,ki=Object.getPrototypeOf,Mr=Object.prototype.hasOwnProperty,so=Object.prototype.propertyIsEnumerable;var ao=(e,t,r)=>t in e?Or(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,W=(e,t)=>{for(var r in t||(t={}))Mr.call(t,r)&&ao(e,r,t[r]);if(zt)for(var r of zt(t))so.call(t,r)&&ao(e,r,t[r]);return e};var co=(e,t)=>{var r={};for(var o in e)Mr.call(e,o)&&t.indexOf(o)<0&&(r[o]=e[o]);if(e!=null&&zt)for(var o of zt(e))t.indexOf(o)<0&&so.call(e,o)&&(r[o]=e[o]);return r};var Lr=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Hi=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Ci(t))!Mr.call(e,n)&&n!==r&&Or(e,n,{get:()=>t[n],enumerable:!(o=Ai(t,n))||o.enumerable});return e};var qt=(e,t,r)=>(r=e!=null?_i(ki(e)):{},Hi(t||!e||!e.__esModule?Or(r,"default",{value:e,enumerable:!0}):r,e));var lo=Lr((_r,po)=>{(function(e,t){typeof _r=="object"&&typeof po!="undefined"?t():typeof define=="function"&&define.amd?define(t):t()})(_r,function(){"use strict";function e(r){var o=!0,n=!1,i=null,a={text:!0,search:!0,url:!0,tel:!0,email:!0,password:!0,number:!0,date:!0,month:!0,week:!0,time:!0,datetime:!0,"datetime-local":!0};function s(C){return!!(C&&C!==document&&C.nodeName!=="HTML"&&C.nodeName!=="BODY"&&"classList"in C&&"contains"in C.classList)}function p(C){var et=C.type,H=C.tagName;return!!(H==="INPUT"&&a[et]&&!C.readOnly||H==="TEXTAREA"&&!C.readOnly||C.isContentEditable)}function c(C){C.classList.contains("focus-visible")||(C.classList.add("focus-visible"),C.setAttribute("data-focus-visible-added",""))}function l(C){C.hasAttribute("data-focus-visible-added")&&(C.classList.remove("focus-visible"),C.removeAttribute("data-focus-visible-added"))}function f(C){C.metaKey||C.altKey||C.ctrlKey||(s(r.activeElement)&&c(r.activeElement),o=!0)}function u(C){o=!1}function d(C){s(C.target)&&(o||p(C.target))&&c(C.target)}function b(C){s(C.target)&&(C.target.classList.contains("focus-visible")||C.target.hasAttribute("data-focus-visible-added"))&&(n=!0,window.clearTimeout(i),i=window.setTimeout(function(){n=!1},100),l(C.target))}function M(C){document.visibilityState==="hidden"&&(n&&(o=!0),ee())}function ee(){document.addEventListener("mousemove",B),document.addEventListener("mousedown",B),document.addEventListener("mouseup",B),document.addEventListener("pointermove",B),document.addEventListener("pointerdown",B),document.addEventListener("pointerup",B),document.addEventListener("touchmove",B),document.addEventListener("touchstart",B),document.addEventListener("touchend",B)}function re(){document.removeEventListener("mousemove",B),document.removeEventListener("mousedown",B),document.removeEventListener("mouseup",B),document.removeEventListener("pointermove",B),document.removeEventListener("pointerdown",B),document.removeEventListener("pointerup",B),document.removeEventListener("touchmove",B),document.removeEventListener("touchstart",B),document.removeEventListener("touchend",B)}function B(C){C.target.nodeName&&C.target.nodeName.toLowerCase()==="html"||(o=!1,re())}document.addEventListener("keydown",f,!0),document.addEventListener("mousedown",u,!0),document.addEventListener("pointerdown",u,!0),document.addEventListener("touchstart",u,!0),document.addEventListener("visibilitychange",M,!0),ee(),r.addEventListener("focus",d,!0),r.addEventListener("blur",b,!0),r.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&r.host?r.host.setAttribute("data-js-focus-visible",""):r.nodeType===Node.DOCUMENT_NODE&&(document.documentElement.classList.add("js-focus-visible"),document.documentElement.setAttribute("data-js-focus-visible",""))}if(typeof window!="undefined"&&typeof document!="undefined"){window.applyFocusVisiblePolyfill=e;var t;try{t=new CustomEvent("focus-visible-polyfill-ready")}catch(r){t=document.createEvent("CustomEvent"),t.initCustomEvent("focus-visible-polyfill-ready",!1,!1,{})}window.dispatchEvent(t)}typeof document!="undefined"&&e(document)})});var Zr=Lr((jt,Xr)=>{(function(t,r){typeof jt=="object"&&typeof Xr=="object"?Xr.exports=r():typeof define=="function"&&define.amd?define([],r):typeof jt=="object"?jt.ClipboardJS=r():t.ClipboardJS=r()})(jt,function(){return function(){var e={686:function(o,n,i){"use strict";i.d(n,{default:function(){return Li}});var a=i(279),s=i.n(a),p=i(370),c=i.n(p),l=i(817),f=i.n(l);function u(D){try{return document.execCommand(D)}catch(_){return!1}}var d=function(_){var L=f()(_);return u("cut"),L},b=d;function M(D){var _=document.documentElement.getAttribute("dir")==="rtl",L=document.createElement("textarea");L.style.fontSize="12pt",L.style.border="0",L.style.padding="0",L.style.margin="0",L.style.position="absolute",L.style[_?"right":"left"]="-9999px";var j=window.pageYOffset||document.documentElement.scrollTop;return L.style.top="".concat(j,"px"),L.setAttribute("readonly",""),L.value=D,L}var ee=function(_,L){var j=M(_);L.container.appendChild(j);var N=f()(j);return u("copy"),j.remove(),N},re=function(_){var L=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{container:document.body},j="";return typeof _=="string"?j=ee(_,L):_ instanceof HTMLInputElement&&!["text","search","url","tel","password"].includes(_==null?void 0:_.type)?j=ee(_.value,L):(j=f()(_),u("copy")),j},B=re;function C(D){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?C=function(L){return typeof L}:C=function(L){return L&&typeof Symbol=="function"&&L.constructor===Symbol&&L!==Symbol.prototype?"symbol":typeof L},C(D)}var et=function(){var _=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},L=_.action,j=L===void 0?"copy":L,N=_.container,Y=_.target,Pe=_.text;if(j!=="copy"&&j!=="cut")throw new Error('Invalid "action" value, use either "copy" or "cut"');if(Y!==void 0)if(Y&&C(Y)==="object"&&Y.nodeType===1){if(j==="copy"&&Y.hasAttribute("disabled"))throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');if(j==="cut"&&(Y.hasAttribute("readonly")||Y.hasAttribute("disabled")))throw new Error(`Invalid "target" attribute. You can't cut text from elements with "readonly" or "disabled" attributes`)}else throw new Error('Invalid "target" value, use a valid Element');if(Pe)return B(Pe,{container:N});if(Y)return j==="cut"?b(Y):B(Y,{container:N})},H=et;function Q(D){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Q=function(L){return typeof L}:Q=function(L){return L&&typeof Symbol=="function"&&L.constructor===Symbol&&L!==Symbol.prototype?"symbol":typeof L},Q(D)}function se(D,_){if(!(D instanceof _))throw new TypeError("Cannot call a class as a function")}function ue(D,_){for(var L=0;L<_.length;L++){var j=_[L];j.enumerable=j.enumerable||!1,j.configurable=!0,"value"in j&&(j.writable=!0),Object.defineProperty(D,j.key,j)}}function we(D,_,L){return _&&ue(D.prototype,_),L&&ue(D,L),D}function Ye(D,_){if(typeof _!="function"&&_!==null)throw new TypeError("Super expression must either be null or a function");D.prototype=Object.create(_&&_.prototype,{constructor:{value:D,writable:!0,configurable:!0}}),_&&Tr(D,_)}function Tr(D,_){return Tr=Object.setPrototypeOf||function(j,N){return j.__proto__=N,j},Tr(D,_)}function wi(D){var _=Oi();return function(){var j=Dt(D),N;if(_){var Y=Dt(this).constructor;N=Reflect.construct(j,arguments,Y)}else N=j.apply(this,arguments);return Ti(this,N)}}function Ti(D,_){return _&&(Q(_)==="object"||typeof _=="function")?_:Si(D)}function Si(D){if(D===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return D}function Oi(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(D){return!1}}function Dt(D){return Dt=Object.setPrototypeOf?Object.getPrototypeOf:function(L){return L.__proto__||Object.getPrototypeOf(L)},Dt(D)}function Sr(D,_){var L="data-clipboard-".concat(D);if(_.hasAttribute(L))return _.getAttribute(L)}var Mi=function(D){Ye(L,D);var _=wi(L);function L(j,N){var Y;return se(this,L),Y=_.call(this),Y.resolveOptions(N),Y.listenClick(j),Y}return we(L,[{key:"resolveOptions",value:function(){var N=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.action=typeof N.action=="function"?N.action:this.defaultAction,this.target=typeof N.target=="function"?N.target:this.defaultTarget,this.text=typeof N.text=="function"?N.text:this.defaultText,this.container=Q(N.container)==="object"?N.container:document.body}},{key:"listenClick",value:function(N){var Y=this;this.listener=c()(N,"click",function(Pe){return Y.onClick(Pe)})}},{key:"onClick",value:function(N){var Y=N.delegateTarget||N.currentTarget,Pe=this.action(Y)||"copy",Vt=H({action:Pe,container:this.container,target:this.target(Y),text:this.text(Y)});this.emit(Vt?"success":"error",{action:Pe,text:Vt,trigger:Y,clearSelection:function(){Y&&Y.focus(),window.getSelection().removeAllRanges()}})}},{key:"defaultAction",value:function(N){return Sr("action",N)}},{key:"defaultTarget",value:function(N){var Y=Sr("target",N);if(Y)return document.querySelector(Y)}},{key:"defaultText",value:function(N){return Sr("text",N)}},{key:"destroy",value:function(){this.listener.destroy()}}],[{key:"copy",value:function(N){var Y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{container:document.body};return B(N,Y)}},{key:"cut",value:function(N){return b(N)}},{key:"isSupported",value:function(){var N=arguments.length>0&&arguments[0]!==void 0?arguments[0]:["copy","cut"],Y=typeof N=="string"?[N]:N,Pe=!!document.queryCommandSupported;return Y.forEach(function(Vt){Pe=Pe&&!!document.queryCommandSupported(Vt)}),Pe}}]),L}(s()),Li=Mi},828:function(o){var n=9;if(typeof Element!="undefined"&&!Element.prototype.matches){var i=Element.prototype;i.matches=i.matchesSelector||i.mozMatchesSelector||i.msMatchesSelector||i.oMatchesSelector||i.webkitMatchesSelector}function a(s,p){for(;s&&s.nodeType!==n;){if(typeof s.matches=="function"&&s.matches(p))return s;s=s.parentNode}}o.exports=a},438:function(o,n,i){var a=i(828);function s(l,f,u,d,b){var M=c.apply(this,arguments);return l.addEventListener(u,M,b),{destroy:function(){l.removeEventListener(u,M,b)}}}function p(l,f,u,d,b){return typeof l.addEventListener=="function"?s.apply(null,arguments):typeof u=="function"?s.bind(null,document).apply(null,arguments):(typeof l=="string"&&(l=document.querySelectorAll(l)),Array.prototype.map.call(l,function(M){return s(M,f,u,d,b)}))}function c(l,f,u,d){return function(b){b.delegateTarget=a(b.target,f),b.delegateTarget&&d.call(l,b)}}o.exports=p},879:function(o,n){n.node=function(i){return i!==void 0&&i instanceof HTMLElement&&i.nodeType===1},n.nodeList=function(i){var a=Object.prototype.toString.call(i);return i!==void 0&&(a==="[object NodeList]"||a==="[object HTMLCollection]")&&"length"in i&&(i.length===0||n.node(i[0]))},n.string=function(i){return typeof i=="string"||i instanceof String},n.fn=function(i){var a=Object.prototype.toString.call(i);return a==="[object Function]"}},370:function(o,n,i){var a=i(879),s=i(438);function p(u,d,b){if(!u&&!d&&!b)throw new Error("Missing required arguments");if(!a.string(d))throw new TypeError("Second argument must be a String");if(!a.fn(b))throw new TypeError("Third argument must be a Function");if(a.node(u))return c(u,d,b);if(a.nodeList(u))return l(u,d,b);if(a.string(u))return f(u,d,b);throw new TypeError("First argument must be a String, HTMLElement, HTMLCollection, or NodeList")}function c(u,d,b){return u.addEventListener(d,b),{destroy:function(){u.removeEventListener(d,b)}}}function l(u,d,b){return Array.prototype.forEach.call(u,function(M){M.addEventListener(d,b)}),{destroy:function(){Array.prototype.forEach.call(u,function(M){M.removeEventListener(d,b)})}}}function f(u,d,b){return s(document.body,u,d,b)}o.exports=p},817:function(o){function n(i){var a;if(i.nodeName==="SELECT")i.focus(),a=i.value;else if(i.nodeName==="INPUT"||i.nodeName==="TEXTAREA"){var s=i.hasAttribute("readonly");s||i.setAttribute("readonly",""),i.select(),i.setSelectionRange(0,i.value.length),s||i.removeAttribute("readonly"),a=i.value}else{i.hasAttribute("contenteditable")&&i.focus();var p=window.getSelection(),c=document.createRange();c.selectNodeContents(i),p.removeAllRanges(),p.addRange(c),a=p.toString()}return a}o.exports=n},279:function(o){function n(){}n.prototype={on:function(i,a,s){var p=this.e||(this.e={});return(p[i]||(p[i]=[])).push({fn:a,ctx:s}),this},once:function(i,a,s){var p=this;function c(){p.off(i,c),a.apply(s,arguments)}return c._=a,this.on(i,c,s)},emit:function(i){var a=[].slice.call(arguments,1),s=((this.e||(this.e={}))[i]||[]).slice(),p=0,c=s.length;for(p;p{"use strict";var Ua=/["'&<>]/;Yn.exports=Na;function Na(e){var t=""+e,r=Ua.exec(t);if(!r)return t;var o,n="",i=0,a=0;for(i=r.index;i0&&i[i.length-1])&&(c[0]===6||c[0]===2)){r=0;continue}if(c[0]===3&&(!i||c[1]>i[0]&&c[1]=e.length&&(e=void 0),{value:e&&e[o++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function q(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var o=r.call(e),n,i=[],a;try{for(;(t===void 0||t-- >0)&&!(n=o.next()).done;)i.push(n.value)}catch(s){a={error:s}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(a)throw a.error}}return i}function K(e,t,r){if(r||arguments.length===2)for(var o=0,n=t.length,i;o1||s(u,d)})})}function s(u,d){try{p(o[u](d))}catch(b){f(i[0][3],b)}}function p(u){u.value instanceof ct?Promise.resolve(u.value.v).then(c,l):f(i[0][2],u)}function c(u){s("next",u)}function l(u){s("throw",u)}function f(u,d){u(d),i.shift(),i.length&&s(i[0][0],i[0][1])}}function uo(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],r;return t?t.call(e):(e=typeof Te=="function"?Te(e):e[Symbol.iterator](),r={},o("next"),o("throw"),o("return"),r[Symbol.asyncIterator]=function(){return this},r);function o(i){r[i]=e[i]&&function(a){return new Promise(function(s,p){a=e[i](a),n(s,p,a.done,a.value)})}}function n(i,a,s,p){Promise.resolve(p).then(function(c){i({value:c,done:s})},a)}}function k(e){return typeof e=="function"}function ut(e){var t=function(o){Error.call(o),o.stack=new Error().stack},r=e(t);return r.prototype=Object.create(Error.prototype),r.prototype.constructor=r,r}var Qt=ut(function(e){return function(r){e(this),this.message=r?r.length+` errors occurred during unsubscription: +`+r.map(function(o,n){return n+1+") "+o.toString()}).join(` + `):"",this.name="UnsubscriptionError",this.errors=r}});function Be(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}var De=function(){function e(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}return e.prototype.unsubscribe=function(){var t,r,o,n,i;if(!this.closed){this.closed=!0;var a=this._parentage;if(a)if(this._parentage=null,Array.isArray(a))try{for(var s=Te(a),p=s.next();!p.done;p=s.next()){var c=p.value;c.remove(this)}}catch(M){t={error:M}}finally{try{p&&!p.done&&(r=s.return)&&r.call(s)}finally{if(t)throw t.error}}else a.remove(this);var l=this.initialTeardown;if(k(l))try{l()}catch(M){i=M instanceof Qt?M.errors:[M]}var f=this._finalizers;if(f){this._finalizers=null;try{for(var u=Te(f),d=u.next();!d.done;d=u.next()){var b=d.value;try{ho(b)}catch(M){i=i!=null?i:[],M instanceof Qt?i=K(K([],q(i)),q(M.errors)):i.push(M)}}}catch(M){o={error:M}}finally{try{d&&!d.done&&(n=u.return)&&n.call(u)}finally{if(o)throw o.error}}}if(i)throw new Qt(i)}},e.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)ho(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=(r=this._finalizers)!==null&&r!==void 0?r:[]).push(t)}},e.prototype._hasParent=function(t){var r=this._parentage;return r===t||Array.isArray(r)&&r.includes(t)},e.prototype._addParent=function(t){var r=this._parentage;this._parentage=Array.isArray(r)?(r.push(t),r):r?[r,t]:t},e.prototype._removeParent=function(t){var r=this._parentage;r===t?this._parentage=null:Array.isArray(r)&&Be(r,t)},e.prototype.remove=function(t){var r=this._finalizers;r&&Be(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=function(){var t=new e;return t.closed=!0,t}(),e}();var Cr=De.EMPTY;function Yt(e){return e instanceof De||e&&"closed"in e&&k(e.remove)&&k(e.add)&&k(e.unsubscribe)}function ho(e){k(e)?e():e.unsubscribe()}var Ie={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};var dt={setTimeout:function(e,t){for(var r=[],o=2;o0},enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(r){return this._throwIfClosed(),e.prototype._trySubscribe.call(this,r)},t.prototype._subscribe=function(r){return this._throwIfClosed(),this._checkFinalizedStatuses(r),this._innerSubscribe(r)},t.prototype._innerSubscribe=function(r){var o=this,n=this,i=n.hasError,a=n.isStopped,s=n.observers;return i||a?Cr:(this.currentObservers=null,s.push(r),new De(function(){o.currentObservers=null,Be(s,r)}))},t.prototype._checkFinalizedStatuses=function(r){var o=this,n=o.hasError,i=o.thrownError,a=o.isStopped;n?r.error(i):a&&r.complete()},t.prototype.asObservable=function(){var r=new V;return r.source=this,r},t.create=function(r,o){return new To(r,o)},t}(V);var To=function(e){me(t,e);function t(r,o){var n=e.call(this)||this;return n.destination=r,n.source=o,n}return t.prototype.next=function(r){var o,n;(n=(o=this.destination)===null||o===void 0?void 0:o.next)===null||n===void 0||n.call(o,r)},t.prototype.error=function(r){var o,n;(n=(o=this.destination)===null||o===void 0?void 0:o.error)===null||n===void 0||n.call(o,r)},t.prototype.complete=function(){var r,o;(o=(r=this.destination)===null||r===void 0?void 0:r.complete)===null||o===void 0||o.call(r)},t.prototype._subscribe=function(r){var o,n;return(n=(o=this.source)===null||o===void 0?void 0:o.subscribe(r))!==null&&n!==void 0?n:Cr},t}(S);var At={now:function(){return(At.delegate||Date).now()},delegate:void 0};var Ct=function(e){me(t,e);function t(r,o,n){r===void 0&&(r=1/0),o===void 0&&(o=1/0),n===void 0&&(n=At);var i=e.call(this)||this;return i._bufferSize=r,i._windowTime=o,i._timestampProvider=n,i._buffer=[],i._infiniteTimeWindow=!0,i._infiniteTimeWindow=o===1/0,i._bufferSize=Math.max(1,r),i._windowTime=Math.max(1,o),i}return t.prototype.next=function(r){var o=this,n=o.isStopped,i=o._buffer,a=o._infiniteTimeWindow,s=o._timestampProvider,p=o._windowTime;n||(i.push(r),!a&&i.push(s.now()+p)),this._trimBuffer(),e.prototype.next.call(this,r)},t.prototype._subscribe=function(r){this._throwIfClosed(),this._trimBuffer();for(var o=this._innerSubscribe(r),n=this,i=n._infiniteTimeWindow,a=n._buffer,s=a.slice(),p=0;p0?e.prototype.requestAsyncId.call(this,r,o,n):(r.actions.push(this),r._scheduled||(r._scheduled=vt.requestAnimationFrame(function(){return r.flush(void 0)})))},t.prototype.recycleAsyncId=function(r,o,n){var i;if(n===void 0&&(n=0),n!=null?n>0:this.delay>0)return e.prototype.recycleAsyncId.call(this,r,o,n);var a=r.actions;o!=null&&((i=a[a.length-1])===null||i===void 0?void 0:i.id)!==o&&(vt.cancelAnimationFrame(o),r._scheduled=void 0)},t}(Jt);var Mo=function(e){me(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.flush=function(r){this._active=!0;var o=this._scheduled;this._scheduled=void 0;var n=this.actions,i;r=r||n.shift();do if(i=r.execute(r.state,r.delay))break;while((r=n[0])&&r.id===o&&n.shift());if(this._active=!1,i){for(;(r=n[0])&&r.id===o&&n.shift();)r.unsubscribe();throw i}},t}(Xt);var Oe=new Mo(Oo);var E=new V(function(e){return e.complete()});function Zt(e){return e&&k(e.schedule)}function Fr(e){return e[e.length-1]}function tt(e){return k(Fr(e))?e.pop():void 0}function Re(e){return Zt(Fr(e))?e.pop():void 0}function er(e,t){return typeof Fr(e)=="number"?e.pop():t}var gt=function(e){return e&&typeof e.length=="number"&&typeof e!="function"};function tr(e){return k(e==null?void 0:e.then)}function rr(e){return k(e[bt])}function or(e){return Symbol.asyncIterator&&k(e==null?void 0:e[Symbol.asyncIterator])}function nr(e){return new TypeError("You provided "+(e!==null&&typeof e=="object"?"an invalid object":"'"+e+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}function Ni(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var ir=Ni();function ar(e){return k(e==null?void 0:e[ir])}function sr(e){return fo(this,arguments,function(){var r,o,n,i;return Kt(this,function(a){switch(a.label){case 0:r=e.getReader(),a.label=1;case 1:a.trys.push([1,,9,10]),a.label=2;case 2:return[4,ct(r.read())];case 3:return o=a.sent(),n=o.value,i=o.done,i?[4,ct(void 0)]:[3,5];case 4:return[2,a.sent()];case 5:return[4,ct(n)];case 6:return[4,a.sent()];case 7:return a.sent(),[3,2];case 8:return[3,10];case 9:return r.releaseLock(),[7];case 10:return[2]}})})}function cr(e){return k(e==null?void 0:e.getReader)}function I(e){if(e instanceof V)return e;if(e!=null){if(rr(e))return Di(e);if(gt(e))return Vi(e);if(tr(e))return zi(e);if(or(e))return Lo(e);if(ar(e))return qi(e);if(cr(e))return Ki(e)}throw nr(e)}function Di(e){return new V(function(t){var r=e[bt]();if(k(r.subscribe))return r.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function Vi(e){return new V(function(t){for(var r=0;r=2;return function(o){return o.pipe(e?y(function(n,i){return e(n,i,o)}):de,he(1),r?je(t):zo(function(){return new lr}))}}function Dr(e){return e<=0?function(){return E}:g(function(t,r){var o=[];t.subscribe(x(r,function(n){o.push(n),e=2,!0))}function be(e){e===void 0&&(e={});var t=e.connector,r=t===void 0?function(){return new S}:t,o=e.resetOnError,n=o===void 0?!0:o,i=e.resetOnComplete,a=i===void 0?!0:i,s=e.resetOnRefCountZero,p=s===void 0?!0:s;return function(c){var l,f,u,d=0,b=!1,M=!1,ee=function(){f==null||f.unsubscribe(),f=void 0},re=function(){ee(),l=u=void 0,b=M=!1},B=function(){var C=l;re(),C==null||C.unsubscribe()};return g(function(C,et){d++,!M&&!b&&ee();var H=u=u!=null?u:r();et.add(function(){d--,d===0&&!M&&!b&&(f=Vr(B,p))}),H.subscribe(et),!l&&d>0&&(l=new lt({next:function(Q){return H.next(Q)},error:function(Q){M=!0,ee(),f=Vr(re,n,Q),H.error(Q)},complete:function(){b=!0,ee(),f=Vr(re,a),H.complete()}}),I(C).subscribe(l))})(c)}}function Vr(e,t){for(var r=[],o=2;oe.next(document)),e}function $(e,t=document){return Array.from(t.querySelectorAll(e))}function F(e,t=document){let r=fe(e,t);if(typeof r=="undefined")throw new ReferenceError(`Missing element: expected "${e}" to be present`);return r}function fe(e,t=document){return t.querySelector(e)||void 0}function Ne(){return document.activeElement instanceof HTMLElement&&document.activeElement||void 0}var la=w(h(document.body,"focusin"),h(document.body,"focusout")).pipe(ye(1),z(void 0),m(()=>Ne()||document.body),J(1));function Et(e){return la.pipe(m(t=>e.contains(t)),Z())}function ur(e,t){return w(h(e,"mouseenter").pipe(m(()=>!0)),h(e,"mouseleave").pipe(m(()=>!1))).pipe(t?ye(t):de,z(!1))}function ze(e){return{x:e.offsetLeft,y:e.offsetTop}}function Bo(e){return w(h(window,"load"),h(window,"resize")).pipe(He(0,Oe),m(()=>ze(e)),z(ze(e)))}function dr(e){return{x:e.scrollLeft,y:e.scrollTop}}function it(e){return w(h(e,"scroll"),h(window,"resize")).pipe(He(0,Oe),m(()=>dr(e)),z(dr(e)))}function Go(e,t){if(typeof t=="string"||typeof t=="number")e.innerHTML+=t.toString();else if(t instanceof Node)e.appendChild(t);else if(Array.isArray(t))for(let r of t)Go(e,r)}function O(e,t,...r){let o=document.createElement(e);if(t)for(let n of Object.keys(t))typeof t[n]!="undefined"&&(typeof t[n]!="boolean"?o.setAttribute(n,t[n]):o.setAttribute(n,""));for(let n of r)Go(o,n);return o}function hr(e){if(e>999){let t=+((e-950)%1e3>99);return`${((e+1e-6)/1e3).toFixed(t)}k`}else return e.toString()}function wt(e){let t=O("script",{src:e});return P(()=>(document.head.appendChild(t),w(h(t,"load"),h(t,"error").pipe(v(()=>Ht(()=>new ReferenceError(`Invalid script: ${e}`))))).pipe(m(()=>{}),A(()=>document.head.removeChild(t)),he(1))))}var Jo=new S,ma=P(()=>typeof ResizeObserver=="undefined"?wt("https://wpbrowser.wptestkit.dev/assets/external/unpkg.com/resize-observer-polyfill/dist/ResizeObserver.js"):R(void 0)).pipe(m(()=>new ResizeObserver(e=>{for(let t of e)Jo.next(t)})),v(e=>w(Je,R(e)).pipe(A(()=>e.disconnect()))),J(1));function ve(e){return{width:e.offsetWidth,height:e.offsetHeight}}function Ae(e){return ma.pipe(T(t=>t.observe(e)),v(t=>Jo.pipe(y(({target:r})=>r===e),A(()=>t.unobserve(e)),m(()=>ve(e)))),z(ve(e)))}function Tt(e){return{width:e.scrollWidth,height:e.scrollHeight}}function St(e){let t=e.parentElement;for(;t&&(e.scrollWidth<=t.scrollWidth&&e.scrollHeight<=t.scrollHeight);)t=(e=t).parentElement;return t?e:void 0}var Xo=new S,fa=P(()=>R(new IntersectionObserver(e=>{for(let t of e)Xo.next(t)},{threshold:0}))).pipe(v(e=>w(Je,R(e)).pipe(A(()=>e.disconnect()))),J(1));function Ot(e){return fa.pipe(T(t=>t.observe(e)),v(t=>Xo.pipe(y(({target:r})=>r===e),A(()=>t.unobserve(e)),m(({isIntersecting:r})=>r))))}function Zo(e,t=16){return it(e).pipe(m(({y:r})=>{let o=ve(e),n=Tt(e);return r>=n.height-o.height-t}),Z())}var br={drawer:F("[data-md-toggle=drawer]"),search:F("[data-md-toggle=search]")};function en(e){return br[e].checked}function Ze(e,t){br[e].checked!==t&&br[e].click()}function qe(e){let t=br[e];return h(t,"change").pipe(m(()=>t.checked),z(t.checked))}function ua(e,t){switch(e.constructor){case HTMLInputElement:return e.type==="radio"?/^Arrow/.test(t):!0;case HTMLSelectElement:case HTMLTextAreaElement:return!0;default:return e.isContentEditable}}function da(){return w(h(window,"compositionstart").pipe(m(()=>!0)),h(window,"compositionend").pipe(m(()=>!1))).pipe(z(!1))}function tn(){let e=h(window,"keydown").pipe(y(t=>!(t.metaKey||t.ctrlKey)),m(t=>({mode:en("search")?"search":"global",type:t.key,claim(){t.preventDefault(),t.stopPropagation()}})),y(({mode:t,type:r})=>{if(t==="global"){let o=Ne();if(typeof o!="undefined")return!ua(o,r)}return!0}),be());return da().pipe(v(t=>t?E:e))}function Ee(){return new URL(location.href)}function ft(e){location.href=e.href}function rn(){return new S}function on(){return location.hash.slice(1)}function Qr(e){let t=O("a",{href:e});t.addEventListener("click",r=>r.stopPropagation()),t.click()}function Yr(e){return w(h(window,"hashchange"),e).pipe(m(on),z(on()),y(t=>t.length>0),J(1))}function nn(e){return Yr(e).pipe(m(t=>fe(`[id="${t}"]`)),y(t=>typeof t!="undefined"))}function It(e){let t=matchMedia(e);return mr(r=>t.addListener(()=>r(t.matches))).pipe(z(t.matches))}function an(){let e=matchMedia("print");return w(h(window,"beforeprint").pipe(m(()=>!0)),h(window,"afterprint").pipe(m(()=>!1))).pipe(z(e.matches))}function Br(e,t){return e.pipe(v(r=>r?t():E))}function vr(e,t={credentials:"same-origin"}){return pe(fetch(`${e}`,t)).pipe(xe(()=>E),v(r=>r.status!==200?Ht(()=>new Error(r.statusText)):R(r)))}function Ke(e,t){return vr(e,t).pipe(v(r=>r.json()),J(1))}function sn(e,t){let r=new DOMParser;return vr(e,t).pipe(v(o=>o.text()),m(o=>r.parseFromString(o,"text/xml")),J(1))}function cn(){return{x:Math.max(0,scrollX),y:Math.max(0,scrollY)}}function pn(){return w(h(window,"scroll",{passive:!0}),h(window,"resize",{passive:!0})).pipe(m(cn),z(cn()))}function ln(){return{width:innerWidth,height:innerHeight}}function mn(){return h(window,"resize",{passive:!0}).pipe(m(ln),z(ln()))}function fn(){return G([pn(),mn()]).pipe(m(([e,t])=>({offset:e,size:t})),J(1))}function gr(e,{viewport$:t,header$:r}){let o=t.pipe(ne("size")),n=G([o,r]).pipe(m(()=>ze(e)));return G([r,t,n]).pipe(m(([{height:i},{offset:a,size:s},{x:p,y:c}])=>({offset:{x:a.x-p,y:a.y-c+i},size:s})))}function ha(e){return h(e,"message",t=>t.data)}function ba(e){let t=new S;return t.subscribe(r=>e.postMessage(r)),t}function un(e,t=new Worker(e)){let r=ha(t),o=ba(t),n=new S;n.subscribe(o);let i=o.pipe(oe(),ae(!0));return n.pipe(oe(),Ue(r.pipe(U(i))),be())}var va=F("#__config"),Mt=JSON.parse(va.textContent);Mt.base=`${new URL(Mt.base,Ee())}`;function ge(){return Mt}function X(e){return Mt.features.includes(e)}function Le(e,t){return typeof t!="undefined"?Mt.translations[e].replace("#",t.toString()):Mt.translations[e]}function Ce(e,t=document){return F(`[data-md-component=${e}]`,t)}function le(e,t=document){return $(`[data-md-component=${e}]`,t)}function ga(e){let t=F(".md-typeset > :first-child",e);return h(t,"click",{once:!0}).pipe(m(()=>F(".md-typeset",e)),m(r=>({hash:__md_hash(r.innerHTML)})))}function dn(e){if(!X("announce.dismiss")||!e.childElementCount)return E;if(!e.hidden){let t=F(".md-typeset",e);__md_hash(t.innerHTML)===__md_get("__announce")&&(e.hidden=!0)}return P(()=>{let t=new S;return t.subscribe(({hash:r})=>{e.hidden=!0,__md_set("__announce",r)}),ga(e).pipe(T(r=>t.next(r)),A(()=>t.complete()),m(r=>W({ref:e},r)))})}function xa(e,{target$:t}){return t.pipe(m(r=>({hidden:r!==e})))}function hn(e,t){let r=new S;return r.subscribe(({hidden:o})=>{e.hidden=o}),xa(e,t).pipe(T(o=>r.next(o)),A(()=>r.complete()),m(o=>W({ref:e},o)))}function Ft(e,t){return t==="inline"?O("div",{class:"md-tooltip md-tooltip--inline",id:e,role:"tooltip"},O("div",{class:"md-tooltip__inner md-typeset"})):O("div",{class:"md-tooltip",id:e,role:"tooltip"},O("div",{class:"md-tooltip__inner md-typeset"}))}function bn(e,t){if(t=t?`${t}_annotation_${e}`:void 0,t){let r=t?`#${t}`:void 0;return O("aside",{class:"md-annotation",tabIndex:0},Ft(t),O("a",{href:r,class:"md-annotation__index",tabIndex:-1},O("span",{"data-md-annotation-id":e})))}else return O("aside",{class:"md-annotation",tabIndex:0},Ft(t),O("span",{class:"md-annotation__index",tabIndex:-1},O("span",{"data-md-annotation-id":e})))}function vn(e){return O("button",{class:"md-code__button",title:Le("clipboard.copy"),"data-clipboard-target":`#${e} > code`,"data-md-type":"copy"})}function gn(){return O("button",{class:"md-code__button",title:"Toggle line selection","data-md-type":"select"})}function xn(){return O("nav",{class:"md-code__nav"})}function Gr(e,t){let r=t&2,o=t&1,n=Object.keys(e.terms).filter(p=>!e.terms[p]).reduce((p,c)=>[...p,O("del",null,c)," "],[]).slice(0,-1),i=ge(),a=new URL(e.location,i.base);X("search.highlight")&&a.searchParams.set("h",Object.entries(e.terms).filter(([,p])=>p).reduce((p,[c])=>`${p} ${c}`.trim(),""));let{tags:s}=ge();return O("a",{href:`${a}`,class:"md-search-result__link",tabIndex:-1},O("article",{class:"md-search-result__article md-typeset","data-md-score":e.score.toFixed(2)},r>0&&O("div",{class:"md-search-result__icon md-icon"}),r>0&&O("h1",null,e.title),r<=0&&O("h2",null,e.title),o>0&&e.text.length>0&&e.text,e.tags&&e.tags.map(p=>{let c=s?p in s?`md-tag-icon md-tag--${s[p]}`:"md-tag-icon":"";return O("span",{class:`md-tag ${c}`},p)}),o>0&&n.length>0&&O("p",{class:"md-search-result__terms"},Le("search.result.term.missing"),": ",...n)))}function yn(e){let t=e[0].score,r=[...e],o=ge(),n=r.findIndex(l=>!`${new URL(l.location,o.base)}`.includes("#")),[i]=r.splice(n,1),a=r.findIndex(l=>l.scoreGr(l,1)),...p.length?[O("details",{class:"md-search-result__more"},O("summary",{tabIndex:-1},O("div",null,p.length>0&&p.length===1?Le("search.result.more.one"):Le("search.result.more.other",p.length))),...p.map(l=>Gr(l,1)))]:[]];return O("li",{class:"md-search-result__item"},c)}function En(e){return O("ul",{class:"md-source__facts"},Object.entries(e).map(([t,r])=>O("li",{class:`md-source__fact md-source__fact--${t}`},typeof r=="number"?hr(r):r)))}function Jr(e){let t=`tabbed-control tabbed-control--${e}`;return O("div",{class:t,hidden:!0},O("button",{class:"tabbed-button",tabIndex:-1,"aria-hidden":"true"}))}function wn(e){return O("div",{class:"md-typeset__scrollwrap"},O("div",{class:"md-typeset__table"},e))}function ya(e){let t=ge(),r=new URL(`../${e.version}/`,t.base);return O("li",{class:"md-version__item"},O("a",{href:`${r}`,class:"md-version__link"},e.title))}function Tn(e,t){return O("div",{class:"md-version"},O("button",{class:"md-version__current","aria-label":Le("select.version")},t.title),O("ul",{class:"md-version__list"},e.map(ya)))}var Ea=0;function wa(e,t){document.body.append(e);let{width:r}=ve(e);e.style.setProperty("--md-tooltip-width",`${r}px`),e.remove();let o=St(t),n=typeof o!="undefined"?it(o):R({x:0,y:0}),i=w(Et(t),ur(t)).pipe(Z());return G([i,n]).pipe(m(([a,s])=>{let{x:p,y:c}=ze(t),l=ve(t),f=t.closest("table");return f&&t.parentElement&&(p+=f.offsetLeft+t.parentElement.offsetLeft,c+=f.offsetTop+t.parentElement.offsetTop),{active:a,offset:{x:p-s.x+l.width/2-r/2,y:c-s.y+l.height+8}}}))}function Qe(e){let t=e.title;if(!t.length)return E;let r=`__tooltip_${Ea++}`,o=Ft(r,"inline"),n=F(".md-typeset",o);return n.innerHTML=t,P(()=>{let i=new S;return i.subscribe({next({offset:a}){o.style.setProperty("--md-tooltip-x",`${a.x}px`),o.style.setProperty("--md-tooltip-y",`${a.y}px`)},complete(){o.style.removeProperty("--md-tooltip-x"),o.style.removeProperty("--md-tooltip-y")}}),w(i.pipe(y(({active:a})=>a)),i.pipe(ye(250),y(({active:a})=>!a))).subscribe({next({active:a}){a?(e.insertAdjacentElement("afterend",o),e.setAttribute("aria-describedby",r),e.removeAttribute("title")):(o.remove(),e.removeAttribute("aria-describedby"),e.setAttribute("title",t))},complete(){o.remove(),e.removeAttribute("aria-describedby"),e.setAttribute("title",t)}}),i.pipe(He(16,Oe)).subscribe(({active:a})=>{o.classList.toggle("md-tooltip--active",a)}),i.pipe(Pt(125,Oe),y(()=>!!e.offsetParent),m(()=>e.offsetParent.getBoundingClientRect()),m(({x:a})=>a)).subscribe({next(a){a?o.style.setProperty("--md-tooltip-0",`${-a}px`):o.style.removeProperty("--md-tooltip-0")},complete(){o.style.removeProperty("--md-tooltip-0")}}),wa(o,e).pipe(T(a=>i.next(a)),A(()=>i.complete()),m(a=>W({ref:e},a)))}).pipe(Ge(ce))}function Ta(e,t){let r=P(()=>G([Bo(e),it(t)])).pipe(m(([{x:o,y:n},i])=>{let{width:a,height:s}=ve(e);return{x:o-i.x+a/2,y:n-i.y+s/2}}));return Et(e).pipe(v(o=>r.pipe(m(n=>({active:o,offset:n})),he(+!o||1/0))))}function Sn(e,t,{target$:r}){let[o,n]=Array.from(e.children);return P(()=>{let i=new S,a=i.pipe(oe(),ae(!0));return i.subscribe({next({offset:s}){e.style.setProperty("--md-tooltip-x",`${s.x}px`),e.style.setProperty("--md-tooltip-y",`${s.y}px`)},complete(){e.style.removeProperty("--md-tooltip-x"),e.style.removeProperty("--md-tooltip-y")}}),Ot(e).pipe(U(a)).subscribe(s=>{e.toggleAttribute("data-md-visible",s)}),w(i.pipe(y(({active:s})=>s)),i.pipe(ye(250),y(({active:s})=>!s))).subscribe({next({active:s}){s?e.prepend(o):o.remove()},complete(){e.prepend(o)}}),i.pipe(He(16,Oe)).subscribe(({active:s})=>{o.classList.toggle("md-tooltip--active",s)}),i.pipe(Pt(125,Oe),y(()=>!!e.offsetParent),m(()=>e.offsetParent.getBoundingClientRect()),m(({x:s})=>s)).subscribe({next(s){s?e.style.setProperty("--md-tooltip-0",`${-s}px`):e.style.removeProperty("--md-tooltip-0")},complete(){e.style.removeProperty("--md-tooltip-0")}}),h(n,"click").pipe(U(a),y(s=>!(s.metaKey||s.ctrlKey))).subscribe(s=>{s.stopPropagation(),s.preventDefault()}),h(n,"mousedown").pipe(U(a),ie(i)).subscribe(([s,{active:p}])=>{var c;if(s.button!==0||s.metaKey||s.ctrlKey)s.preventDefault();else if(p){s.preventDefault();let l=e.parentElement.closest(".md-annotation");l instanceof HTMLElement?l.focus():(c=Ne())==null||c.blur()}}),r.pipe(U(a),y(s=>s===o),Xe(125)).subscribe(()=>e.focus()),Ta(e,t).pipe(T(s=>i.next(s)),A(()=>i.complete()),m(s=>W({ref:e},s)))})}function Sa(e){let t=ge();if(e.tagName!=="CODE")return[e];let r=[".c",".c1",".cm"];if(typeof t.annotate!="undefined"){let o=e.closest("[class|=language]");if(o)for(let n of Array.from(o.classList)){if(!n.startsWith("language-"))continue;let[,i]=n.split("-");i in t.annotate&&r.push(...t.annotate[i])}}return $(r.join(", "),e)}function Oa(e){let t=[];for(let r of Sa(e)){let o=[],n=document.createNodeIterator(r,NodeFilter.SHOW_TEXT);for(let i=n.nextNode();i;i=n.nextNode())o.push(i);for(let i of o){let a;for(;a=/(\(\d+\))(!)?/.exec(i.textContent);){let[,s,p]=a;if(typeof p=="undefined"){let c=i.splitText(a.index);i=c.splitText(s.length),t.push(c)}else{i.textContent=s,t.push(i);break}}}}return t}function On(e,t){t.append(...Array.from(e.childNodes))}function xr(e,t,{target$:r,print$:o}){let n=t.closest("[id]"),i=n==null?void 0:n.id,a=new Map;for(let s of Oa(t)){let[,p]=s.textContent.match(/\((\d+)\)/);fe(`:scope > li:nth-child(${p})`,e)&&(a.set(p,bn(p,i)),s.replaceWith(a.get(p)))}return a.size===0?E:P(()=>{let s=new S,p=s.pipe(oe(),ae(!0)),c=[];for(let[l,f]of a)c.push([F(".md-typeset",f),F(`:scope > li:nth-child(${l})`,e)]);return o.pipe(U(p)).subscribe(l=>{e.hidden=!l,e.classList.toggle("md-annotation-list",l);for(let[f,u]of c)l?On(f,u):On(u,f)}),w(...[...a].map(([,l])=>Sn(l,t,{target$:r}))).pipe(A(()=>s.complete()),be())})}function Mn(e){if(e.nextElementSibling){let t=e.nextElementSibling;if(t.tagName==="OL")return t;if(t.tagName==="P"&&!t.children.length)return Mn(t)}}function Ln(e,t){return P(()=>{let r=Mn(e);return typeof r!="undefined"?xr(r,e,t):E})}var An=qt(Zr());var Ma=0,_n=w(h(window,"keydown").pipe(m(()=>!0)),w(h(window,"keyup"),h(window,"contextmenu")).pipe(m(()=>!1))).pipe(z(!1),J(1));function Cn(e){if(e.nextElementSibling){let t=e.nextElementSibling;if(t.tagName==="OL")return t;if(t.tagName==="P"&&!t.children.length)return Cn(t)}}function La(e){return Ae(e).pipe(m(({width:t})=>({scrollable:Tt(e).width>t})),ne("scrollable"))}function kn(e,t){let{matches:r}=matchMedia("(hover)"),o=P(()=>{let n=new S,i=n.pipe(Dr(1));n.subscribe(({scrollable:u})=>{u&&r?e.setAttribute("tabindex","0"):e.removeAttribute("tabindex")});let a=Ma++,s=[],p=e.closest("pre");p.id=`__code_${a}`;let c=[],l=e.closest(".highlight");if(l instanceof HTMLElement){let u=Cn(l);if(typeof u!="undefined"&&(l.classList.contains("annotate")||X("content.code.annotate"))){let d=xr(u,e,t);c.push(Ae(l).pipe(U(i),m(({width:b,height:M})=>b&&M),Z(),v(b=>b?d:E)))}}let f=$(":scope > span[id]",e);if(f.length&&(e.classList.add("md-code__content"),e.closest(".select")||X("content.code.select")&&!e.closest(".no-select"))){let u=+f[0].id.split("-").pop(),d=gn();s.push(d),X("content.tooltips")&&c.push(Qe(d));let b=h(d,"click").pipe(Rt(H=>!H,!1),T(()=>d.blur()),be());b.subscribe(H=>{d.classList.toggle("md-code__button--active",H)});let M=pe(f).pipe(te(H=>ur(H).pipe(m(Q=>[H,Q]))));b.pipe(v(H=>H?M:E)).subscribe(([H,Q])=>{let se=fe(".hll.select",H);if(se&&!Q)se.replaceWith(...Array.from(se.childNodes));else if(!se&&Q){let ue=document.createElement("span");ue.className="hll select",ue.append(...Array.from(H.childNodes).slice(1)),H.append(ue)}});let ee=pe(f).pipe(te(H=>h(H,"mousedown").pipe(T(Q=>Q.preventDefault()),m(()=>H)))),re=b.pipe(v(H=>H?ee:E),ie(_n),m(([H,Q])=>{var ue;let se=f.indexOf(H)+u;if(Q===!1)return[se,se];{let we=$(".hll",e).map(Ye=>f.indexOf(Ye.parentElement)+u);return(ue=window.getSelection())==null||ue.removeAllRanges(),[Math.min(se,...we),Math.max(se,...we)]}})),B=Yr(E).pipe(y(H=>H.startsWith(`__codelineno-${a}-`)));B.subscribe(H=>{let[,,Q]=H.split("-"),se=Q.split(":").map(we=>+we-u+1);se.length===1&&se.push(se[0]);for(let we of $(".hll:not(.select)",e))we.replaceWith(...Array.from(we.childNodes));let ue=f.slice(se[0]-1,se[1]);for(let we of ue){let Ye=document.createElement("span");Ye.className="hll",Ye.append(...Array.from(we.childNodes).slice(1)),we.append(Ye)}}),B.pipe(he(1),ke(ce)).subscribe(H=>{if(H.includes(":")){let Q=document.getElementById(H.split(":")[0]);Q&&setTimeout(()=>{let se=Q,ue=-(48+16);for(;se!==document.body;)ue+=se.offsetTop,se=se.offsetParent;window.scrollTo({top:ue})},1)}});let et=pe($('a[href^="#__codelineno"]',l)).pipe(te(H=>h(H,"click").pipe(T(Q=>Q.preventDefault()),m(()=>H)))).pipe(U(i),ie(_n),m(([H,Q])=>{let ue=+F(`[id="${H.hash.slice(1)}"]`).parentElement.id.split("-").pop();if(Q===!1)return[ue,ue];{let we=$(".hll",e).map(Ye=>+Ye.parentElement.id.split("-").pop());return[Math.min(ue,...we),Math.max(ue,...we)]}}));w(re,et).subscribe(H=>{let Q=`#__codelineno-${a}-`;H[0]===H[1]?Q+=H[0]:Q+=`${H[0]}:${H[1]}`,history.replaceState({},"",Q),window.dispatchEvent(new HashChangeEvent("hashchange",{newURL:window.location.origin+window.location.pathname+Q,oldURL:window.location.href}))})}if(An.default.isSupported()&&(e.closest(".copy")||X("content.code.copy")&&!e.closest(".no-copy"))){let u=vn(p.id);s.push(u),X("content.tooltips")&&c.push(Qe(u))}if(s.length){let u=xn();u.append(...s),p.insertBefore(u,e)}return La(e).pipe(T(u=>n.next(u)),A(()=>n.complete()),m(u=>W({ref:e},u)),Ue(...c))});return X("content.lazy")?Ot(e).pipe(y(n=>n),he(1),v(()=>o)):o}function _a(e,{target$:t,print$:r}){let o=!0;return w(t.pipe(m(n=>n.closest("details:not([open])")),y(n=>e===n),m(()=>({action:"open",reveal:!0}))),r.pipe(y(n=>n||!o),T(()=>o=e.open),m(n=>({action:n?"open":"close"}))))}function Hn(e,t){return P(()=>{let r=new S;return r.subscribe(({action:o,reveal:n})=>{e.toggleAttribute("open",o==="open"),n&&e.scrollIntoView()}),_a(e,t).pipe(T(o=>r.next(o)),A(()=>r.complete()),m(o=>W({ref:e},o)))})}var $n=".node circle,.node ellipse,.node path,.node polygon,.node rect{fill:var(--md-mermaid-node-bg-color);stroke:var(--md-mermaid-node-fg-color)}marker{fill:var(--md-mermaid-edge-color)!important}.edgeLabel .label rect{fill:#0000}.label{color:var(--md-mermaid-label-fg-color);font-family:var(--md-mermaid-font-family)}.label foreignObject{line-height:normal;overflow:visible}.label div .edgeLabel{color:var(--md-mermaid-label-fg-color)}.edgeLabel,.edgeLabel rect,.label div .edgeLabel{background-color:var(--md-mermaid-label-bg-color)}.edgeLabel,.edgeLabel rect{fill:var(--md-mermaid-label-bg-color);color:var(--md-mermaid-edge-color)}.edgePath .path,.flowchart-link{stroke:var(--md-mermaid-edge-color);stroke-width:.05rem}.edgePath .arrowheadPath{fill:var(--md-mermaid-edge-color);stroke:none}.cluster rect{fill:var(--md-default-fg-color--lightest);stroke:var(--md-default-fg-color--lighter)}.cluster span{color:var(--md-mermaid-label-fg-color);font-family:var(--md-mermaid-font-family)}g #flowchart-circleEnd,g #flowchart-circleStart,g #flowchart-crossEnd,g #flowchart-crossStart,g #flowchart-pointEnd,g #flowchart-pointStart{stroke:none}g.classGroup line,g.classGroup rect{fill:var(--md-mermaid-node-bg-color);stroke:var(--md-mermaid-node-fg-color)}g.classGroup text{fill:var(--md-mermaid-label-fg-color);font-family:var(--md-mermaid-font-family)}.classLabel .box{fill:var(--md-mermaid-label-bg-color);background-color:var(--md-mermaid-label-bg-color);opacity:1}.classLabel .label{fill:var(--md-mermaid-label-fg-color);font-family:var(--md-mermaid-font-family)}.node .divider{stroke:var(--md-mermaid-node-fg-color)}.relation{stroke:var(--md-mermaid-edge-color)}.cardinality{fill:var(--md-mermaid-label-fg-color);font-family:var(--md-mermaid-font-family)}.cardinality text{fill:inherit!important}defs #classDiagram-compositionEnd,defs #classDiagram-compositionStart,defs #classDiagram-dependencyEnd,defs #classDiagram-dependencyStart,defs #classDiagram-extensionEnd,defs #classDiagram-extensionStart{fill:var(--md-mermaid-edge-color)!important;stroke:var(--md-mermaid-edge-color)!important}defs #classDiagram-aggregationEnd,defs #classDiagram-aggregationStart{fill:var(--md-mermaid-label-bg-color)!important;stroke:var(--md-mermaid-edge-color)!important}g.stateGroup rect{fill:var(--md-mermaid-node-bg-color);stroke:var(--md-mermaid-node-fg-color)}g.stateGroup .state-title{fill:var(--md-mermaid-label-fg-color)!important;font-family:var(--md-mermaid-font-family)}g.stateGroup .composit{fill:var(--md-mermaid-label-bg-color)}.nodeLabel{color:var(--md-mermaid-label-fg-color);font-family:var(--md-mermaid-font-family)}.node circle.state-end,.node circle.state-start,.start-state{fill:var(--md-mermaid-edge-color);stroke:none}.end-state-inner,.end-state-outer{fill:var(--md-mermaid-edge-color)}.end-state-inner,.node circle.state-end{stroke:var(--md-mermaid-label-bg-color)}.transition{stroke:var(--md-mermaid-edge-color)}[id^=state-fork] rect,[id^=state-join] rect{fill:var(--md-mermaid-edge-color)!important;stroke:none!important}.statediagram-cluster.statediagram-cluster .inner{fill:var(--md-default-bg-color)}.statediagram-cluster rect{fill:var(--md-mermaid-node-bg-color);stroke:var(--md-mermaid-node-fg-color)}.statediagram-state rect.divider{fill:var(--md-default-fg-color--lightest);stroke:var(--md-default-fg-color--lighter)}defs #statediagram-barbEnd{stroke:var(--md-mermaid-edge-color)}.attributeBoxEven,.attributeBoxOdd{fill:var(--md-mermaid-node-bg-color);stroke:var(--md-mermaid-node-fg-color)}.entityBox{fill:var(--md-mermaid-label-bg-color);stroke:var(--md-mermaid-node-fg-color)}.entityLabel{fill:var(--md-mermaid-label-fg-color);font-family:var(--md-mermaid-font-family)}.relationshipLabelBox{fill:var(--md-mermaid-label-bg-color);fill-opacity:1;background-color:var(--md-mermaid-label-bg-color);opacity:1}.relationshipLabel{fill:var(--md-mermaid-label-fg-color)}.relationshipLine{stroke:var(--md-mermaid-edge-color)}defs #ONE_OR_MORE_END *,defs #ONE_OR_MORE_START *,defs #ONLY_ONE_END *,defs #ONLY_ONE_START *,defs #ZERO_OR_MORE_END *,defs #ZERO_OR_MORE_START *,defs #ZERO_OR_ONE_END *,defs #ZERO_OR_ONE_START *{stroke:var(--md-mermaid-edge-color)!important}defs #ZERO_OR_MORE_END circle,defs #ZERO_OR_MORE_START circle{fill:var(--md-mermaid-label-bg-color)}.actor{fill:var(--md-mermaid-sequence-actor-bg-color);stroke:var(--md-mermaid-sequence-actor-border-color)}text.actor>tspan{fill:var(--md-mermaid-sequence-actor-fg-color);font-family:var(--md-mermaid-font-family)}line{stroke:var(--md-mermaid-sequence-actor-line-color)}.actor-man circle,.actor-man line{fill:var(--md-mermaid-sequence-actorman-bg-color);stroke:var(--md-mermaid-sequence-actorman-line-color)}.messageLine0,.messageLine1{stroke:var(--md-mermaid-sequence-message-line-color)}.note{fill:var(--md-mermaid-sequence-note-bg-color);stroke:var(--md-mermaid-sequence-note-border-color)}.loopText,.loopText>tspan,.messageText,.noteText>tspan{stroke:none;font-family:var(--md-mermaid-font-family)!important}.messageText{fill:var(--md-mermaid-sequence-message-fg-color)}.loopText,.loopText>tspan{fill:var(--md-mermaid-sequence-loop-fg-color)}.noteText>tspan{fill:var(--md-mermaid-sequence-note-fg-color)}#arrowhead path{fill:var(--md-mermaid-sequence-message-line-color);stroke:none}.loopLine{fill:var(--md-mermaid-sequence-loop-bg-color);stroke:var(--md-mermaid-sequence-loop-border-color)}.labelBox{fill:var(--md-mermaid-sequence-label-bg-color);stroke:none}.labelText,.labelText>span{fill:var(--md-mermaid-sequence-label-fg-color);font-family:var(--md-mermaid-font-family)}.sequenceNumber{fill:var(--md-mermaid-sequence-number-fg-color)}rect.rect{fill:var(--md-mermaid-sequence-box-bg-color);stroke:none}rect.rect+text.text{fill:var(--md-mermaid-sequence-box-fg-color)}defs #sequencenumber{fill:var(--md-mermaid-sequence-number-bg-color)!important}";var eo,Ca=0;function ka(){return typeof mermaid=="undefined"||mermaid instanceof Element?wt("https://wpbrowser.wptestkit.dev/assets/external/unpkg.com/mermaid@9.4.3/dist/mermaid.min.js"):R(void 0)}function Rn(e){return e.classList.remove("mermaid"),eo||(eo=ka().pipe(T(()=>mermaid.initialize({startOnLoad:!1,themeCSS:$n,sequence:{actorFontSize:"16px",messageFontSize:"16px",noteFontSize:"16px"}})),m(()=>{}),J(1))),eo.subscribe(()=>{e.classList.add("mermaid");let t=`__mermaid_${Ca++}`,r=O("div",{class:"mermaid"}),o=e.textContent;mermaid.mermaidAPI.render(t,o,(n,i)=>{let a=r.attachShadow({mode:"closed"});a.innerHTML=n,e.replaceWith(r),i==null||i(a)})}),eo.pipe(m(()=>({ref:e})))}var Pn=O("table");function In(e){return e.replaceWith(Pn),Pn.replaceWith(wn(e)),R({ref:e})}function Ha(e){let t=e.find(r=>r.checked)||e[0];return w(...e.map(r=>h(r,"change").pipe(m(()=>F(`label[for="${r.id}"]`))))).pipe(z(F(`label[for="${t.id}"]`)),m(r=>({active:r})))}function Fn(e,{viewport$:t,target$:r}){let o=F(".tabbed-labels",e),n=$(":scope > input",e),i=Jr("prev");e.append(i);let a=Jr("next");return e.append(a),P(()=>{let s=new S,p=s.pipe(oe(),ae(!0));G([s,Ae(e)]).pipe(U(p),He(1,Oe)).subscribe({next([{active:c},l]){let f=ze(c),{width:u}=ve(c);e.style.setProperty("--md-indicator-x",`${f.x}px`),e.style.setProperty("--md-indicator-width",`${u}px`);let d=dr(o);(f.xd.x+l.width)&&o.scrollTo({left:Math.max(0,f.x-16),behavior:"smooth"})},complete(){e.style.removeProperty("--md-indicator-x"),e.style.removeProperty("--md-indicator-width")}}),G([it(o),Ae(o)]).pipe(U(p)).subscribe(([c,l])=>{let f=Tt(o);i.hidden=c.x<16,a.hidden=c.x>f.width-l.width-16}),w(h(i,"click").pipe(m(()=>-1)),h(a,"click").pipe(m(()=>1))).pipe(U(p)).subscribe(c=>{let{width:l}=ve(o);o.scrollBy({left:l*c,behavior:"smooth"})}),r.pipe(U(p),y(c=>n.includes(c))).subscribe(c=>c.click()),o.classList.add("tabbed-labels--linked");for(let c of n){let l=F(`label[for="${c.id}"]`);l.replaceChildren(O("a",{href:`#${l.htmlFor}`,tabIndex:-1},...Array.from(l.childNodes))),h(l.firstElementChild,"click").pipe(U(p),y(f=>!(f.metaKey||f.ctrlKey)),T(f=>{f.preventDefault(),f.stopPropagation()})).subscribe(()=>{history.replaceState({},"",`#${l.htmlFor}`),l.click()})}return X("content.tabs.link")&&s.pipe(Me(1),ie(t)).subscribe(([{active:c},{offset:l}])=>{let f=c.innerText.trim();if(c.hasAttribute("data-md-switching"))c.removeAttribute("data-md-switching");else{let u=e.offsetTop-l.y;for(let b of $("[data-tabs]"))for(let M of $(":scope > input",b)){let ee=F(`label[for="${M.id}"]`);if(ee!==c&&ee.innerText.trim()===f){ee.setAttribute("data-md-switching",""),M.click();break}}window.scrollTo({top:e.offsetTop-u});let d=__md_get("__tabs")||[];__md_set("__tabs",[...new Set([f,...d])])}}),s.pipe(U(p)).subscribe(()=>{for(let c of $("audio, video",e))c.pause()}),Ha(n).pipe(T(c=>s.next(c)),A(()=>s.complete()),m(c=>W({ref:e},c)))}).pipe(Ge(ce))}function jn(e,{viewport$:t,target$:r,print$:o}){return w(...$(".annotate:not(.highlight)",e).map(n=>Ln(n,{target$:r,print$:o})),...$("pre:not(.mermaid) > code",e).map(n=>kn(n,{target$:r,print$:o})),...$("pre.mermaid",e).map(n=>Rn(n)),...$("table:not([class])",e).map(n=>In(n)),...$("details",e).map(n=>Hn(n,{target$:r,print$:o})),...$("[data-tabs]",e).map(n=>Fn(n,{viewport$:t,target$:r})),...$("[title]",e).filter(()=>X("content.tooltips")).map(n=>Qe(n)))}function $a(e,{alert$:t}){return t.pipe(v(r=>w(R(!0),R(!1).pipe(Xe(2e3))).pipe(m(o=>({message:r,active:o})))))}function Wn(e,t){let r=F(".md-typeset",e);return P(()=>{let o=new S;return o.subscribe(({message:n,active:i})=>{e.classList.toggle("md-dialog--active",i),r.textContent=n}),$a(e,t).pipe(T(n=>o.next(n)),A(()=>o.complete()),m(n=>W({ref:e},n)))})}function Ra({viewport$:e}){if(!X("header.autohide"))return R(!1);let t=e.pipe(m(({offset:{y:n}})=>n),Fe(2,1),m(([n,i])=>[nMath.abs(i-n.y)>100),m(([,[n]])=>n),Z()),o=qe("search");return G([e,o]).pipe(m(([{offset:n},i])=>n.y>400&&!i),Z(),v(n=>n?r:R(!1)),z(!1))}function Un(e,t){return P(()=>G([Ae(e),Ra(t)])).pipe(m(([{height:r},o])=>({height:r,hidden:o})),Z((r,o)=>r.height===o.height&&r.hidden===o.hidden),J(1))}function Nn(e,{header$:t,main$:r}){return P(()=>{let o=new S,n=o.pipe(oe(),ae(!0));o.pipe(ne("active"),nt(t)).subscribe(([{active:a},{hidden:s}])=>{e.classList.toggle("md-header--shadow",a&&!s),e.hidden=s});let i=pe($("[title]",e)).pipe(y(()=>X("content.tooltips")),te(a=>Qe(a)));return r.subscribe(o),t.pipe(U(n),m(a=>W({ref:e},a)),Ue(i.pipe(U(n))))})}function Pa(e,{viewport$:t,header$:r}){return gr(e,{viewport$:t,header$:r}).pipe(m(({offset:{y:o}})=>{let{height:n}=ve(e);return{active:o>=n}}),ne("active"))}function Dn(e,t){return P(()=>{let r=new S;r.subscribe({next({active:n}){e.classList.toggle("md-header__title--active",n)},complete(){e.classList.remove("md-header__title--active")}});let o=fe(".md-content h1");return typeof o=="undefined"?E:Pa(o,t).pipe(T(n=>r.next(n)),A(()=>r.complete()),m(n=>W({ref:e},n)))})}function Vn(e,{viewport$:t,header$:r}){let o=r.pipe(m(({height:i})=>i),Z()),n=o.pipe(v(()=>Ae(e).pipe(m(({height:i})=>({top:e.offsetTop,bottom:e.offsetTop+i})),ne("bottom"))));return G([o,n,t]).pipe(m(([i,{top:a,bottom:s},{offset:{y:p},size:{height:c}}])=>(c=Math.max(0,c-Math.max(0,a-p,i)-Math.max(0,c+p-s)),{offset:a-i,height:c,active:a-i<=p})),Z((i,a)=>i.offset===a.offset&&i.height===a.height&&i.active===a.active))}function Ia(e){let t=__md_get("__palette")||{index:e.findIndex(r=>matchMedia(r.getAttribute("data-md-color-media")).matches)};return R(...e).pipe(te(r=>h(r,"change").pipe(m(()=>r))),z(e[Math.max(0,t.index)]),m(r=>({index:e.indexOf(r),color:{media:r.getAttribute("data-md-color-media"),scheme:r.getAttribute("data-md-color-scheme"),primary:r.getAttribute("data-md-color-primary"),accent:r.getAttribute("data-md-color-accent")}})),J(1))}function zn(e){let t=$("input",e),r=O("meta",{name:"theme-color"});document.head.appendChild(r);let o=O("meta",{name:"color-scheme"});document.head.appendChild(o);let n=It("(prefers-color-scheme: light)");return P(()=>{let i=new S;return i.subscribe(a=>{if(document.body.setAttribute("data-md-color-switching",""),a.color.media==="(prefers-color-scheme)"){let s=matchMedia("(prefers-color-scheme: light)"),p=document.querySelector(s.matches?"[data-md-color-media='(prefers-color-scheme: light)']":"[data-md-color-media='(prefers-color-scheme: dark)']");a.color.scheme=p.getAttribute("data-md-color-scheme"),a.color.primary=p.getAttribute("data-md-color-primary"),a.color.accent=p.getAttribute("data-md-color-accent")}for(let[s,p]of Object.entries(a.color))document.body.setAttribute(`data-md-color-${s}`,p);for(let s=0;s{let a=Ce("header"),s=window.getComputedStyle(a);return o.content=s.colorScheme,s.backgroundColor.match(/\d+/g).map(p=>(+p).toString(16).padStart(2,"0")).join("")})).subscribe(a=>r.content=`#${a}`),i.pipe(ke(ce)).subscribe(()=>{document.body.removeAttribute("data-md-color-switching")}),Ia(t).pipe(U(n.pipe(Me(1))),mt(),T(a=>i.next(a)),A(()=>i.complete()),m(a=>W({ref:e},a)))})}var to=qt(Zr());function Fa(e){e.setAttribute("data-md-copying","");let t=e.innerText;return e.removeAttribute("data-md-copying"),t}function qn({alert$:e}){to.default.isSupported()&&new V(t=>{new to.default("[data-clipboard-target], [data-clipboard-text]",{text:r=>r.getAttribute("data-clipboard-text")||Fa(F(r.getAttribute("data-clipboard-target")))}).on("success",r=>t.next(r))}).pipe(T(t=>{t.trigger.focus()}),m(()=>Le("clipboard.copied"))).subscribe(e)}function ja(e){if(e.length<2)return[""];let[t,r]=[...e].sort((n,i)=>n.length-i.length).map(n=>n.replace(/[^/]+$/,"")),o=0;if(t===r)o=t.length;else for(;t.charCodeAt(o)===r.charCodeAt(o);)o++;return e.map(n=>n.replace(t.slice(0,o),""))}function yr(e){let t=__md_get("__sitemap",sessionStorage,e);if(t)return R(t);{let r=ge();return sn(new URL("sitemap.xml",e||r.base)).pipe(m(o=>ja($("loc",o).map(n=>n.textContent))),xe(()=>E),je([]),T(o=>__md_set("__sitemap",o,sessionStorage,e)))}}function Kn(e,t){if(!(e.target instanceof Element))return E;let r=e.target.closest("a");if(r===null)return E;if(r.target||e.metaKey||e.ctrlKey)return E;let o=new URL(r.href);return o.search=o.hash="",t.includes(`${o}`)?(e.preventDefault(),R(new URL(r.href))):E}function Qn({location$:e,viewport$:t}){let r=ge();if(location.protocol==="file:")return E;let o=yr().pipe(m(c=>c.map(l=>`${new URL(l,r.base)}`))),n=h(document.body,"click").pipe(ie(o),v(([c,l])=>Kn(c,l)),be());X("navigation.instant.prefetch")&&w(h(document.body,"mousemove"),h(document.body,"focusin")).pipe(ie(o),v(([c,l])=>Kn(c,l)),ye(25),Nr(({href:c})=>c),fr(c=>{let l=document.createElement("link");return l.rel="prefetch",l.href=c.toString(),document.head.appendChild(l),h(l,"load").pipe(m(()=>l),he(1))})).subscribe(c=>c.remove()),n.pipe(he(1)).subscribe(()=>{let c=fe("link[rel=icon]");typeof c!="undefined"&&(c.href=c.href)}),h(window,"beforeunload").subscribe(()=>{history.scrollRestoration="auto"}),n.pipe(ie(t)).subscribe(([c,{offset:l}])=>{history.scrollRestoration="manual",history.replaceState(l,""),history.pushState(null,"",c)}),n.subscribe(e);let i=e.pipe(z(Ee()),ne("pathname"),Me(1),v(c=>vr(c).pipe(xe(()=>(ft(c),E))))),a=new DOMParser,s=i.pipe(v(c=>c.text()),v(c=>{let l=a.parseFromString(c,"text/html");for(let u of["title","link[rel=canonical]","meta[name=author]","meta[name=description]","[data-md-component=announce]","[data-md-component=container]","[data-md-component=header-topic]","[data-md-component=outdated]","[data-md-component=logo]","[data-md-component=skip]",...X("navigation.tabs.sticky")?["[data-md-component=tabs]"]:[]]){let d=fe(u),b=fe(u,l);typeof d!="undefined"&&typeof b!="undefined"&&d.replaceWith(b)}let f=Ce("container");return Ve($("script",f)).pipe(v(u=>{let d=l.createElement("script");if(u.src){for(let b of u.getAttributeNames())d.setAttribute(b,u.getAttribute(b));return u.replaceWith(d),new V(b=>{d.onload=()=>b.complete()})}else return d.textContent=u.textContent,u.replaceWith(d),E}),oe(),ae(l))}),be());return h(window,"popstate").pipe(m(Ee)).subscribe(e),e.pipe(z(Ee()),Fe(2,1),v(([c,l])=>c.pathname===l.pathname&&c.hash!==l.hash?R(l):E)).subscribe(c=>{var l,f;history.state!==null||!c.hash?window.scrollTo(0,(f=(l=history.state)==null?void 0:l.y)!=null?f:0):(history.scrollRestoration="auto",Qr(c.hash),history.scrollRestoration="manual")}),s.pipe(ie(e)).subscribe(([,c])=>{var l,f;history.state!==null||!c.hash?window.scrollTo(0,(f=(l=history.state)==null?void 0:l.y)!=null?f:0):Qr(c.hash)}),s.pipe(v(()=>t),ne("offset"),ye(100)).subscribe(({offset:c})=>{history.replaceState(c,"")}),s}var Gn=qt(Bn());function Jn(e){let t=e.separator.split("|").map(n=>n.replace(/(\(\?[!=<][^)]+\))/g,"").length===0?"\uFFFD":n).join("|"),r=new RegExp(t,"img"),o=(n,i,a)=>`${i}${a}`;return n=>{n=n.replace(/[\s*+\-:~^]+/g," ").trim();let i=new RegExp(`(^|${e.separator}|)(${n.replace(/[|\\{}()[\]^$+*?.-]/g,"\\$&").replace(r,"|")})`,"img");return a=>(0,Gn.default)(a).replace(i,o).replace(/<\/mark>(\s+)]*>/img,"$1")}}function Wt(e){return e.type===1}function Er(e){return e.type===3}function Xn(e,t){let r=un(e);return w(R(location.protocol!=="file:"),qe("search")).pipe(We(o=>o),v(()=>t)).subscribe(({config:o,docs:n})=>r.next({type:0,data:{config:o,docs:n,options:{suggest:X("search.suggest")}}})),r}function Zn({document$:e}){let t=ge(),r=Ke(new URL("../versions.json",t.base)).pipe(xe(()=>E)),o=r.pipe(m(n=>{let[,i]=t.base.match(/([^/]+)\/?$/);return n.find(({version:a,aliases:s})=>a===i||s.includes(i))||n[0]}));r.pipe(m(n=>new Map(n.map(i=>[`${new URL(`../${i.version}/`,t.base)}`,i]))),v(n=>h(document.body,"click").pipe(y(i=>!i.metaKey&&!i.ctrlKey),ie(o),v(([i,a])=>{if(i.target instanceof Element){let s=i.target.closest("a");if(s&&!s.target&&n.has(s.href)){let p=s.href;return!i.target.closest(".md-version")&&n.get(p)===a?E:(i.preventDefault(),R(p))}}return E}),v(i=>{let{version:a}=n.get(i);return yr(new URL(i)).pipe(m(s=>{let c=Ee().href.replace(t.base,"");return s.includes(c.split("#")[0])?new URL(`../${a}/${c}`,t.base):new URL(i)}))})))).subscribe(n=>ft(n)),G([r,o]).subscribe(([n,i])=>{F(".md-header__topic").appendChild(Tn(n,i))}),e.pipe(v(()=>o)).subscribe(n=>{var a;let i=__md_get("__outdated",sessionStorage);if(i===null){i=!0;let s=((a=t.version)==null?void 0:a.default)||"latest";Array.isArray(s)||(s=[s]);e:for(let p of s)for(let c of n.aliases)if(new RegExp(p,"i").test(c)){i=!1;break e}__md_set("__outdated",i,sessionStorage)}if(i)for(let s of le("outdated"))s.hidden=!1})}function Va(e,{worker$:t}){let{searchParams:r}=Ee();r.has("q")&&(Ze("search",!0),e.value=r.get("q"),e.focus(),qe("search").pipe(We(i=>!i)).subscribe(()=>{let i=new URL(location.href);i.searchParams.delete("q"),history.replaceState({},"",`${i}`)}));let o=Et(e),n=w(t.pipe(We(Wt)),h(e,"keyup"),o).pipe(m(()=>e.value),Z());return G([n,o]).pipe(m(([i,a])=>({value:i,focus:a})),J(1))}function ei(e,{worker$:t}){let r=new S,o=r.pipe(oe(),ae(!0));G([t.pipe(We(Wt)),r],(i,a)=>a).pipe(ne("value")).subscribe(({value:i})=>t.next({type:2,data:i})),r.pipe(ne("focus")).subscribe(({focus:i})=>{i&&Ze("search",i)}),h(e.form,"reset").pipe(U(o)).subscribe(()=>e.focus());let n=F("header [for=__search]");return h(n,"click").subscribe(()=>e.focus()),Va(e,{worker$:t}).pipe(T(i=>r.next(i)),A(()=>r.complete()),m(i=>W({ref:e},i)),J(1))}function ti(e,{worker$:t,query$:r}){let o=new S,n=Zo(e.parentElement).pipe(y(Boolean)),i=e.parentElement,a=F(":scope > :first-child",e),s=F(":scope > :last-child",e);qe("search").subscribe(l=>s.setAttribute("role",l?"list":"presentation")),o.pipe(ie(r),zr(t.pipe(We(Wt)))).subscribe(([{items:l},{value:f}])=>{switch(l.length){case 0:a.textContent=f.length?Le("search.result.none"):Le("search.result.placeholder");break;case 1:a.textContent=Le("search.result.one");break;default:let u=hr(l.length);a.textContent=Le("search.result.other",u)}});let p=o.pipe(T(()=>s.innerHTML=""),v(({items:l})=>w(R(...l.slice(0,10)),R(...l.slice(10)).pipe(Fe(4),Kr(n),v(([f])=>f)))),m(yn),be());return p.subscribe(l=>s.appendChild(l)),p.pipe(te(l=>{let f=fe("details",l);return typeof f=="undefined"?E:h(f,"toggle").pipe(U(o),m(()=>f))})).subscribe(l=>{l.open===!1&&l.offsetTop<=i.scrollTop&&i.scrollTo({top:l.offsetTop})}),t.pipe(y(Er),m(({data:l})=>l)).pipe(T(l=>o.next(l)),A(()=>o.complete()),m(l=>W({ref:e},l)))}function za(e,{query$:t}){return t.pipe(m(({value:r})=>{let o=Ee();return o.hash="",r=r.replace(/\s+/g,"+").replace(/&/g,"%26").replace(/=/g,"%3D"),o.search=`q=${r}`,{url:o}}))}function ri(e,t){let r=new S,o=r.pipe(oe(),ae(!0));return r.subscribe(({url:n})=>{e.setAttribute("data-clipboard-text",e.href),e.href=`${n}`}),h(e,"click").pipe(U(o)).subscribe(n=>n.preventDefault()),za(e,t).pipe(T(n=>r.next(n)),A(()=>r.complete()),m(n=>W({ref:e},n)))}function oi(e,{worker$:t,keyboard$:r}){let o=new S,n=Ce("search-query"),i=w(h(n,"keydown"),h(n,"focus")).pipe(ke(ce),m(()=>n.value),Z());return o.pipe(nt(i),m(([{suggest:s},p])=>{let c=p.split(/([\s-]+)/);if(s!=null&&s.length&&c[c.length-1]){let l=s[s.length-1];l.startsWith(c[c.length-1])&&(c[c.length-1]=l)}else c.length=0;return c})).subscribe(s=>e.innerHTML=s.join("").replace(/\s/g," ")),r.pipe(y(({mode:s})=>s==="search")).subscribe(s=>{switch(s.type){case"ArrowRight":e.innerText.length&&n.selectionStart===n.value.length&&(n.value=e.innerText);break}}),t.pipe(y(Er),m(({data:s})=>s)).pipe(T(s=>o.next(s)),A(()=>o.complete()),m(()=>({ref:e})))}function ni(e,{index$:t,keyboard$:r}){let o=ge();try{let n=Xn(o.search,t),i=Ce("search-query",e),a=Ce("search-result",e);h(e,"click").pipe(y(({target:p})=>p instanceof Element&&!!p.closest("a"))).subscribe(()=>Ze("search",!1)),r.pipe(y(({mode:p})=>p==="search")).subscribe(p=>{let c=Ne();switch(p.type){case"Enter":if(c===i){let l=new Map;for(let f of $(":first-child [href]",a)){let u=f.firstElementChild;l.set(f,parseFloat(u.getAttribute("data-md-score")))}if(l.size){let[[f]]=[...l].sort(([,u],[,d])=>d-u);f.click()}p.claim()}break;case"Escape":case"Tab":Ze("search",!1),i.blur();break;case"ArrowUp":case"ArrowDown":if(typeof c=="undefined")i.focus();else{let l=[i,...$(":not(details) > [href], summary, details[open] [href]",a)],f=Math.max(0,(Math.max(0,l.indexOf(c))+l.length+(p.type==="ArrowUp"?-1:1))%l.length);l[f].focus()}p.claim();break;default:i!==Ne()&&i.focus()}}),r.pipe(y(({mode:p})=>p==="global")).subscribe(p=>{switch(p.type){case"f":case"s":case"/":i.focus(),i.select(),p.claim();break}});let s=ei(i,{worker$:n});return w(s,ti(a,{worker$:n,query$:s})).pipe(Ue(...le("search-share",e).map(p=>ri(p,{query$:s})),...le("search-suggest",e).map(p=>oi(p,{worker$:n,keyboard$:r}))))}catch(n){return e.hidden=!0,Je}}function ii(e,{index$:t,location$:r}){return G([t,r.pipe(z(Ee()),y(o=>!!o.searchParams.get("h")))]).pipe(m(([o,n])=>Jn(o.config)(n.searchParams.get("h"))),m(o=>{var a;let n=new Map,i=document.createNodeIterator(e,NodeFilter.SHOW_TEXT);for(let s=i.nextNode();s;s=i.nextNode())if((a=s.parentElement)!=null&&a.offsetHeight){let p=s.textContent,c=o(p);c.length>p.length&&n.set(s,c)}for(let[s,p]of n){let{childNodes:c}=O("span",null,p);s.replaceWith(...Array.from(c))}return{ref:e,nodes:n}}))}function qa(e,{viewport$:t,main$:r}){let o=e.closest(".md-grid"),n=o.offsetTop-o.parentElement.offsetTop;return G([r,t]).pipe(m(([{offset:i,height:a},{offset:{y:s}}])=>(a=a+Math.min(n,Math.max(0,s-i))-n,{height:a,locked:s>=i+n})),Z((i,a)=>i.height===a.height&&i.locked===a.locked))}function ro(e,o){var n=o,{header$:t}=n,r=co(n,["header$"]);let i=F(".md-sidebar__scrollwrap",e),{y:a}=ze(i);return P(()=>{let s=new S,p=s.pipe(oe(),ae(!0)),c=s.pipe(He(0,Oe));return c.pipe(ie(t)).subscribe({next([{height:l},{height:f}]){i.style.height=`${l-2*a}px`,e.style.top=`${f}px`},complete(){i.style.height="",e.style.top=""}}),c.pipe(We()).subscribe(()=>{for(let l of $(".md-nav__link--active[href]",e)){let f=St(l);if(typeof f!="undefined"){let u=l.offsetTop-f.offsetTop,{height:d}=ve(f);f.scrollTo({top:u-d/2})}}}),pe($("label[tabindex]",e)).pipe(te(l=>h(l,"click").pipe(m(()=>l),U(p)))).subscribe(l=>{let f=F(`[id="${l.htmlFor}"]`);F(`[aria-labelledby="${l.id}"]`).setAttribute("aria-expanded",`${f.checked}`)}),qa(e,r).pipe(T(l=>s.next(l)),A(()=>s.complete()),m(l=>W({ref:e},l)))})}function ai(e,t){if(typeof t!="undefined"){let r=`https://api.github.com/repos/${e}/${t}`;return $t(Ke(`${r}/releases/latest`).pipe(xe(()=>E),m(o=>({version:o.tag_name})),je({})),Ke(r).pipe(xe(()=>E),m(o=>({stars:o.stargazers_count,forks:o.forks_count})),je({}))).pipe(m(([o,n])=>W(W({},o),n)))}else{let r=`https://api.github.com/users/${e}`;return Ke(r).pipe(m(o=>({repositories:o.public_repos})),je({}))}}function si(e,t){let r=`https://${e}/api/v4/projects/${encodeURIComponent(t)}`;return Ke(r).pipe(xe(()=>E),m(({star_count:o,forks_count:n})=>({stars:o,forks:n})),je({}))}function ci(e){let t=e.match(/^.+github\.com\/([^/]+)\/?([^/]+)?/i);if(t){let[,r,o]=t;return ai(r,o)}if(t=e.match(/^.+?([^/]*gitlab[^/]+)\/(.+?)\/?$/i),t){let[,r,o]=t;return si(r,o)}return E}var Ka;function Qa(e){return Ka||(Ka=P(()=>{let t=__md_get("__source",sessionStorage);if(t)return R(t);if(le("consent").length){let o=__md_get("__consent");if(!(o&&o.github))return E}return ci(e.href).pipe(T(o=>__md_set("__source",o,sessionStorage)))}).pipe(xe(()=>E),y(t=>Object.keys(t).length>0),m(t=>({facts:t})),J(1)))}function pi(e){let t=F(":scope > :last-child",e);return P(()=>{let r=new S;return r.subscribe(({facts:o})=>{t.appendChild(En(o)),t.classList.add("md-source__repository--active")}),Qa(e).pipe(T(o=>r.next(o)),A(()=>r.complete()),m(o=>W({ref:e},o)))})}function Ya(e,{viewport$:t,header$:r}){return Ae(document.body).pipe(v(()=>gr(e,{header$:r,viewport$:t})),m(({offset:{y:o}})=>({hidden:o>=10})),ne("hidden"))}function li(e,t){return P(()=>{let r=new S;return r.subscribe({next({hidden:o}){e.hidden=o},complete(){e.hidden=!1}}),(X("navigation.tabs.sticky")?R({hidden:!1}):Ya(e,t)).pipe(T(o=>r.next(o)),A(()=>r.complete()),m(o=>W({ref:e},o)))})}function Ba(e,{viewport$:t,header$:r}){let o=new Map,n=$("[href^=\\#]",e);for(let s of n){let p=decodeURIComponent(s.hash.substring(1)),c=fe(`[id="${p}"]`);typeof c!="undefined"&&o.set(s,c)}let i=r.pipe(ne("height"),m(({height:s})=>{let p=Ce("main"),c=F(":scope > :first-child",p);return s+.8*(c.offsetTop-p.offsetTop)}),be());return Ae(document.body).pipe(ne("height"),v(s=>P(()=>{let p=[];return R([...o].reduce((c,[l,f])=>{for(;p.length&&o.get(p[p.length-1]).tagName>=f.tagName;)p.pop();let u=f.offsetTop;for(;!u&&f.parentElement;)f=f.parentElement,u=f.offsetTop;let d=f.offsetParent;for(;d;d=d.offsetParent)u+=d.offsetTop;return c.set([...p=[...p,l]].reverse(),u)},new Map))}).pipe(m(p=>new Map([...p].sort(([,c],[,l])=>c-l))),nt(i),v(([p,c])=>t.pipe(Rt(([l,f],{offset:{y:u},size:d})=>{let b=u+d.height>=Math.floor(s.height);for(;f.length;){let[,M]=f[0];if(M-c=u&&!b)f=[l.pop(),...f];else break}return[l,f]},[[],[...p]]),Z((l,f)=>l[0]===f[0]&&l[1]===f[1])))))).pipe(m(([s,p])=>({prev:s.map(([c])=>c),next:p.map(([c])=>c)})),z({prev:[],next:[]}),Fe(2,1),m(([s,p])=>s.prev.length{let i=new S,a=i.pipe(oe(),ae(!0));if(i.subscribe(({prev:s,next:p})=>{for(let[c]of p)c.classList.remove("md-nav__link--passed"),c.classList.remove("md-nav__link--active");for(let[c,[l]]of s.entries())l.classList.add("md-nav__link--passed"),l.classList.toggle("md-nav__link--active",c===s.length-1)}),X("toc.follow")){let s=w(t.pipe(ye(1),m(()=>{})),t.pipe(ye(250),m(()=>"smooth")));i.pipe(y(({prev:p})=>p.length>0),nt(o.pipe(ke(ce))),ie(s)).subscribe(([[{prev:p}],c])=>{let[l]=p[p.length-1];if(l.offsetHeight){let f=St(l);if(typeof f!="undefined"){let u=l.offsetTop-f.offsetTop,{height:d}=ve(f);f.scrollTo({top:u-d/2,behavior:c})}}})}return X("navigation.tracking")&&t.pipe(U(a),ne("offset"),ye(250),Me(1),U(n.pipe(Me(1))),mt({delay:250}),ie(i)).subscribe(([,{prev:s}])=>{let p=Ee(),c=s[s.length-1];if(c&&c.length){let[l]=c,{hash:f}=new URL(l.href);p.hash!==f&&(p.hash=f,history.replaceState({},"",`${p}`))}else p.hash="",history.replaceState({},"",`${p}`)}),Ba(e,{viewport$:t,header$:r}).pipe(T(s=>i.next(s)),A(()=>i.complete()),m(s=>W({ref:e},s)))})}function Ga(e,{viewport$:t,main$:r,target$:o}){let n=t.pipe(m(({offset:{y:a}})=>a),Fe(2,1),m(([a,s])=>a>s&&s>0),Z()),i=r.pipe(m(({active:a})=>a));return G([i,n]).pipe(m(([a,s])=>!(a&&s)),Z(),U(o.pipe(Me(1))),ae(!0),mt({delay:250}),m(a=>({hidden:a})))}function fi(e,{viewport$:t,header$:r,main$:o,target$:n}){let i=new S,a=i.pipe(oe(),ae(!0));return i.subscribe({next({hidden:s}){e.hidden=s,s?(e.setAttribute("tabindex","-1"),e.blur()):e.removeAttribute("tabindex")},complete(){e.style.top="",e.hidden=!0,e.removeAttribute("tabindex")}}),r.pipe(U(a),ne("height")).subscribe(({height:s})=>{e.style.top=`${s+16}px`}),h(e,"click").subscribe(s=>{s.preventDefault(),window.scrollTo({top:0})}),Ga(e,{viewport$:t,main$:o,target$:n}).pipe(T(s=>i.next(s)),A(()=>i.complete()),m(s=>W({ref:e},s)))}function ui({document$:e}){e.pipe(v(()=>$(".md-ellipsis")),te(t=>Ot(t).pipe(U(e.pipe(Me(1))),y(r=>r),m(()=>t),he(1))),y(t=>t.offsetWidth{let r=t.innerText,o=t.closest("a")||t;return o.title=r,Qe(o).pipe(U(e.pipe(Me(1))),A(()=>o.removeAttribute("title")))})).subscribe(),e.pipe(v(()=>$(".md-status")),te(t=>Qe(t))).subscribe()}function di({document$:e,tablet$:t}){e.pipe(v(()=>$(".md-toggle--indeterminate")),T(r=>{r.indeterminate=!0,r.checked=!1}),te(r=>h(r,"change").pipe(qr(()=>r.classList.contains("md-toggle--indeterminate")),m(()=>r))),ie(t)).subscribe(([r,o])=>{r.classList.remove("md-toggle--indeterminate"),o&&(r.checked=!1)})}function Ja(){return/(iPad|iPhone|iPod)/.test(navigator.userAgent)}function hi({document$:e}){e.pipe(v(()=>$("[data-md-scrollfix]")),T(t=>t.removeAttribute("data-md-scrollfix")),y(Ja),te(t=>h(t,"touchstart").pipe(m(()=>t)))).subscribe(t=>{let r=t.scrollTop;r===0?t.scrollTop=1:r+t.offsetHeight===t.scrollHeight&&(t.scrollTop=r-1)})}function bi({viewport$:e,tablet$:t}){G([qe("search"),t]).pipe(m(([r,o])=>r&&!o),v(r=>R(r).pipe(Xe(r?400:100))),ie(e)).subscribe(([r,{offset:{y:o}}])=>{if(r)document.body.setAttribute("data-md-scrolllock",""),document.body.style.top=`-${o}px`;else{let n=-1*parseInt(document.body.style.top,10);document.body.removeAttribute("data-md-scrolllock"),document.body.style.top="",n&&window.scrollTo(0,n)}})}Object.entries||(Object.entries=function(e){let t=[];for(let r of Object.keys(e))t.push([r,e[r]]);return t});Object.values||(Object.values=function(e){let t=[];for(let r of Object.keys(e))t.push(e[r]);return t});typeof Element!="undefined"&&(Element.prototype.scrollTo||(Element.prototype.scrollTo=function(e,t){typeof e=="object"?(this.scrollLeft=e.left,this.scrollTop=e.top):(this.scrollLeft=e,this.scrollTop=t)}),Element.prototype.replaceWith||(Element.prototype.replaceWith=function(...e){let t=this.parentNode;if(t){e.length===0&&t.removeChild(this);for(let r=e.length-1;r>=0;r--){let o=e[r];typeof o=="string"?o=document.createTextNode(o):o.parentNode&&o.parentNode.removeChild(o),r?t.insertBefore(this.previousSibling,o):t.replaceChild(o,this)}}}));function Xa(){return location.protocol==="file:"?wt(`${new URL("search/search_index.js",oo.base)}`).pipe(m(()=>__index),J(1)):Ke(new URL("search/search_index.json",oo.base))}document.documentElement.classList.remove("no-js");document.documentElement.classList.add("js");var st=Yo(),Nt=rn(),Lt=nn(Nt),no=tn(),$e=fn(),wr=It("(min-width: 960px)"),gi=It("(min-width: 1220px)"),xi=an(),oo=ge(),yi=document.forms.namedItem("search")?Xa():Je,io=new S;qn({alert$:io});X("navigation.instant")&&Qn({location$:Nt,viewport$:$e}).subscribe(st);var vi;((vi=oo.version)==null?void 0:vi.provider)==="mike"&&Zn({document$:st});w(Nt,Lt).pipe(Xe(125)).subscribe(()=>{Ze("drawer",!1),Ze("search",!1)});no.pipe(y(({mode:e})=>e==="global")).subscribe(e=>{switch(e.type){case"p":case",":let t=fe("link[rel=prev]");typeof t!="undefined"&&ft(t);break;case"n":case".":let r=fe("link[rel=next]");typeof r!="undefined"&&ft(r);break;case"Enter":let o=Ne();o instanceof HTMLLabelElement&&o.click()}});ui({document$:st});di({document$:st,tablet$:wr});hi({document$:st});bi({viewport$:$e,tablet$:wr});var at=Un(Ce("header"),{viewport$:$e}),Ut=st.pipe(m(()=>Ce("main")),v(e=>Vn(e,{viewport$:$e,header$:at})),J(1)),Za=w(...le("consent").map(e=>hn(e,{target$:Lt})),...le("dialog").map(e=>Wn(e,{alert$:io})),...le("header").map(e=>Nn(e,{viewport$:$e,header$:at,main$:Ut})),...le("palette").map(e=>zn(e)),...le("search").map(e=>ni(e,{index$:yi,keyboard$:no})),...le("source").map(e=>pi(e))),es=P(()=>w(...le("announce").map(e=>dn(e)),...le("content").map(e=>jn(e,{viewport$:$e,target$:Lt,print$:xi})),...le("content").map(e=>X("search.highlight")?ii(e,{index$:yi,location$:Nt}):E),...le("header-title").map(e=>Dn(e,{viewport$:$e,header$:at})),...le("sidebar").map(e=>e.getAttribute("data-md-type")==="navigation"?Br(gi,()=>ro(e,{viewport$:$e,header$:at,main$:Ut})):Br(wr,()=>ro(e,{viewport$:$e,header$:at,main$:Ut}))),...le("tabs").map(e=>li(e,{viewport$:$e,header$:at})),...le("toc").map(e=>mi(e,{viewport$:$e,header$:at,main$:Ut,target$:Lt})),...le("top").map(e=>fi(e,{viewport$:$e,header$:at,main$:Ut,target$:Lt})))),Ei=st.pipe(v(()=>es),Ue(Za),J(1));Ei.subscribe();window.document$=st;window.location$=Nt;window.target$=Lt;window.keyboard$=no;window.viewport$=$e;window.tablet$=wr;window.screen$=gi;window.print$=xi;window.alert$=io;window.component$=Ei;})(); diff --git a/docs/public/assets/javascripts/lunr/min/lunr.ar.min.js b/docs/assets/javascripts/lunr/min/lunr.ar.min.js similarity index 100% rename from docs/public/assets/javascripts/lunr/min/lunr.ar.min.js rename to docs/assets/javascripts/lunr/min/lunr.ar.min.js diff --git a/docs/public/assets/javascripts/lunr/min/lunr.da.min.js b/docs/assets/javascripts/lunr/min/lunr.da.min.js similarity index 91% rename from docs/public/assets/javascripts/lunr/min/lunr.da.min.js rename to docs/assets/javascripts/lunr/min/lunr.da.min.js index b3a1c771e..b9d850986 100644 --- a/docs/public/assets/javascripts/lunr/min/lunr.da.min.js +++ b/docs/assets/javascripts/lunr/min/lunr.da.min.js @@ -15,4 +15,4 @@ * http://www.mozilla.org/MPL/ */ -!function(e,r){"function"==typeof define&&define.amd?define(r):"object"==typeof exports?module.exports=r():r()(e.lunr)}(this,function(){return function(e){if(void 0===e)throw new Error("Lunr is not present. Please include / require Lunr before this script.");if(void 0===e.stemmerSupport)throw new Error("Lunr stemmer support is not present. Please include / require Lunr stemmer support before this script.");e.da=function(){this.pipeline.reset(),this.pipeline.add(e.da.trimmer,e.da.stopWordFilter,e.da.stemmer),this.searchPipeline&&(this.searchPipeline.reset(),this.searchPipeline.add(e.da.stemmer))},e.da.wordCharacters="A-Za-zªºÀ-ÖØ-öø-ʸˠ-ˤᴀ-ᴥᴬ-ᵜᵢ-ᵥᵫ-ᵷᵹ-ᶾḀ-ỿⁱⁿₐ-ₜKÅℲⅎⅠ-ↈⱠ-ⱿꜢ-ꞇꞋ-ꞭꞰ-ꞷꟷ-ꟿꬰ-ꭚꭜ-ꭤff-stA-Za-z",e.da.trimmer=e.trimmerSupport.generateTrimmer(e.da.wordCharacters),e.Pipeline.registerFunction(e.da.trimmer,"trimmer-da"),e.da.stemmer=function(){var r=e.stemmerSupport.Among,i=e.stemmerSupport.SnowballProgram,n=new function(){function e(){var e,r=f.cursor+3;if(d=f.limit,0<=r&&r<=f.limit){for(a=r;;){if(e=f.cursor,f.in_grouping(w,97,248)){f.cursor=e;break}if(f.cursor=e,e>=f.limit)return;f.cursor++}for(;!f.out_grouping(w,97,248);){if(f.cursor>=f.limit)return;f.cursor++}d=f.cursor,d=d&&(r=f.limit_backward,f.limit_backward=d,f.ket=f.cursor,e=f.find_among_b(c,32),f.limit_backward=r,e))switch(f.bra=f.cursor,e){case 1:f.slice_del();break;case 2:f.in_grouping_b(p,97,229)&&f.slice_del()}}function t(){var e,r=f.limit-f.cursor;f.cursor>=d&&(e=f.limit_backward,f.limit_backward=d,f.ket=f.cursor,f.find_among_b(l,4)?(f.bra=f.cursor,f.limit_backward=e,f.cursor=f.limit-r,f.cursor>f.limit_backward&&(f.cursor--,f.bra=f.cursor,f.slice_del())):f.limit_backward=e)}function s(){var e,r,i,n=f.limit-f.cursor;if(f.ket=f.cursor,f.eq_s_b(2,"st")&&(f.bra=f.cursor,f.eq_s_b(2,"ig")&&f.slice_del()),f.cursor=f.limit-n,f.cursor>=d&&(r=f.limit_backward,f.limit_backward=d,f.ket=f.cursor,e=f.find_among_b(m,5),f.limit_backward=r,e))switch(f.bra=f.cursor,e){case 1:f.slice_del(),i=f.limit-f.cursor,t(),f.cursor=f.limit-i;break;case 2:f.slice_from("løs")}}function o(){var e;f.cursor>=d&&(e=f.limit_backward,f.limit_backward=d,f.ket=f.cursor,f.out_grouping_b(w,97,248)?(f.bra=f.cursor,u=f.slice_to(u),f.limit_backward=e,f.eq_v_b(u)&&f.slice_del()):f.limit_backward=e)}var a,d,u,c=[new r("hed",-1,1),new r("ethed",0,1),new r("ered",-1,1),new r("e",-1,1),new r("erede",3,1),new r("end",3,1),new r("erende",5,1),new r("ene",3,1),new r("erne",3,1),new r("ere",3,1),new r("en",-1,1),new r("heden",10,1),new r("eren",10,1),new r("er",-1,1),new r("header",13,1),new r("erer",13,1),new r("s",-1,2),new r("heds",16,1),new r("es",16,1),new r("endes",18,1),new r("erendes",19,1),new r("enes",18,1),new r("ernes",18,1),new r("eres",18,1),new r("ens",16,1),new r("hedens",24,1),new r("erens",24,1),new r("ers",16,1),new r("ets",16,1),new r("erets",28,1),new r("et",-1,1),new r("eret",30,1)],l=[new r("gd",-1,-1),new r("dt",-1,-1),new r("gt",-1,-1),new r("kt",-1,-1)],m=[new r("ig",-1,1),new r("lig",0,1),new r("elig",1,1),new r("els",-1,1),new r("løst",-1,2)],w=[17,65,16,1,0,0,0,0,0,0,0,0,0,0,0,0,48,0,128],p=[239,254,42,3,0,0,0,0,0,0,0,0,0,0,0,0,16],f=new i;this.setCurrent=function(e){f.setCurrent(e)},this.getCurrent=function(){return f.getCurrent()},this.stem=function(){var r=f.cursor;return e(),f.limit_backward=r,f.cursor=f.limit,n(),f.cursor=f.limit,t(),f.cursor=f.limit,s(),f.cursor=f.limit,o(),!0}};return function(e){return"function"==typeof e.update?e.update(function(e){return n.setCurrent(e),n.stem(),n.getCurrent()}):(n.setCurrent(e),n.stem(),n.getCurrent())}}(),e.Pipeline.registerFunction(e.da.stemmer,"stemmer-da"),e.da.stopWordFilter=e.generateStopWordFilter("ad af alle alt anden at blev blive bliver da de dem den denne der deres det dette dig din disse dog du efter eller en end er et for fra ham han hans har havde have hende hendes her hos hun hvad hvis hvor i ikke ind jeg jer jo kunne man mange med meget men mig min mine mit mod ned noget nogle nu når og også om op os over på self sig sin sine sit skal skulle some sådan thi til ud under var vi vil ville vor være været".split(" ")),e.Pipeline.registerFunction(e.da.stopWordFilter,"stopWordFilter-da")}}); \ No newline at end of file +!function(e,r){"function"==typeof define&&define.amd?define(r):"object"==typeof exports?module.exports=r():r()(e.lunr)}(this,function(){return function(e){if(void 0===e)throw new Error("Lunr is not present. Please include / require Lunr before this script.");if(void 0===e.stemmerSupport)throw new Error("Lunr stemmer support is not present. Please include / require Lunr stemmer support before this script.");e.da=function(){this.pipeline.reset(),this.pipeline.add(e.da.trimmer,e.da.stopWordFilter,e.da.stemmer),this.searchPipeline&&(this.searchPipeline.reset(),this.searchPipeline.add(e.da.stemmer))},e.da.wordCharacters="A-Za-zªºÀ-ÖØ-öø-ʸˠ-ˤᴀ-ᴥᴬ-ᵜᵢ-ᵥᵫ-ᵷᵹ-ᶾḀ-ỿⁱⁿₐ-ₜKÅℲⅎⅠ-ↈⱠ-ⱿꜢ-ꞇꞋ-ꞭꞰ-ꞷꟷ-ꟿꬰ-ꭚꭜ-ꭤff-stA-Za-z",e.da.trimmer=e.trimmerSupport.generateTrimmer(e.da.wordCharacters),e.Pipeline.registerFunction(e.da.trimmer,"trimmer-da"),e.da.stemmer=function(){var r=e.stemmerSupport.Among,i=e.stemmerSupport.SnowballProgram,n=new function(){function e(){var e,r=f.cursor+3;if(d=f.limit,0<=r&&r<=f.limit){for(a=r;;){if(e=f.cursor,f.in_grouping(w,97,248)){f.cursor=e;break}if(f.cursor=e,e>=f.limit)return;f.cursor++}for(;!f.out_grouping(w,97,248);){if(f.cursor>=f.limit)return;f.cursor++}d=f.cursor,d=d&&(r=f.limit_backward,f.limit_backward=d,f.ket=f.cursor,e=f.find_among_b(c,32),f.limit_backward=r,e))switch(f.bra=f.cursor,e){case 1:f.slice_del();break;case 2:f.in_grouping_b(p,97,229)&&f.slice_del()}}function t(){var e,r=f.limit-f.cursor;f.cursor>=d&&(e=f.limit_backward,f.limit_backward=d,f.ket=f.cursor,f.find_among_b(l,4)?(f.bra=f.cursor,f.limit_backward=e,f.cursor=f.limit-r,f.cursor>f.limit_backward&&(f.cursor--,f.bra=f.cursor,f.slice_del())):f.limit_backward=e)}function s(){var e,r,i,n=f.limit-f.cursor;if(f.ket=f.cursor,f.eq_s_b(2,"st")&&(f.bra=f.cursor,f.eq_s_b(2,"ig")&&f.slice_del()),f.cursor=f.limit-n,f.cursor>=d&&(r=f.limit_backward,f.limit_backward=d,f.ket=f.cursor,e=f.find_among_b(m,5),f.limit_backward=r,e))switch(f.bra=f.cursor,e){case 1:f.slice_del(),i=f.limit-f.cursor,t(),f.cursor=f.limit-i;break;case 2:f.slice_from("løs")}}function o(){var e;f.cursor>=d&&(e=f.limit_backward,f.limit_backward=d,f.ket=f.cursor,f.out_grouping_b(w,97,248)?(f.bra=f.cursor,u=f.slice_to(u),f.limit_backward=e,f.eq_v_b(u)&&f.slice_del()):f.limit_backward=e)}var a,d,u,c=[new r("hed",-1,1),new r("ethed",0,1),new r("ered",-1,1),new r("e",-1,1),new r("erede",3,1),new r("ende",3,1),new r("erende",5,1),new r("ene",3,1),new r("erne",3,1),new r("ere",3,1),new r("en",-1,1),new r("heden",10,1),new r("eren",10,1),new r("er",-1,1),new r("heder",13,1),new r("erer",13,1),new r("s",-1,2),new r("heds",16,1),new r("es",16,1),new r("endes",18,1),new r("erendes",19,1),new r("enes",18,1),new r("ernes",18,1),new r("eres",18,1),new r("ens",16,1),new r("hedens",24,1),new r("erens",24,1),new r("ers",16,1),new r("ets",16,1),new r("erets",28,1),new r("et",-1,1),new r("eret",30,1)],l=[new r("gd",-1,-1),new r("dt",-1,-1),new r("gt",-1,-1),new r("kt",-1,-1)],m=[new r("ig",-1,1),new r("lig",0,1),new r("elig",1,1),new r("els",-1,1),new r("løst",-1,2)],w=[17,65,16,1,0,0,0,0,0,0,0,0,0,0,0,0,48,0,128],p=[239,254,42,3,0,0,0,0,0,0,0,0,0,0,0,0,16],f=new i;this.setCurrent=function(e){f.setCurrent(e)},this.getCurrent=function(){return f.getCurrent()},this.stem=function(){var r=f.cursor;return e(),f.limit_backward=r,f.cursor=f.limit,n(),f.cursor=f.limit,t(),f.cursor=f.limit,s(),f.cursor=f.limit,o(),!0}};return function(e){return"function"==typeof e.update?e.update(function(e){return n.setCurrent(e),n.stem(),n.getCurrent()}):(n.setCurrent(e),n.stem(),n.getCurrent())}}(),e.Pipeline.registerFunction(e.da.stemmer,"stemmer-da"),e.da.stopWordFilter=e.generateStopWordFilter("ad af alle alt anden at blev blive bliver da de dem den denne der deres det dette dig din disse dog du efter eller en end er et for fra ham han hans har havde have hende hendes her hos hun hvad hvis hvor i ikke ind jeg jer jo kunne man mange med meget men mig min mine mit mod ned noget nogle nu når og også om op os over på selv sig sin sine sit skal skulle som sådan thi til ud under var vi vil ville vor være været".split(" ")),e.Pipeline.registerFunction(e.da.stopWordFilter,"stopWordFilter-da")}}); \ No newline at end of file diff --git a/docs/public/assets/javascripts/lunr/min/lunr.de.min.js b/docs/assets/javascripts/lunr/min/lunr.de.min.js similarity index 76% rename from docs/public/assets/javascripts/lunr/min/lunr.de.min.js rename to docs/assets/javascripts/lunr/min/lunr.de.min.js index 1f30b283d..f3b5c108c 100644 --- a/docs/public/assets/javascripts/lunr/min/lunr.de.min.js +++ b/docs/assets/javascripts/lunr/min/lunr.de.min.js @@ -15,4 +15,4 @@ * http://www.mozilla.org/MPL/ */ -!function(e,r){"function"==typeof define&&define.amd?define(r):"object"==typeof exports?module.exports=r():r()(e.lunr)}(this,function(){return function(e){if(void 0===e)throw new Error("Lunr is not present. Please include / require Lunr before this script.");if(void 0===e.stemmerSupport)throw new Error("Lunr stemmer support is not present. Please include / require Lunr stemmer support before this script.");e.de=function(){this.pipeline.reset(),this.pipeline.add(e.de.trimmer,e.de.stopWordFilter,e.de.stemmer),this.searchPipeline&&(this.searchPipeline.reset(),this.searchPipeline.add(e.de.stemmer))},e.de.wordCharacters="A-Za-zªºÀ-ÖØ-öø-ʸˠ-ˤᴀ-ᴥᴬ-ᵜᵢ-ᵥᵫ-ᵷᵹ-ᶾḀ-ỿⁱⁿₐ-ₜKÅℲⅎⅠ-ↈⱠ-ⱿꜢ-ꞇꞋ-ꞭꞰ-ꞷꟷ-ꟿꬰ-ꭚꭜ-ꭤff-stA-Za-z",e.de.trimmer=e.trimmerSupport.generateTrimmer(e.de.wordCharacters),e.Pipeline.registerFunction(e.de.trimmer,"trimmer-de"),e.de.stemmer=function(){var r=e.stemmerSupport.Among,n=e.stemmerSupport.SnowballProgram,i=new function(){function e(e,r,n){return!(!v.eq_s(1,e)||(v.ket=v.cursor,!v.in_grouping(p,97,252)))&&(v.slice_from(r),v.cursor=n,!0)}function i(){for(var r,n,i,s,t=v.cursor;;)if(r=v.cursor,v.bra=r,v.eq_s(1,"ß"))v.ket=v.cursor,v.slice_from("ss");else{if(r>=v.limit)break;v.cursor=r+1}for(v.cursor=t;;)for(n=v.cursor;;){if(i=v.cursor,v.in_grouping(p,97,252)){if(s=v.cursor,v.bra=s,e("u","U",i))break;if(v.cursor=s,e("y","Y",i))break}if(i>=v.limit)return void(v.cursor=n);v.cursor=i+1}}function s(){for(;!v.in_grouping(p,97,252);){if(v.cursor>=v.limit)return!0;v.cursor++}for(;!v.out_grouping(p,97,252);){if(v.cursor>=v.limit)return!0;v.cursor++}return!1}function t(){m=v.limit,l=m;var e=v.cursor+3;0<=e&&e<=v.limit&&(d=e,s()||(m=v.cursor,m=v.limit)return;v.cursor++}}}function c(){return m<=v.cursor}function u(){return l<=v.cursor}function a(){var e,r,n,i,s=v.limit-v.cursor;if(v.ket=v.cursor,(e=v.find_among_b(w,7))&&(v.bra=v.cursor,c()))switch(e){case 1:v.slice_del();break;case 2:v.slice_del(),v.ket=v.cursor,v.eq_s_b(1,"s")&&(v.bra=v.cursor,v.eq_s_b(3,"nis")&&v.slice_del());break;case 3:v.in_grouping_b(g,98,116)&&v.slice_del()}if(v.cursor=v.limit-s,v.ket=v.cursor,(e=v.find_among_b(f,4))&&(v.bra=v.cursor,c()))switch(e){case 1:v.slice_del();break;case 2:if(v.in_grouping_b(k,98,116)){var t=v.cursor-3;v.limit_backward<=t&&t<=v.limit&&(v.cursor=t,v.slice_del())}}if(v.cursor=v.limit-s,v.ket=v.cursor,(e=v.find_among_b(_,8))&&(v.bra=v.cursor,u()))switch(e){case 1:v.slice_del(),v.ket=v.cursor,v.eq_s_b(2,"ig")&&(v.bra=v.cursor,r=v.limit-v.cursor,v.eq_s_b(1,"e")||(v.cursor=v.limit-r,u()&&v.slice_del()));break;case 2:n=v.limit-v.cursor,v.eq_s_b(1,"e")||(v.cursor=v.limit-n,v.slice_del());break;case 3:if(v.slice_del(),v.ket=v.cursor,i=v.limit-v.cursor,!v.eq_s_b(2,"er")&&(v.cursor=v.limit-i,!v.eq_s_b(2,"en")))break;v.bra=v.cursor,c()&&v.slice_del();break;case 4:v.slice_del(),v.ket=v.cursor,e=v.find_among_b(b,2),e&&(v.bra=v.cursor,u()&&1==e&&v.slice_del())}}var d,l,m,h=[new r("",-1,6),new r("U",0,2),new r("Y",0,1),new r("ä",0,3),new r("ö",0,4),new r("ü",0,5)],w=[new r("e",-1,2),new r("em",-1,1),new r("en",-1,2),new r("ern",-1,1),new r("er",-1,1),new r("s",-1,3),new r("es",5,2)],f=[new r("en",-1,1),new r("er",-1,1),new r("st",-1,2),new r("est",2,1)],b=[new r("ig",-1,1),new r("lich",-1,1)],_=[new r("end",-1,1),new r("ig",-1,2),new r("ung",-1,1),new r("lich",-1,3),new r("isch",-1,2),new r("ik",-1,2),new r("heit",-1,3),new r("keit",-1,4)],p=[17,65,16,1,0,0,0,0,0,0,0,0,0,0,0,0,8,0,32,8],g=[117,30,5],k=[117,30,4],v=new n;this.setCurrent=function(e){v.setCurrent(e)},this.getCurrent=function(){return v.getCurrent()},this.stem=function(){var e=v.cursor;return i(),v.cursor=e,t(),v.limit_backward=e,v.cursor=v.limit,a(),v.cursor=v.limit_backward,o(),!0}};return function(e){return"function"==typeof e.update?e.update(function(e){return i.setCurrent(e),i.stem(),i.getCurrent()}):(i.setCurrent(e),i.stem(),i.getCurrent())}}(),e.Pipeline.registerFunction(e.de.stemmer,"stemmer-de"),e.de.stopWordFilter=e.generateStopWordFilter("aber alle allem allen aller alles also also am an ander andere anderem anderen anderer anderes anderm andern anderr anders auch auf aus bei bin bis bist da damit dann das dasselbe dazu daß dein define deinem deinen deiner deines dem demselben den denn denselben der derer derselbe derselben des desselben dessen dich die dies diese dieselbe dieselben diesem diesen dieser dieses dir doch dort du durch ein eine einem einen einer eines einig einige einigem einigen einiger einiges einmal er es etwas euch euer eure eurem euren eurer eures für gegen gewesen hab habe haben hat hatte hatten hier hin hinter ich ihm ihn ihnen ihr ihre ihrem ihren ihrer ihres im in indem ins ist jede jedem jeden jeder jedes jene jenem jenen jener jenes jetzt kann kein keine keinem keinen keiner keines können könnte machen man manche manchem manchen mancher manches mein meine meinem meinen meiner meines mich mir mit muss musste nach nicht nichts noch nun nur ob oder ohne sehr sein seine seinem seinen seiner seines selbst sich sie sind so solche solchem solchen solcher solches soll sollte sondern sonst um und uns unse unsem unsen unser unses under viel vom von vor war waren warst was weg weil weiter welche welchem welchen welcher welches wenn werde werden wie wieder will wir wird wirst wo wollen wollte während würde würden zu zum zur zwar zwischen über".split(" ")),e.Pipeline.registerFunction(e.de.stopWordFilter,"stopWordFilter-de")}}); \ No newline at end of file +!function(e,r){"function"==typeof define&&define.amd?define(r):"object"==typeof exports?module.exports=r():r()(e.lunr)}(this,function(){return function(e){if(void 0===e)throw new Error("Lunr is not present. Please include / require Lunr before this script.");if(void 0===e.stemmerSupport)throw new Error("Lunr stemmer support is not present. Please include / require Lunr stemmer support before this script.");e.de=function(){this.pipeline.reset(),this.pipeline.add(e.de.trimmer,e.de.stopWordFilter,e.de.stemmer),this.searchPipeline&&(this.searchPipeline.reset(),this.searchPipeline.add(e.de.stemmer))},e.de.wordCharacters="A-Za-zªºÀ-ÖØ-öø-ʸˠ-ˤᴀ-ᴥᴬ-ᵜᵢ-ᵥᵫ-ᵷᵹ-ᶾḀ-ỿⁱⁿₐ-ₜKÅℲⅎⅠ-ↈⱠ-ⱿꜢ-ꞇꞋ-ꞭꞰ-ꞷꟷ-ꟿꬰ-ꭚꭜ-ꭤff-stA-Za-z",e.de.trimmer=e.trimmerSupport.generateTrimmer(e.de.wordCharacters),e.Pipeline.registerFunction(e.de.trimmer,"trimmer-de"),e.de.stemmer=function(){var r=e.stemmerSupport.Among,n=e.stemmerSupport.SnowballProgram,i=new function(){function e(e,r,n){return!(!v.eq_s(1,e)||(v.ket=v.cursor,!v.in_grouping(p,97,252)))&&(v.slice_from(r),v.cursor=n,!0)}function i(){for(var r,n,i,s,t=v.cursor;;)if(r=v.cursor,v.bra=r,v.eq_s(1,"ß"))v.ket=v.cursor,v.slice_from("ss");else{if(r>=v.limit)break;v.cursor=r+1}for(v.cursor=t;;)for(n=v.cursor;;){if(i=v.cursor,v.in_grouping(p,97,252)){if(s=v.cursor,v.bra=s,e("u","U",i))break;if(v.cursor=s,e("y","Y",i))break}if(i>=v.limit)return void(v.cursor=n);v.cursor=i+1}}function s(){for(;!v.in_grouping(p,97,252);){if(v.cursor>=v.limit)return!0;v.cursor++}for(;!v.out_grouping(p,97,252);){if(v.cursor>=v.limit)return!0;v.cursor++}return!1}function t(){m=v.limit,l=m;var e=v.cursor+3;0<=e&&e<=v.limit&&(d=e,s()||(m=v.cursor,m=v.limit)return;v.cursor++}}}function c(){return m<=v.cursor}function u(){return l<=v.cursor}function a(){var e,r,n,i,s=v.limit-v.cursor;if(v.ket=v.cursor,(e=v.find_among_b(w,7))&&(v.bra=v.cursor,c()))switch(e){case 1:v.slice_del();break;case 2:v.slice_del(),v.ket=v.cursor,v.eq_s_b(1,"s")&&(v.bra=v.cursor,v.eq_s_b(3,"nis")&&v.slice_del());break;case 3:v.in_grouping_b(g,98,116)&&v.slice_del()}if(v.cursor=v.limit-s,v.ket=v.cursor,(e=v.find_among_b(f,4))&&(v.bra=v.cursor,c()))switch(e){case 1:v.slice_del();break;case 2:if(v.in_grouping_b(k,98,116)){var t=v.cursor-3;v.limit_backward<=t&&t<=v.limit&&(v.cursor=t,v.slice_del())}}if(v.cursor=v.limit-s,v.ket=v.cursor,(e=v.find_among_b(_,8))&&(v.bra=v.cursor,u()))switch(e){case 1:v.slice_del(),v.ket=v.cursor,v.eq_s_b(2,"ig")&&(v.bra=v.cursor,r=v.limit-v.cursor,v.eq_s_b(1,"e")||(v.cursor=v.limit-r,u()&&v.slice_del()));break;case 2:n=v.limit-v.cursor,v.eq_s_b(1,"e")||(v.cursor=v.limit-n,v.slice_del());break;case 3:if(v.slice_del(),v.ket=v.cursor,i=v.limit-v.cursor,!v.eq_s_b(2,"er")&&(v.cursor=v.limit-i,!v.eq_s_b(2,"en")))break;v.bra=v.cursor,c()&&v.slice_del();break;case 4:v.slice_del(),v.ket=v.cursor,e=v.find_among_b(b,2),e&&(v.bra=v.cursor,u()&&1==e&&v.slice_del())}}var d,l,m,h=[new r("",-1,6),new r("U",0,2),new r("Y",0,1),new r("ä",0,3),new r("ö",0,4),new r("ü",0,5)],w=[new r("e",-1,2),new r("em",-1,1),new r("en",-1,2),new r("ern",-1,1),new r("er",-1,1),new r("s",-1,3),new r("es",5,2)],f=[new r("en",-1,1),new r("er",-1,1),new r("st",-1,2),new r("est",2,1)],b=[new r("ig",-1,1),new r("lich",-1,1)],_=[new r("end",-1,1),new r("ig",-1,2),new r("ung",-1,1),new r("lich",-1,3),new r("isch",-1,2),new r("ik",-1,2),new r("heit",-1,3),new r("keit",-1,4)],p=[17,65,16,1,0,0,0,0,0,0,0,0,0,0,0,0,8,0,32,8],g=[117,30,5],k=[117,30,4],v=new n;this.setCurrent=function(e){v.setCurrent(e)},this.getCurrent=function(){return v.getCurrent()},this.stem=function(){var e=v.cursor;return i(),v.cursor=e,t(),v.limit_backward=e,v.cursor=v.limit,a(),v.cursor=v.limit_backward,o(),!0}};return function(e){return"function"==typeof e.update?e.update(function(e){return i.setCurrent(e),i.stem(),i.getCurrent()}):(i.setCurrent(e),i.stem(),i.getCurrent())}}(),e.Pipeline.registerFunction(e.de.stemmer,"stemmer-de"),e.de.stopWordFilter=e.generateStopWordFilter("aber alle allem allen aller alles als also am an ander andere anderem anderen anderer anderes anderm andern anderr anders auch auf aus bei bin bis bist da damit dann das dasselbe dazu daß dein deine deinem deinen deiner deines dem demselben den denn denselben der derer derselbe derselben des desselben dessen dich die dies diese dieselbe dieselben diesem diesen dieser dieses dir doch dort du durch ein eine einem einen einer eines einig einige einigem einigen einiger einiges einmal er es etwas euch euer eure eurem euren eurer eures für gegen gewesen hab habe haben hat hatte hatten hier hin hinter ich ihm ihn ihnen ihr ihre ihrem ihren ihrer ihres im in indem ins ist jede jedem jeden jeder jedes jene jenem jenen jener jenes jetzt kann kein keine keinem keinen keiner keines können könnte machen man manche manchem manchen mancher manches mein meine meinem meinen meiner meines mich mir mit muss musste nach nicht nichts noch nun nur ob oder ohne sehr sein seine seinem seinen seiner seines selbst sich sie sind so solche solchem solchen solcher solches soll sollte sondern sonst um und uns unse unsem unsen unser unses unter viel vom von vor war waren warst was weg weil weiter welche welchem welchen welcher welches wenn werde werden wie wieder will wir wird wirst wo wollen wollte während würde würden zu zum zur zwar zwischen über".split(" ")),e.Pipeline.registerFunction(e.de.stopWordFilter,"stopWordFilter-de")}}); \ No newline at end of file diff --git a/docs/public/assets/javascripts/lunr/min/lunr.du.min.js b/docs/assets/javascripts/lunr/min/lunr.du.min.js similarity index 91% rename from docs/public/assets/javascripts/lunr/min/lunr.du.min.js rename to docs/assets/javascripts/lunr/min/lunr.du.min.js index a5ce50f5c..49a0f3f0a 100644 --- a/docs/public/assets/javascripts/lunr/min/lunr.du.min.js +++ b/docs/assets/javascripts/lunr/min/lunr.du.min.js @@ -15,4 +15,4 @@ * http://www.mozilla.org/MPL/ */ -!function(e,r){"function"==typeof define&&define.amd?define(r):"object"==typeof exports?module.exports=r():r()(e.lunr)}(this,function(){return function(e){if(void 0===e)throw new Error("Lunr is not present. Please include / require Lunr before this script.");if(void 0===e.stemmerSupport)throw new Error("Lunr stemmer support is not present. Please include / require Lunr stemmer support before this script.");console.warn('[Lunr Languages] Please use the "nl" instead of the "du". The "nl" code is the standard code for Dutch language, and "du" will be removed in the next major versions.'),e.du=function(){this.pipeline.reset(),this.pipeline.add(e.du.trimmer,e.du.stopWordFilter,e.du.stemmer),this.searchPipeline&&(this.searchPipeline.reset(),this.searchPipeline.add(e.du.stemmer))},e.du.wordCharacters="A-Za-zªºÀ-ÖØ-öø-ʸˠ-ˤᴀ-ᴥᴬ-ᵜᵢ-ᵥᵫ-ᵷᵹ-ᶾḀ-ỿⁱⁿₐ-ₜKÅℲⅎⅠ-ↈⱠ-ⱿꜢ-ꞇꞋ-ꞭꞰ-ꞷꟷ-ꟿꬰ-ꭚꭜ-ꭤff-stA-Za-z",e.du.trimmer=e.trimmerSupport.generateTrimmer(e.du.wordCharacters),e.Pipeline.registerFunction(e.du.trimmer,"trimmer-du"),e.du.stemmer=function(){var r=e.stemmerSupport.Among,i=e.stemmerSupport.SnowballProgram,n=new function(){function e(){for(var e,r,i,o=C.cursor;;){if(C.bra=C.cursor,e=C.find_among(b,11))switch(C.ket=C.cursor,e){case 1:C.slice_from("a");continue;case 2:C.slice_from("e");continue;case 3:C.slice_from("i");continue;case 4:C.slice_from("o");continue;case 5:C.slice_from("u");continue;case 6:if(C.cursor>=C.limit)break;C.cursor++;continue}break}for(C.cursor=o,C.bra=o,C.eq_s(1,"y")?(C.ket=C.cursor,C.slice_from("Y")):C.cursor=o;;)if(r=C.cursor,C.in_grouping(q,97,232)){if(i=C.cursor,C.bra=i,C.eq_s(1,"i"))C.ket=C.cursor,C.in_grouping(q,97,232)&&(C.slice_from("I"),C.cursor=r);else if(C.cursor=i,C.eq_s(1,"y"))C.ket=C.cursor,C.slice_from("Y"),C.cursor=r;else if(n(r))break}else if(n(r))break}function n(e){return C.cursor=e,e>=C.limit||(C.cursor++,!1)}function o(){_=C.limit,f=_,t()||(_=C.cursor,_<3&&(_=3),t()||(f=C.cursor))}function t(){for(;!C.in_grouping(q,97,232);){if(C.cursor>=C.limit)return!0;C.cursor++}for(;!C.out_grouping(q,97,232);){if(C.cursor>=C.limit)return!0;C.cursor++}return!1}function s(){for(var e;;)if(C.bra=C.cursor,e=C.find_among(p,3))switch(C.ket=C.cursor,e){case 1:C.slice_from("y");break;case 2:C.slice_from("i");break;case 3:if(C.cursor>=C.limit)return;C.cursor++}}function u(){return _<=C.cursor}function c(){return f<=C.cursor}function a(){var e=C.limit-C.cursor;C.find_among_b(g,3)&&(C.cursor=C.limit-e,C.ket=C.cursor,C.cursor>C.limit_backward&&(C.cursor--,C.bra=C.cursor,C.slice_del()))}function l(){var e;w=!1,C.ket=C.cursor,C.eq_s_b(1,"e")&&(C.bra=C.cursor,u()&&(e=C.limit-C.cursor,C.out_grouping_b(q,97,232)&&(C.cursor=C.limit-e,C.slice_del(),w=!0,a())))}function m(){var e;u()&&(e=C.limit-C.cursor,C.out_grouping_b(q,97,232)&&(C.cursor=C.limit-e,C.eq_s_b(3,"gem")||(C.cursor=C.limit-e,C.slice_del(),a())))}function d(){var e,r,i,n,o,t,s=C.limit-C.cursor;if(C.ket=C.cursor,e=C.find_among_b(h,5))switch(C.bra=C.cursor,e){case 1:u()&&C.slice_from("heid");break;case 2:m();break;case 3:u()&&C.out_grouping_b(z,97,232)&&C.slice_del()}if(C.cursor=C.limit-s,l(),C.cursor=C.limit-s,C.ket=C.cursor,C.eq_s_b(4,"heid")&&(C.bra=C.cursor,c()&&(r=C.limit-C.cursor,C.eq_s_b(1,"c")||(C.cursor=C.limit-r,C.slice_del(),C.ket=C.cursor,C.eq_s_b(2,"en")&&(C.bra=C.cursor,m())))),C.cursor=C.limit-s,C.ket=C.cursor,e=C.find_among_b(k,6))switch(C.bra=C.cursor,e){case 1:if(c()){if(C.slice_del(),i=C.limit-C.cursor,C.ket=C.cursor,C.eq_s_b(2,"ig")&&(C.bra=C.cursor,c()&&(n=C.limit-C.cursor,!C.eq_s_b(1,"e")))){C.cursor=C.limit-n,C.slice_del();break}C.cursor=C.limit-i,a()}break;case 2:c()&&(o=C.limit-C.cursor,C.eq_s_b(1,"e")||(C.cursor=C.limit-o,C.slice_del()));break;case 3:c()&&(C.slice_del(),l());break;case 4:c()&&C.slice_del();break;case 5:c()&&w&&C.slice_del()}C.cursor=C.limit-s,C.out_grouping_b(j,73,232)&&(t=C.limit-C.cursor,C.find_among_b(v,4)&&C.out_grouping_b(q,97,232)&&(C.cursor=C.limit-t,C.ket=C.cursor,C.cursor>C.limit_backward&&(C.cursor--,C.bra=C.cursor,C.slice_del())))}var f,_,w,b=[new r("",-1,6),new r("á",0,1),new r("ä",0,1),new r("é",0,2),new r("ë",0,2),new r("í",0,3),new r("ï",0,3),new r("ó",0,4),new r("ö",0,4),new r("ú",0,5),new r("ü",0,5)],p=[new r("",-1,3),new r("I",0,2),new r("Y",0,1)],g=[new r("dd",-1,-1),new r("kk",-1,-1),new r("tt",-1,-1)],h=[new r("ene",-1,2),new r("se",-1,3),new r("en",-1,2),new r("heden",2,1),new r("s",-1,3)],k=[new r("end",-1,1),new r("ig",-1,2),new r("ing",-1,1),new r("lijk",-1,3),new r("baar",-1,4),new r("bar",-1,5)],v=[new r("aa",-1,-1),new r("ee",-1,-1),new r("oo",-1,-1),new r("uu",-1,-1)],q=[17,65,16,1,0,0,0,0,0,0,0,0,0,0,0,0,128],j=[1,0,0,17,65,16,1,0,0,0,0,0,0,0,0,0,0,0,0,128],z=[17,67,16,1,0,0,0,0,0,0,0,0,0,0,0,0,128],C=new i;this.setCurrent=function(e){C.setCurrent(e)},this.getCurrent=function(){return C.getCurrent()},this.stem=function(){var r=C.cursor;return e(),C.cursor=r,o(),C.limit_backward=r,C.cursor=C.limit,d(),C.cursor=C.limit_backward,s(),!0}};return function(e){return"function"==typeof e.update?e.update(function(e){return n.setCurrent(e),n.stem(),n.getCurrent()}):(n.setCurrent(e),n.stem(),n.getCurrent())}}(),e.Pipeline.registerFunction(e.du.stemmer,"stemmer-du"),e.du.stopWordFilter=e.generateStopWordFilter(" aan al alles also altijd andere ben bij daar dan dat de der deze die dit doch doen door dus een eens en er ge geen geweest haar had heb hebben heeft hem het hier hij hoe hun iemand iets ik in is ja je kan kon kunnen maar me meer men met mij mijn moet na naar niet niets nog nu of om omdat onder ons ook op over reeds te tegen toch toen tot u uit uw van veel voor want waren was wat werd wezen wie wil worden wordt zal ze zelf zich zij zijn zo zonder zou".split(" ")),e.Pipeline.registerFunction(e.du.stopWordFilter,"stopWordFilter-du")}}); \ No newline at end of file +!function(e,r){"function"==typeof define&&define.amd?define(r):"object"==typeof exports?module.exports=r():r()(e.lunr)}(this,function(){return function(e){if(void 0===e)throw new Error("Lunr is not present. Please include / require Lunr before this script.");if(void 0===e.stemmerSupport)throw new Error("Lunr stemmer support is not present. Please include / require Lunr stemmer support before this script.");console.warn('[Lunr Languages] Please use the "nl" instead of the "du". The "nl" code is the standard code for Dutch language, and "du" will be removed in the next major versions.'),e.du=function(){this.pipeline.reset(),this.pipeline.add(e.du.trimmer,e.du.stopWordFilter,e.du.stemmer),this.searchPipeline&&(this.searchPipeline.reset(),this.searchPipeline.add(e.du.stemmer))},e.du.wordCharacters="A-Za-zªºÀ-ÖØ-öø-ʸˠ-ˤᴀ-ᴥᴬ-ᵜᵢ-ᵥᵫ-ᵷᵹ-ᶾḀ-ỿⁱⁿₐ-ₜKÅℲⅎⅠ-ↈⱠ-ⱿꜢ-ꞇꞋ-ꞭꞰ-ꞷꟷ-ꟿꬰ-ꭚꭜ-ꭤff-stA-Za-z",e.du.trimmer=e.trimmerSupport.generateTrimmer(e.du.wordCharacters),e.Pipeline.registerFunction(e.du.trimmer,"trimmer-du"),e.du.stemmer=function(){var r=e.stemmerSupport.Among,i=e.stemmerSupport.SnowballProgram,n=new function(){function e(){for(var e,r,i,o=C.cursor;;){if(C.bra=C.cursor,e=C.find_among(b,11))switch(C.ket=C.cursor,e){case 1:C.slice_from("a");continue;case 2:C.slice_from("e");continue;case 3:C.slice_from("i");continue;case 4:C.slice_from("o");continue;case 5:C.slice_from("u");continue;case 6:if(C.cursor>=C.limit)break;C.cursor++;continue}break}for(C.cursor=o,C.bra=o,C.eq_s(1,"y")?(C.ket=C.cursor,C.slice_from("Y")):C.cursor=o;;)if(r=C.cursor,C.in_grouping(q,97,232)){if(i=C.cursor,C.bra=i,C.eq_s(1,"i"))C.ket=C.cursor,C.in_grouping(q,97,232)&&(C.slice_from("I"),C.cursor=r);else if(C.cursor=i,C.eq_s(1,"y"))C.ket=C.cursor,C.slice_from("Y"),C.cursor=r;else if(n(r))break}else if(n(r))break}function n(e){return C.cursor=e,e>=C.limit||(C.cursor++,!1)}function o(){_=C.limit,f=_,t()||(_=C.cursor,_<3&&(_=3),t()||(f=C.cursor))}function t(){for(;!C.in_grouping(q,97,232);){if(C.cursor>=C.limit)return!0;C.cursor++}for(;!C.out_grouping(q,97,232);){if(C.cursor>=C.limit)return!0;C.cursor++}return!1}function s(){for(var e;;)if(C.bra=C.cursor,e=C.find_among(p,3))switch(C.ket=C.cursor,e){case 1:C.slice_from("y");break;case 2:C.slice_from("i");break;case 3:if(C.cursor>=C.limit)return;C.cursor++}}function u(){return _<=C.cursor}function c(){return f<=C.cursor}function a(){var e=C.limit-C.cursor;C.find_among_b(g,3)&&(C.cursor=C.limit-e,C.ket=C.cursor,C.cursor>C.limit_backward&&(C.cursor--,C.bra=C.cursor,C.slice_del()))}function l(){var e;w=!1,C.ket=C.cursor,C.eq_s_b(1,"e")&&(C.bra=C.cursor,u()&&(e=C.limit-C.cursor,C.out_grouping_b(q,97,232)&&(C.cursor=C.limit-e,C.slice_del(),w=!0,a())))}function m(){var e;u()&&(e=C.limit-C.cursor,C.out_grouping_b(q,97,232)&&(C.cursor=C.limit-e,C.eq_s_b(3,"gem")||(C.cursor=C.limit-e,C.slice_del(),a())))}function d(){var e,r,i,n,o,t,s=C.limit-C.cursor;if(C.ket=C.cursor,e=C.find_among_b(h,5))switch(C.bra=C.cursor,e){case 1:u()&&C.slice_from("heid");break;case 2:m();break;case 3:u()&&C.out_grouping_b(z,97,232)&&C.slice_del()}if(C.cursor=C.limit-s,l(),C.cursor=C.limit-s,C.ket=C.cursor,C.eq_s_b(4,"heid")&&(C.bra=C.cursor,c()&&(r=C.limit-C.cursor,C.eq_s_b(1,"c")||(C.cursor=C.limit-r,C.slice_del(),C.ket=C.cursor,C.eq_s_b(2,"en")&&(C.bra=C.cursor,m())))),C.cursor=C.limit-s,C.ket=C.cursor,e=C.find_among_b(k,6))switch(C.bra=C.cursor,e){case 1:if(c()){if(C.slice_del(),i=C.limit-C.cursor,C.ket=C.cursor,C.eq_s_b(2,"ig")&&(C.bra=C.cursor,c()&&(n=C.limit-C.cursor,!C.eq_s_b(1,"e")))){C.cursor=C.limit-n,C.slice_del();break}C.cursor=C.limit-i,a()}break;case 2:c()&&(o=C.limit-C.cursor,C.eq_s_b(1,"e")||(C.cursor=C.limit-o,C.slice_del()));break;case 3:c()&&(C.slice_del(),l());break;case 4:c()&&C.slice_del();break;case 5:c()&&w&&C.slice_del()}C.cursor=C.limit-s,C.out_grouping_b(j,73,232)&&(t=C.limit-C.cursor,C.find_among_b(v,4)&&C.out_grouping_b(q,97,232)&&(C.cursor=C.limit-t,C.ket=C.cursor,C.cursor>C.limit_backward&&(C.cursor--,C.bra=C.cursor,C.slice_del())))}var f,_,w,b=[new r("",-1,6),new r("á",0,1),new r("ä",0,1),new r("é",0,2),new r("ë",0,2),new r("í",0,3),new r("ï",0,3),new r("ó",0,4),new r("ö",0,4),new r("ú",0,5),new r("ü",0,5)],p=[new r("",-1,3),new r("I",0,2),new r("Y",0,1)],g=[new r("dd",-1,-1),new r("kk",-1,-1),new r("tt",-1,-1)],h=[new r("ene",-1,2),new r("se",-1,3),new r("en",-1,2),new r("heden",2,1),new r("s",-1,3)],k=[new r("end",-1,1),new r("ig",-1,2),new r("ing",-1,1),new r("lijk",-1,3),new r("baar",-1,4),new r("bar",-1,5)],v=[new r("aa",-1,-1),new r("ee",-1,-1),new r("oo",-1,-1),new r("uu",-1,-1)],q=[17,65,16,1,0,0,0,0,0,0,0,0,0,0,0,0,128],j=[1,0,0,17,65,16,1,0,0,0,0,0,0,0,0,0,0,0,0,128],z=[17,67,16,1,0,0,0,0,0,0,0,0,0,0,0,0,128],C=new i;this.setCurrent=function(e){C.setCurrent(e)},this.getCurrent=function(){return C.getCurrent()},this.stem=function(){var r=C.cursor;return e(),C.cursor=r,o(),C.limit_backward=r,C.cursor=C.limit,d(),C.cursor=C.limit_backward,s(),!0}};return function(e){return"function"==typeof e.update?e.update(function(e){return n.setCurrent(e),n.stem(),n.getCurrent()}):(n.setCurrent(e),n.stem(),n.getCurrent())}}(),e.Pipeline.registerFunction(e.du.stemmer,"stemmer-du"),e.du.stopWordFilter=e.generateStopWordFilter(" aan al alles als altijd andere ben bij daar dan dat de der deze die dit doch doen door dus een eens en er ge geen geweest haar had heb hebben heeft hem het hier hij hoe hun iemand iets ik in is ja je kan kon kunnen maar me meer men met mij mijn moet na naar niet niets nog nu of om omdat onder ons ook op over reeds te tegen toch toen tot u uit uw van veel voor want waren was wat werd wezen wie wil worden wordt zal ze zelf zich zij zijn zo zonder zou".split(" ")),e.Pipeline.registerFunction(e.du.stopWordFilter,"stopWordFilter-du")}}); \ No newline at end of file diff --git a/docs/public/assets/javascripts/lunr/min/lunr.es.min.js b/docs/assets/javascripts/lunr/min/lunr.es.min.js similarity index 100% rename from docs/public/assets/javascripts/lunr/min/lunr.es.min.js rename to docs/assets/javascripts/lunr/min/lunr.es.min.js diff --git a/docs/public/assets/javascripts/lunr/min/lunr.fi.min.js b/docs/assets/javascripts/lunr/min/lunr.fi.min.js similarity index 89% rename from docs/public/assets/javascripts/lunr/min/lunr.fi.min.js rename to docs/assets/javascripts/lunr/min/lunr.fi.min.js index a94643cbd..29f5dfcea 100644 --- a/docs/public/assets/javascripts/lunr/min/lunr.fi.min.js +++ b/docs/assets/javascripts/lunr/min/lunr.fi.min.js @@ -15,4 +15,4 @@ * http://www.mozilla.org/MPL/ */ -!function(i,e){"function"==typeof define&&define.amd?define(e):"object"==typeof exports?module.exports=e():e()(i.lunr)}(this,function(){return function(i){if(void 0===i)throw new Error("Lunr is not present. Please include / require Lunr before this script.");if(void 0===i.stemmerSupport)throw new Error("Lunr stemmer support is not present. Please include / require Lunr stemmer support before this script.");i.fi=function(){this.pipeline.reset(),this.pipeline.add(i.fi.trimmer,i.fi.stopWordFilter,i.fi.stemmer),this.searchPipeline&&(this.searchPipeline.reset(),this.searchPipeline.add(i.fi.stemmer))},i.fi.wordCharacters="A-Za-zªºÀ-ÖØ-öø-ʸˠ-ˤᴀ-ᴥᴬ-ᵜᵢ-ᵥᵫ-ᵷᵹ-ᶾḀ-ỿⁱⁿₐ-ₜKÅℲⅎⅠ-ↈⱠ-ⱿꜢ-ꞇꞋ-ꞭꞰ-ꞷꟷ-ꟿꬰ-ꭚꭜ-ꭤff-stA-Za-z",i.fi.trimmer=i.trimmerSupport.generateTrimmer(i.fi.wordCharacters),i.Pipeline.registerFunction(i.fi.trimmer,"trimmer-fi"),i.fi.stemmer=function(){var e=i.stemmerSupport.Among,r=i.stemmerSupport.SnowballProgram,n=new function(){function i(){f=A.limit,d=f,n()||(f=A.cursor,n()||(d=A.cursor))}function n(){for(var i;;){if(i=A.cursor,A.in_grouping(W,97,246))break;if(A.cursor=i,i>=A.limit)return!0;A.cursor++}for(A.cursor=i;!A.out_grouping(W,97,246);){if(A.cursor>=A.limit)return!0;A.cursor++}return!1}function t(){return d<=A.cursor}function s(){var i,e;if(A.cursor>=f)if(e=A.limit_backward,A.limit_backward=f,A.ket=A.cursor,i=A.find_among_b(h,10)){switch(A.bra=A.cursor,A.limit_backward=e,i){case 1:if(!A.in_grouping_b(x,97,246))return;break;case 2:if(!t())return}A.slice_del()}else A.limit_backward=e}function o(){var i,e,r;if(A.cursor>=f)if(e=A.limit_backward,A.limit_backward=f,A.ket=A.cursor,i=A.find_among_b(v,9))switch(A.bra=A.cursor,A.limit_backward=e,i){case 1:r=A.limit-A.cursor,A.eq_s_b(1,"k")||(A.cursor=A.limit-r,A.slice_del());break;case 2:A.slice_del(),A.ket=A.cursor,A.eq_s_b(3,"kse")&&(A.bra=A.cursor,A.slice_from("ksi"));break;case 3:A.slice_del();break;case 4:A.find_among_b(p,6)&&A.slice_del();break;case 5:A.find_among_b(g,6)&&A.slice_del();break;case 6:A.find_among_b(j,2)&&A.slice_del()}else A.limit_backward=e}function l(){return A.find_among_b(q,7)}function a(){return A.eq_s_b(1,"i")&&A.in_grouping_b(L,97,246)}function u(){var i,e,r;if(A.cursor>=f)if(e=A.limit_backward,A.limit_backward=f,A.ket=A.cursor,i=A.find_among_b(C,30)){switch(A.bra=A.cursor,A.limit_backward=e,i){case 1:if(!A.eq_s_b(1,"a"))return;break;case 2:case 9:if(!A.eq_s_b(1,"e"))return;break;case 3:if(!A.eq_s_b(1,"i"))return;break;case 4:if(!A.eq_s_b(1,"o"))return;break;case 5:if(!A.eq_s_b(1,"ä"))return;break;case 6:if(!A.eq_s_b(1,"ö"))return;break;case 7:if(r=A.limit-A.cursor,!l()&&(A.cursor=A.limit-r,!A.eq_s_b(2,"ie"))){A.cursor=A.limit-r;break}if(A.cursor=A.limit-r,A.cursor<=A.limit_backward){A.cursor=A.limit-r;break}A.cursor--,A.bra=A.cursor;break;case 8:if(!A.in_grouping_b(W,97,246)||!A.out_grouping_b(W,97,246))return}A.slice_del(),k=!0}else A.limit_backward=e}function c(){var i,e,r;if(A.cursor>=d)if(e=A.limit_backward,A.limit_backward=d,A.ket=A.cursor,i=A.find_among_b(P,14)){if(A.bra=A.cursor,A.limit_backward=e,1==i){if(r=A.limit-A.cursor,A.eq_s_b(2,"po"))return;A.cursor=A.limit-r}A.slice_del()}else A.limit_backward=e}function m(){var i;A.cursor>=f&&(i=A.limit_backward,A.limit_backward=f,A.ket=A.cursor,A.find_among_b(F,2)?(A.bra=A.cursor,A.limit_backward=i,A.slice_del()):A.limit_backward=i)}function w(){var i,e,r,n,t,s;if(A.cursor>=f){if(e=A.limit_backward,A.limit_backward=f,A.ket=A.cursor,A.eq_s_b(1,"t")&&(A.bra=A.cursor,r=A.limit-A.cursor,A.in_grouping_b(W,97,246)&&(A.cursor=A.limit-r,A.slice_del(),A.limit_backward=e,n=A.limit-A.cursor,A.cursor>=d&&(A.cursor=d,t=A.limit_backward,A.limit_backward=A.cursor,A.cursor=A.limit-n,A.ket=A.cursor,i=A.find_among_b(S,2))))){if(A.bra=A.cursor,A.limit_backward=t,1==i){if(s=A.limit-A.cursor,A.eq_s_b(2,"po"))return;A.cursor=A.limit-s}return void A.slice_del()}A.limit_backward=e}}function _(){var i,e,r,n;if(A.cursor>=f){for(i=A.limit_backward,A.limit_backward=f,e=A.limit-A.cursor,l()&&(A.cursor=A.limit-e,A.ket=A.cursor,A.cursor>A.limit_backward&&(A.cursor--,A.bra=A.cursor,A.slice_del())),A.cursor=A.limit-e,A.ket=A.cursor,A.in_grouping_b(y,97,228)&&(A.bra=A.cursor,A.out_grouping_b(W,97,246)&&A.slice_del()),A.cursor=A.limit-e,A.ket=A.cursor,A.eq_s_b(1,"j")&&(A.bra=A.cursor,r=A.limit-A.cursor,A.eq_s_b(1,"o")?A.slice_del():(A.cursor=A.limit-r,A.eq_s_b(1,"u")&&A.slice_del())),A.cursor=A.limit-e,A.ket=A.cursor,A.eq_s_b(1,"o")&&(A.bra=A.cursor,A.eq_s_b(1,"j")&&A.slice_del()),A.cursor=A.limit-e,A.limit_backward=i;;){if(n=A.limit-A.cursor,A.out_grouping_b(W,97,246)){A.cursor=A.limit-n;break}if(A.cursor=A.limit-n,A.cursor<=A.limit_backward)return;A.cursor--}A.ket=A.cursor,A.cursor>A.limit_backward&&(A.cursor--,A.bra=A.cursor,b=A.slice_to(),A.eq_v_b(b)&&A.slice_del())}}var k,b,d,f,h=[new e("pa",-1,1),new e("sti",-1,2),new e("kaan",-1,1),new e("han",-1,1),new e("kin",-1,1),new e("hän",-1,1),new e("kään",-1,1),new e("ko",-1,1),new e("pä",-1,1),new e("kö",-1,1)],p=[new e("lla",-1,-1),new e("na",-1,-1),new e("ssa",-1,-1),new e("ta",-1,-1),new e("lta",3,-1),new e("sta",3,-1)],g=[new e("llä",-1,-1),new e("nä",-1,-1),new e("ssä",-1,-1),new e("tä",-1,-1),new e("ltä",3,-1),new e("stä",3,-1)],j=[new e("lle",-1,-1),new e("ine",-1,-1)],v=[new e("nsa",-1,3),new e("mme",-1,3),new e("nne",-1,3),new e("ni",-1,2),new e("si",-1,1),new e("an",-1,4),new e("en",-1,6),new e("än",-1,5),new e("nsä",-1,3)],q=[new e("aa",-1,-1),new e("ee",-1,-1),new e("ii",-1,-1),new e("oo",-1,-1),new e("uu",-1,-1),new e("ää",-1,-1),new e("öö",-1,-1)],C=[new e("a",-1,8),new e("lla",0,-1),new e("na",0,-1),new e("ssa",0,-1),new e("ta",0,-1),new e("lta",4,-1),new e("sta",4,-1),new e("tta",4,9),new e("lle",-1,-1),new e("ine",-1,-1),new e("ksi",-1,-1),new e("n",-1,7),new e("han",11,1),new e("den",11,-1,a),new e("seen",11,-1,l),new e("hen",11,2),new e("tten",11,-1,a),new e("hin",11,3),new e("siin",11,-1,a),new e("hon",11,4),new e("hän",11,5),new e("hön",11,6),new e("ä",-1,8),new e("llä",22,-1),new e("nä",22,-1),new e("ssä",22,-1),new e("tä",22,-1),new e("ltä",26,-1),new e("stä",26,-1),new e("ttä",26,9)],P=[new e("eja",-1,-1),new e("mma",-1,1),new e("imma",1,-1),new e("mpa",-1,1),new e("impa",3,-1),new e("mmi",-1,1),new e("immi",5,-1),new e("mpi",-1,1),new e("impi",7,-1),new e("ejä",-1,-1),new e("mmä",-1,1),new e("immä",10,-1),new e("mpä",-1,1),new e("impä",12,-1)],F=[new e("i",-1,-1),new e("j",-1,-1)],S=[new e("mma",-1,1),new e("imma",0,-1)],y=[17,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8],W=[17,65,16,1,0,0,0,0,0,0,0,0,0,0,0,0,8,0,32],L=[17,65,16,0,0,0,0,0,0,0,0,0,0,0,0,0,8,0,32],x=[17,97,24,1,0,0,0,0,0,0,0,0,0,0,0,0,8,0,32],A=new r;this.setCurrent=function(i){A.setCurrent(i)},this.getCurrent=function(){return A.getCurrent()},this.stem=function(){var e=A.cursor;return i(),k=!1,A.limit_backward=e,A.cursor=A.limit,s(),A.cursor=A.limit,o(),A.cursor=A.limit,u(),A.cursor=A.limit,c(),A.cursor=A.limit,k?(m(),A.cursor=A.limit):(A.cursor=A.limit,w(),A.cursor=A.limit),_(),!0}};return function(i){return"function"==typeof i.update?i.update(function(i){return n.setCurrent(i),n.stem(),n.getCurrent()}):(n.setCurrent(i),n.stem(),n.getCurrent())}}(),i.Pipeline.registerFunction(i.fi.stemmer,"stemmer-fi"),i.fi.stopWordFilter=i.generateStopWordFilter("ei eivät emme en et ette että he heidän heidät heihin heille heillä heiltä heissä heistä heitä hän häneen hänelle hänellä häneltä hänen hänessä hänestä hänet häntä itse ja johon joiden joihin joiksi joilla joille joilta joina joissa joista joita joka joksi jolla jolle jolta jona jonka jos jossa josta jota jotka kanssa keiden keihin keiksi keille keillä keiltä keinä keissä keistä keitä keneen keneksi kenelle kenellä keneltä kenen kenenä kenessä kenestä kenet ketkä ketkä ketä koska kuin kuka kun me meidän meidät meihin meille meillä meiltä meissä meistä meitä mihin miksi mikä mille millä miltä minkä minkä minua minulla minulle minulta minun minussa minusta minute minuun minä minä missä mistä mitkä mitä mukaan mutta ne niiden niihin niiksi niille niillä niiltä niin niin niinä niissä niistä niitä noiden noihin noiksi noilla noille noilta noin noina noissa noista noita nuo nyt näiden näihin näiksi näille näillä näiltä näinä näissä näistä näitä nämä ole olemme olen olet olette oli olimme olin olisi olisimme olisin olisit olisitte olisivat olit olitte olivat olla olleet ollut on ovat poikki se sekä sen siihen siinä siitä siksi sille sillä sillä siltä sinua sinulla sinulle sinulta sinun sinussa sinusta sinut sinuun sinä sinä sitä tai te teidän teidät teihin teille teillä teiltä teissä teistä teitä tuo tuohon tuoksi tuolla tuolle tuolta tuon tuona tuossa tuosta tuota tähän täksi tälle tällä tältä tämä tämän tänä tässä tästä tätä vaan vai vaikka yli".split(" ")),i.Pipeline.registerFunction(i.fi.stopWordFilter,"stopWordFilter-fi")}}); \ No newline at end of file +!function(i,e){"function"==typeof define&&define.amd?define(e):"object"==typeof exports?module.exports=e():e()(i.lunr)}(this,function(){return function(i){if(void 0===i)throw new Error("Lunr is not present. Please include / require Lunr before this script.");if(void 0===i.stemmerSupport)throw new Error("Lunr stemmer support is not present. Please include / require Lunr stemmer support before this script.");i.fi=function(){this.pipeline.reset(),this.pipeline.add(i.fi.trimmer,i.fi.stopWordFilter,i.fi.stemmer),this.searchPipeline&&(this.searchPipeline.reset(),this.searchPipeline.add(i.fi.stemmer))},i.fi.wordCharacters="A-Za-zªºÀ-ÖØ-öø-ʸˠ-ˤᴀ-ᴥᴬ-ᵜᵢ-ᵥᵫ-ᵷᵹ-ᶾḀ-ỿⁱⁿₐ-ₜKÅℲⅎⅠ-ↈⱠ-ⱿꜢ-ꞇꞋ-ꞭꞰ-ꞷꟷ-ꟿꬰ-ꭚꭜ-ꭤff-stA-Za-z",i.fi.trimmer=i.trimmerSupport.generateTrimmer(i.fi.wordCharacters),i.Pipeline.registerFunction(i.fi.trimmer,"trimmer-fi"),i.fi.stemmer=function(){var e=i.stemmerSupport.Among,r=i.stemmerSupport.SnowballProgram,n=new function(){function i(){f=A.limit,d=f,n()||(f=A.cursor,n()||(d=A.cursor))}function n(){for(var i;;){if(i=A.cursor,A.in_grouping(W,97,246))break;if(A.cursor=i,i>=A.limit)return!0;A.cursor++}for(A.cursor=i;!A.out_grouping(W,97,246);){if(A.cursor>=A.limit)return!0;A.cursor++}return!1}function t(){return d<=A.cursor}function s(){var i,e;if(A.cursor>=f)if(e=A.limit_backward,A.limit_backward=f,A.ket=A.cursor,i=A.find_among_b(h,10)){switch(A.bra=A.cursor,A.limit_backward=e,i){case 1:if(!A.in_grouping_b(x,97,246))return;break;case 2:if(!t())return}A.slice_del()}else A.limit_backward=e}function o(){var i,e,r;if(A.cursor>=f)if(e=A.limit_backward,A.limit_backward=f,A.ket=A.cursor,i=A.find_among_b(v,9))switch(A.bra=A.cursor,A.limit_backward=e,i){case 1:r=A.limit-A.cursor,A.eq_s_b(1,"k")||(A.cursor=A.limit-r,A.slice_del());break;case 2:A.slice_del(),A.ket=A.cursor,A.eq_s_b(3,"kse")&&(A.bra=A.cursor,A.slice_from("ksi"));break;case 3:A.slice_del();break;case 4:A.find_among_b(p,6)&&A.slice_del();break;case 5:A.find_among_b(g,6)&&A.slice_del();break;case 6:A.find_among_b(j,2)&&A.slice_del()}else A.limit_backward=e}function l(){return A.find_among_b(q,7)}function a(){return A.eq_s_b(1,"i")&&A.in_grouping_b(L,97,246)}function u(){var i,e,r;if(A.cursor>=f)if(e=A.limit_backward,A.limit_backward=f,A.ket=A.cursor,i=A.find_among_b(C,30)){switch(A.bra=A.cursor,A.limit_backward=e,i){case 1:if(!A.eq_s_b(1,"a"))return;break;case 2:case 9:if(!A.eq_s_b(1,"e"))return;break;case 3:if(!A.eq_s_b(1,"i"))return;break;case 4:if(!A.eq_s_b(1,"o"))return;break;case 5:if(!A.eq_s_b(1,"ä"))return;break;case 6:if(!A.eq_s_b(1,"ö"))return;break;case 7:if(r=A.limit-A.cursor,!l()&&(A.cursor=A.limit-r,!A.eq_s_b(2,"ie"))){A.cursor=A.limit-r;break}if(A.cursor=A.limit-r,A.cursor<=A.limit_backward){A.cursor=A.limit-r;break}A.cursor--,A.bra=A.cursor;break;case 8:if(!A.in_grouping_b(W,97,246)||!A.out_grouping_b(W,97,246))return}A.slice_del(),k=!0}else A.limit_backward=e}function c(){var i,e,r;if(A.cursor>=d)if(e=A.limit_backward,A.limit_backward=d,A.ket=A.cursor,i=A.find_among_b(P,14)){if(A.bra=A.cursor,A.limit_backward=e,1==i){if(r=A.limit-A.cursor,A.eq_s_b(2,"po"))return;A.cursor=A.limit-r}A.slice_del()}else A.limit_backward=e}function m(){var i;A.cursor>=f&&(i=A.limit_backward,A.limit_backward=f,A.ket=A.cursor,A.find_among_b(F,2)?(A.bra=A.cursor,A.limit_backward=i,A.slice_del()):A.limit_backward=i)}function w(){var i,e,r,n,t,s;if(A.cursor>=f){if(e=A.limit_backward,A.limit_backward=f,A.ket=A.cursor,A.eq_s_b(1,"t")&&(A.bra=A.cursor,r=A.limit-A.cursor,A.in_grouping_b(W,97,246)&&(A.cursor=A.limit-r,A.slice_del(),A.limit_backward=e,n=A.limit-A.cursor,A.cursor>=d&&(A.cursor=d,t=A.limit_backward,A.limit_backward=A.cursor,A.cursor=A.limit-n,A.ket=A.cursor,i=A.find_among_b(S,2))))){if(A.bra=A.cursor,A.limit_backward=t,1==i){if(s=A.limit-A.cursor,A.eq_s_b(2,"po"))return;A.cursor=A.limit-s}return void A.slice_del()}A.limit_backward=e}}function _(){var i,e,r,n;if(A.cursor>=f){for(i=A.limit_backward,A.limit_backward=f,e=A.limit-A.cursor,l()&&(A.cursor=A.limit-e,A.ket=A.cursor,A.cursor>A.limit_backward&&(A.cursor--,A.bra=A.cursor,A.slice_del())),A.cursor=A.limit-e,A.ket=A.cursor,A.in_grouping_b(y,97,228)&&(A.bra=A.cursor,A.out_grouping_b(W,97,246)&&A.slice_del()),A.cursor=A.limit-e,A.ket=A.cursor,A.eq_s_b(1,"j")&&(A.bra=A.cursor,r=A.limit-A.cursor,A.eq_s_b(1,"o")?A.slice_del():(A.cursor=A.limit-r,A.eq_s_b(1,"u")&&A.slice_del())),A.cursor=A.limit-e,A.ket=A.cursor,A.eq_s_b(1,"o")&&(A.bra=A.cursor,A.eq_s_b(1,"j")&&A.slice_del()),A.cursor=A.limit-e,A.limit_backward=i;;){if(n=A.limit-A.cursor,A.out_grouping_b(W,97,246)){A.cursor=A.limit-n;break}if(A.cursor=A.limit-n,A.cursor<=A.limit_backward)return;A.cursor--}A.ket=A.cursor,A.cursor>A.limit_backward&&(A.cursor--,A.bra=A.cursor,b=A.slice_to(),A.eq_v_b(b)&&A.slice_del())}}var k,b,d,f,h=[new e("pa",-1,1),new e("sti",-1,2),new e("kaan",-1,1),new e("han",-1,1),new e("kin",-1,1),new e("hän",-1,1),new e("kään",-1,1),new e("ko",-1,1),new e("pä",-1,1),new e("kö",-1,1)],p=[new e("lla",-1,-1),new e("na",-1,-1),new e("ssa",-1,-1),new e("ta",-1,-1),new e("lta",3,-1),new e("sta",3,-1)],g=[new e("llä",-1,-1),new e("nä",-1,-1),new e("ssä",-1,-1),new e("tä",-1,-1),new e("ltä",3,-1),new e("stä",3,-1)],j=[new e("lle",-1,-1),new e("ine",-1,-1)],v=[new e("nsa",-1,3),new e("mme",-1,3),new e("nne",-1,3),new e("ni",-1,2),new e("si",-1,1),new e("an",-1,4),new e("en",-1,6),new e("än",-1,5),new e("nsä",-1,3)],q=[new e("aa",-1,-1),new e("ee",-1,-1),new e("ii",-1,-1),new e("oo",-1,-1),new e("uu",-1,-1),new e("ää",-1,-1),new e("öö",-1,-1)],C=[new e("a",-1,8),new e("lla",0,-1),new e("na",0,-1),new e("ssa",0,-1),new e("ta",0,-1),new e("lta",4,-1),new e("sta",4,-1),new e("tta",4,9),new e("lle",-1,-1),new e("ine",-1,-1),new e("ksi",-1,-1),new e("n",-1,7),new e("han",11,1),new e("den",11,-1,a),new e("seen",11,-1,l),new e("hen",11,2),new e("tten",11,-1,a),new e("hin",11,3),new e("siin",11,-1,a),new e("hon",11,4),new e("hän",11,5),new e("hön",11,6),new e("ä",-1,8),new e("llä",22,-1),new e("nä",22,-1),new e("ssä",22,-1),new e("tä",22,-1),new e("ltä",26,-1),new e("stä",26,-1),new e("ttä",26,9)],P=[new e("eja",-1,-1),new e("mma",-1,1),new e("imma",1,-1),new e("mpa",-1,1),new e("impa",3,-1),new e("mmi",-1,1),new e("immi",5,-1),new e("mpi",-1,1),new e("impi",7,-1),new e("ejä",-1,-1),new e("mmä",-1,1),new e("immä",10,-1),new e("mpä",-1,1),new e("impä",12,-1)],F=[new e("i",-1,-1),new e("j",-1,-1)],S=[new e("mma",-1,1),new e("imma",0,-1)],y=[17,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8],W=[17,65,16,1,0,0,0,0,0,0,0,0,0,0,0,0,8,0,32],L=[17,65,16,0,0,0,0,0,0,0,0,0,0,0,0,0,8,0,32],x=[17,97,24,1,0,0,0,0,0,0,0,0,0,0,0,0,8,0,32],A=new r;this.setCurrent=function(i){A.setCurrent(i)},this.getCurrent=function(){return A.getCurrent()},this.stem=function(){var e=A.cursor;return i(),k=!1,A.limit_backward=e,A.cursor=A.limit,s(),A.cursor=A.limit,o(),A.cursor=A.limit,u(),A.cursor=A.limit,c(),A.cursor=A.limit,k?(m(),A.cursor=A.limit):(A.cursor=A.limit,w(),A.cursor=A.limit),_(),!0}};return function(i){return"function"==typeof i.update?i.update(function(i){return n.setCurrent(i),n.stem(),n.getCurrent()}):(n.setCurrent(i),n.stem(),n.getCurrent())}}(),i.Pipeline.registerFunction(i.fi.stemmer,"stemmer-fi"),i.fi.stopWordFilter=i.generateStopWordFilter("ei eivät emme en et ette että he heidän heidät heihin heille heillä heiltä heissä heistä heitä hän häneen hänelle hänellä häneltä hänen hänessä hänestä hänet häntä itse ja johon joiden joihin joiksi joilla joille joilta joina joissa joista joita joka joksi jolla jolle jolta jona jonka jos jossa josta jota jotka kanssa keiden keihin keiksi keille keillä keiltä keinä keissä keistä keitä keneen keneksi kenelle kenellä keneltä kenen kenenä kenessä kenestä kenet ketkä ketkä ketä koska kuin kuka kun me meidän meidät meihin meille meillä meiltä meissä meistä meitä mihin miksi mikä mille millä miltä minkä minkä minua minulla minulle minulta minun minussa minusta minut minuun minä minä missä mistä mitkä mitä mukaan mutta ne niiden niihin niiksi niille niillä niiltä niin niin niinä niissä niistä niitä noiden noihin noiksi noilla noille noilta noin noina noissa noista noita nuo nyt näiden näihin näiksi näille näillä näiltä näinä näissä näistä näitä nämä ole olemme olen olet olette oli olimme olin olisi olisimme olisin olisit olisitte olisivat olit olitte olivat olla olleet ollut on ovat poikki se sekä sen siihen siinä siitä siksi sille sillä sillä siltä sinua sinulla sinulle sinulta sinun sinussa sinusta sinut sinuun sinä sinä sitä tai te teidän teidät teihin teille teillä teiltä teissä teistä teitä tuo tuohon tuoksi tuolla tuolle tuolta tuon tuona tuossa tuosta tuota tähän täksi tälle tällä tältä tämä tämän tänä tässä tästä tätä vaan vai vaikka yli".split(" ")),i.Pipeline.registerFunction(i.fi.stopWordFilter,"stopWordFilter-fi")}}); \ No newline at end of file diff --git a/docs/public/assets/javascripts/lunr/min/lunr.fr.min.js b/docs/assets/javascripts/lunr/min/lunr.fr.min.js similarity index 68% rename from docs/public/assets/javascripts/lunr/min/lunr.fr.min.js rename to docs/assets/javascripts/lunr/min/lunr.fr.min.js index 776a2e276..68cd0094a 100644 --- a/docs/public/assets/javascripts/lunr/min/lunr.fr.min.js +++ b/docs/assets/javascripts/lunr/min/lunr.fr.min.js @@ -15,4 +15,4 @@ * http://www.mozilla.org/MPL/ */ -!function(e,r){"function"==typeof define&&define.amd?define(r):"object"==typeof exports?module.exports=r():r()(e.lunr)}(this,function(){return function(e){if(void 0===e)throw new Error("Lunr is not present. Please include / require Lunr before this script.");if(void 0===e.stemmerSupport)throw new Error("Lunr stemmer support is not present. Please include / require Lunr stemmer support before this script.");e.fr=function(){this.pipeline.reset(),this.pipeline.add(e.fr.trimmer,e.fr.stopWordFilter,e.fr.stemmer),this.searchPipeline&&(this.searchPipeline.reset(),this.searchPipeline.add(e.fr.stemmer))},e.fr.wordCharacters="A-Za-zªºÀ-ÖØ-öø-ʸˠ-ˤᴀ-ᴥᴬ-ᵜᵢ-ᵥᵫ-ᵷᵹ-ᶾḀ-ỿⁱⁿₐ-ₜKÅℲⅎⅠ-ↈⱠ-ⱿꜢ-ꞇꞋ-ꞭꞰ-ꞷꟷ-ꟿꬰ-ꭚꭜ-ꭤff-stA-Za-z",e.fr.trimmer=e.trimmerSupport.generateTrimmer(e.fr.wordCharacters),e.Pipeline.registerFunction(e.fr.trimmer,"trimmer-fr"),e.fr.stemmer=function(){var r=e.stemmerSupport.Among,s=e.stemmerSupport.SnowballProgram,i=new function(){function e(e,r,s){return!(!W.eq_s(1,e)||(W.ket=W.cursor,!W.in_grouping(F,97,251)))&&(W.slice_from(r),W.cursor=s,!0)}function i(e,r,s){return!!W.eq_s(1,e)&&(W.ket=W.cursor,W.slice_from(r),W.cursor=s,!0)}function n(){for(var r,s;;){if(r=W.cursor,W.in_grouping(F,97,251)){if(W.bra=W.cursor,s=W.cursor,e("u","U",r))continue;if(W.cursor=s,e("i","I",r))continue;if(W.cursor=s,i("y","Y",r))continue}if(W.cursor=r,W.bra=r,!e("y","Y",r)){if(W.cursor=r,W.eq_s(1,"q")&&(W.bra=W.cursor,i("u","U",r)))continue;if(W.cursor=r,r>=W.limit)return;W.cursor++}}}function t(){for(;!W.in_grouping(F,97,251);){if(W.cursor>=W.limit)return!0;W.cursor++}for(;!W.out_grouping(F,97,251);){if(W.cursor>=W.limit)return!0;W.cursor++}return!1}function u(){var e=W.cursor;if(q=W.limit,g=q,p=q,W.in_grouping(F,97,251)&&W.in_grouping(F,97,251)&&W.cursor=W.limit){W.cursor=q;break}W.cursor++}while(!W.in_grouping(F,97,251))}q=W.cursor,W.cursor=e,t()||(g=W.cursor,t()||(p=W.cursor))}function o(){for(var e,r;;){if(r=W.cursor,W.bra=r,!(e=W.find_among(h,4)))break;switch(W.ket=W.cursor,e){case 1:W.slice_from("i");break;case 2:W.slice_from("u");break;case 3:W.slice_from("y");break;case 4:if(W.cursor>=W.limit)return;W.cursor++}}}function c(){return q<=W.cursor}function a(){return g<=W.cursor}function l(){return p<=W.cursor}function w(){var e,r;if(W.ket=W.cursor,e=W.find_among_b(C,43)){switch(W.bra=W.cursor,e){case 1:if(!l())return!1;W.slice_del();break;case 2:if(!l())return!1;W.slice_del(),W.ket=W.cursor,W.eq_s_b(2,"ic")&&(W.bra=W.cursor,l()?W.slice_del():W.slice_from("iqU"));break;case 3:if(!l())return!1;W.slice_from("log");break;case 4:if(!l())return!1;W.slice_from("u");break;case 5:if(!l())return!1;W.slice_from("ent");break;case 6:if(!c())return!1;if(W.slice_del(),W.ket=W.cursor,e=W.find_among_b(z,6))switch(W.bra=W.cursor,e){case 1:l()&&(W.slice_del(),W.ket=W.cursor,W.eq_s_b(2,"at")&&(W.bra=W.cursor,l()&&W.slice_del()));break;case 2:l()?W.slice_del():a()&&W.slice_from("eux");break;case 3:l()&&W.slice_del();break;case 4:c()&&W.slice_from("i")}break;case 7:if(!l())return!1;if(W.slice_del(),W.ket=W.cursor,e=W.find_among_b(y,3))switch(W.bra=W.cursor,e){case 1:l()?W.slice_del():W.slice_from("abl");break;case 2:l()?W.slice_del():W.slice_from("iqU");break;case 3:l()&&W.slice_del()}break;case 8:if(!l())return!1;if(W.slice_del(),W.ket=W.cursor,W.eq_s_b(2,"at")&&(W.bra=W.cursor,l()&&(W.slice_del(),W.ket=W.cursor,W.eq_s_b(2,"ic")))){W.bra=W.cursor,l()?W.slice_del():W.slice_from("iqU");break}break;case 9:W.slice_from("eau");break;case 10:if(!a())return!1;W.slice_from("al");break;case 11:if(l())W.slice_del();else{if(!a())return!1;W.slice_from("eux")}break;case 12:if(!a()||!W.out_grouping_b(F,97,251))return!1;W.slice_del();break;case 13:return c()&&W.slice_from("ant"),!1;case 14:return c()&&W.slice_from("ent"),!1;case 15:return r=W.limit-W.cursor,W.in_grouping_b(F,97,251)&&c()&&(W.cursor=W.limit-r,W.slice_del()),!1}return!0}return!1}function f(){var e,r;if(W.cursor=q){if(s=W.limit_backward,W.limit_backward=q,W.ket=W.cursor,e=W.find_among_b(P,7))switch(W.bra=W.cursor,e){case 1:if(l()){if(i=W.limit-W.cursor,!W.eq_s_b(1,"s")&&(W.cursor=W.limit-i,!W.eq_s_b(1,"t")))break;W.slice_del()}break;case 2:W.slice_from("i");break;case 3:W.slice_del();break;case 4:W.eq_s_b(2,"gu")&&W.slice_del()}W.limit_backward=s}}function b(){var e=W.limit-W.cursor;W.find_among_b(U,5)&&(W.cursor=W.limit-e,W.ket=W.cursor,W.cursor>W.limit_backward&&(W.cursor--,W.bra=W.cursor,W.slice_del()))}function d(){for(var e,r=1;W.out_grouping_b(F,97,251);)r--;if(r<=0){if(W.ket=W.cursor,e=W.limit-W.cursor,!W.eq_s_b(1,"é")&&(W.cursor=W.limit-e,!W.eq_s_b(1,"è")))return;W.bra=W.cursor,W.slice_from("e")}}function k(){if(!w()&&(W.cursor=W.limit,!f()&&(W.cursor=W.limit,!m())))return W.cursor=W.limit,void _();W.cursor=W.limit,W.ket=W.cursor,W.eq_s_b(1,"Y")?(W.bra=W.cursor,W.slice_from("i")):(W.cursor=W.limit,W.eq_s_b(1,"ç")&&(W.bra=W.cursor,W.slice_from("c")))}var p,g,q,v=[new r("col",-1,-1),new r("par",-1,-1),new r("tap",-1,-1)],h=[new r("",-1,4),new r("I",0,1),new r("U",0,2),new r("Y",0,3)],z=[new r("iqU",-1,3),new r("abl",-1,3),new r("Ièr",-1,4),new r("ièr",-1,4),new r("eus",-1,2),new r("iv",-1,1)],y=[new r("ic",-1,2),new r("abil",-1,1),new r("iv",-1,3)],C=[new r("iqUe",-1,1),new r("atrice",-1,2),new r("ance",-1,1),new r("ence",-1,5),new r("logie",-1,3),new r("able",-1,1),new r("isme",-1,1),new r("euse",-1,11),new r("iste",-1,1),new r("ive",-1,8),new r("if",-1,8),new r("usion",-1,4),new r("ation",-1,2),new r("ution",-1,4),new r("ateur",-1,2),new r("iqUes",-1,1),new r("atrices",-1,2),new r("ances",-1,1),new r("ences",-1,5),new r("logies",-1,3),new r("ables",-1,1),new r("ismes",-1,1),new r("euses",-1,11),new r("istes",-1,1),new r("ives",-1,8),new r("ifs",-1,8),new r("usions",-1,4),new r("ations",-1,2),new r("utions",-1,4),new r("ateurs",-1,2),new r("ments",-1,15),new r("ements",30,6),new r("issements",31,12),new r("ités",-1,7),new r("meant",-1,15),new r("ement",34,6),new r("issement",35,12),new r("amment",34,13),new r("emment",34,14),new r("aux",-1,10),new r("eaux",39,9),new r("eux",-1,1),new r("ité",-1,7)],x=[new r("ira",-1,1),new r("ie",-1,1),new r("issue",-1,1),new r("issante",-1,1),new r("i",-1,1),new r("irai",4,1),new r("ir",-1,1),new r("iras",-1,1),new r("ies",-1,1),new r("îmes",-1,1),new r("issues",-1,1),new r("issantes",-1,1),new r("îtes",-1,1),new r("is",-1,1),new r("irais",13,1),new r("issais",13,1),new r("irions",-1,1),new r("issions",-1,1),new r("irons",-1,1),new r("issons",-1,1),new r("issants",-1,1),new r("it",-1,1),new r("irait",21,1),new r("issait",21,1),new r("issant",-1,1),new r("iraIent",-1,1),new r("issaIent",-1,1),new r("irent",-1,1),new r("issent",-1,1),new r("iront",-1,1),new r("ît",-1,1),new r("iriez",-1,1),new r("issiez",-1,1),new r("irez",-1,1),new r("issez",-1,1)],I=[new r("a",-1,3),new r("era",0,2),new r("asse",-1,3),new r("ante",-1,3),new r("ée",-1,2),new r("ai",-1,3),new r("erai",5,2),new r("er",-1,2),new r("as",-1,3),new r("eras",8,2),new r("âmes",-1,3),new r("asses",-1,3),new r("antes",-1,3),new r("âtes",-1,3),new r("ées",-1,2),new r("ais",-1,3),new r("erais",15,2),new r("ions",-1,1),new r("erions",17,2),new r("assions",17,3),new r("erons",-1,2),new r("ants",-1,3),new r("és",-1,2),new r("ait",-1,3),new r("erait",23,2),new r("ant",-1,3),new r("aIent",-1,3),new r("eraIent",26,2),new r("èrent",-1,2),new r("assent",-1,3),new r("eront",-1,2),new r("ât",-1,3),new r("ez",-1,2),new r("iez",32,2),new r("eriez",33,2),new r("assiez",33,3),new r("erez",32,2),new r("é",-1,2)],P=[new r("e",-1,3),new r("Ière",0,2),new r("ière",0,2),new r("ion",-1,1),new r("Ier",-1,2),new r("ier",-1,2),new r("ë",-1,4)],U=[new r("ell",-1,-1),new r("eill",-1,-1),new r("enn",-1,-1),new r("onn",-1,-1),new r("ett",-1,-1)],F=[17,65,16,1,0,0,0,0,0,0,0,0,0,0,0,128,130,103,8,5],S=[1,65,20,0,0,0,0,0,0,0,0,0,0,0,0,0,128],W=new s;this.setCurrent=function(e){W.setCurrent(e)},this.getCurrent=function(){return W.getCurrent()},this.stem=function(){var e=W.cursor;return n(),W.cursor=e,u(),W.limit_backward=e,W.cursor=W.limit,k(),W.cursor=W.limit,b(),W.cursor=W.limit,d(),W.cursor=W.limit_backward,o(),!0}};return function(e){return"function"==typeof e.update?e.update(function(e){return i.setCurrent(e),i.stem(),i.getCurrent()}):(i.setCurrent(e),i.stem(),i.getCurrent())}}(),e.Pipeline.registerFunction(e.fr.stemmer,"stemmer-fr"),e.fr.stopWordFilter=e.generateStopWordFilter("ai aie aient aies ait as au aura aurai auraient aurais aurait auras aurez auriez aurions aurons auront aux avaient avais avait avec avez aviez avions avons ayant ayez ayons c ce ceci celà ces cet cette d dans de des du elle en es est et eu eue eues eurent eus eusse eussent eusses eussiez eussions eut eux eûmes eût eûtes furent fus fusse fussent fusses fussiez fussions fut fûmes fût fûtes ici il ils j je l la le les leur leurs lui m ma mais me mes moi mon même n ne nos notre nous on ont ou par pas pour qu que quel quelle quelles quels qui s sa sans se sera serai seraient serais serait seras serez seriez serions serons seront ses soi soient sois soit sommes son sont soyez soyons suis sure t ta te tes toi ton tu un une vos votre vous y à étaient étais était étant étiez étions été étée étées étés êtes".split(" ")),e.Pipeline.registerFunction(e.fr.stopWordFilter,"stopWordFilter-fr")}}); \ No newline at end of file +!function(e,r){"function"==typeof define&&define.amd?define(r):"object"==typeof exports?module.exports=r():r()(e.lunr)}(this,function(){return function(e){if(void 0===e)throw new Error("Lunr is not present. Please include / require Lunr before this script.");if(void 0===e.stemmerSupport)throw new Error("Lunr stemmer support is not present. Please include / require Lunr stemmer support before this script.");e.fr=function(){this.pipeline.reset(),this.pipeline.add(e.fr.trimmer,e.fr.stopWordFilter,e.fr.stemmer),this.searchPipeline&&(this.searchPipeline.reset(),this.searchPipeline.add(e.fr.stemmer))},e.fr.wordCharacters="A-Za-zªºÀ-ÖØ-öø-ʸˠ-ˤᴀ-ᴥᴬ-ᵜᵢ-ᵥᵫ-ᵷᵹ-ᶾḀ-ỿⁱⁿₐ-ₜKÅℲⅎⅠ-ↈⱠ-ⱿꜢ-ꞇꞋ-ꞭꞰ-ꞷꟷ-ꟿꬰ-ꭚꭜ-ꭤff-stA-Za-z",e.fr.trimmer=e.trimmerSupport.generateTrimmer(e.fr.wordCharacters),e.Pipeline.registerFunction(e.fr.trimmer,"trimmer-fr"),e.fr.stemmer=function(){var r=e.stemmerSupport.Among,s=e.stemmerSupport.SnowballProgram,i=new function(){function e(e,r,s){return!(!W.eq_s(1,e)||(W.ket=W.cursor,!W.in_grouping(F,97,251)))&&(W.slice_from(r),W.cursor=s,!0)}function i(e,r,s){return!!W.eq_s(1,e)&&(W.ket=W.cursor,W.slice_from(r),W.cursor=s,!0)}function n(){for(var r,s;;){if(r=W.cursor,W.in_grouping(F,97,251)){if(W.bra=W.cursor,s=W.cursor,e("u","U",r))continue;if(W.cursor=s,e("i","I",r))continue;if(W.cursor=s,i("y","Y",r))continue}if(W.cursor=r,W.bra=r,!e("y","Y",r)){if(W.cursor=r,W.eq_s(1,"q")&&(W.bra=W.cursor,i("u","U",r)))continue;if(W.cursor=r,r>=W.limit)return;W.cursor++}}}function t(){for(;!W.in_grouping(F,97,251);){if(W.cursor>=W.limit)return!0;W.cursor++}for(;!W.out_grouping(F,97,251);){if(W.cursor>=W.limit)return!0;W.cursor++}return!1}function u(){var e=W.cursor;if(q=W.limit,g=q,p=q,W.in_grouping(F,97,251)&&W.in_grouping(F,97,251)&&W.cursor=W.limit){W.cursor=q;break}W.cursor++}while(!W.in_grouping(F,97,251))}q=W.cursor,W.cursor=e,t()||(g=W.cursor,t()||(p=W.cursor))}function o(){for(var e,r;;){if(r=W.cursor,W.bra=r,!(e=W.find_among(h,4)))break;switch(W.ket=W.cursor,e){case 1:W.slice_from("i");break;case 2:W.slice_from("u");break;case 3:W.slice_from("y");break;case 4:if(W.cursor>=W.limit)return;W.cursor++}}}function c(){return q<=W.cursor}function a(){return g<=W.cursor}function l(){return p<=W.cursor}function w(){var e,r;if(W.ket=W.cursor,e=W.find_among_b(C,43)){switch(W.bra=W.cursor,e){case 1:if(!l())return!1;W.slice_del();break;case 2:if(!l())return!1;W.slice_del(),W.ket=W.cursor,W.eq_s_b(2,"ic")&&(W.bra=W.cursor,l()?W.slice_del():W.slice_from("iqU"));break;case 3:if(!l())return!1;W.slice_from("log");break;case 4:if(!l())return!1;W.slice_from("u");break;case 5:if(!l())return!1;W.slice_from("ent");break;case 6:if(!c())return!1;if(W.slice_del(),W.ket=W.cursor,e=W.find_among_b(z,6))switch(W.bra=W.cursor,e){case 1:l()&&(W.slice_del(),W.ket=W.cursor,W.eq_s_b(2,"at")&&(W.bra=W.cursor,l()&&W.slice_del()));break;case 2:l()?W.slice_del():a()&&W.slice_from("eux");break;case 3:l()&&W.slice_del();break;case 4:c()&&W.slice_from("i")}break;case 7:if(!l())return!1;if(W.slice_del(),W.ket=W.cursor,e=W.find_among_b(y,3))switch(W.bra=W.cursor,e){case 1:l()?W.slice_del():W.slice_from("abl");break;case 2:l()?W.slice_del():W.slice_from("iqU");break;case 3:l()&&W.slice_del()}break;case 8:if(!l())return!1;if(W.slice_del(),W.ket=W.cursor,W.eq_s_b(2,"at")&&(W.bra=W.cursor,l()&&(W.slice_del(),W.ket=W.cursor,W.eq_s_b(2,"ic")))){W.bra=W.cursor,l()?W.slice_del():W.slice_from("iqU");break}break;case 9:W.slice_from("eau");break;case 10:if(!a())return!1;W.slice_from("al");break;case 11:if(l())W.slice_del();else{if(!a())return!1;W.slice_from("eux")}break;case 12:if(!a()||!W.out_grouping_b(F,97,251))return!1;W.slice_del();break;case 13:return c()&&W.slice_from("ant"),!1;case 14:return c()&&W.slice_from("ent"),!1;case 15:return r=W.limit-W.cursor,W.in_grouping_b(F,97,251)&&c()&&(W.cursor=W.limit-r,W.slice_del()),!1}return!0}return!1}function f(){var e,r;if(W.cursor=q){if(s=W.limit_backward,W.limit_backward=q,W.ket=W.cursor,e=W.find_among_b(P,7))switch(W.bra=W.cursor,e){case 1:if(l()){if(i=W.limit-W.cursor,!W.eq_s_b(1,"s")&&(W.cursor=W.limit-i,!W.eq_s_b(1,"t")))break;W.slice_del()}break;case 2:W.slice_from("i");break;case 3:W.slice_del();break;case 4:W.eq_s_b(2,"gu")&&W.slice_del()}W.limit_backward=s}}function b(){var e=W.limit-W.cursor;W.find_among_b(U,5)&&(W.cursor=W.limit-e,W.ket=W.cursor,W.cursor>W.limit_backward&&(W.cursor--,W.bra=W.cursor,W.slice_del()))}function d(){for(var e,r=1;W.out_grouping_b(F,97,251);)r--;if(r<=0){if(W.ket=W.cursor,e=W.limit-W.cursor,!W.eq_s_b(1,"é")&&(W.cursor=W.limit-e,!W.eq_s_b(1,"è")))return;W.bra=W.cursor,W.slice_from("e")}}function k(){if(!w()&&(W.cursor=W.limit,!f()&&(W.cursor=W.limit,!m())))return W.cursor=W.limit,void _();W.cursor=W.limit,W.ket=W.cursor,W.eq_s_b(1,"Y")?(W.bra=W.cursor,W.slice_from("i")):(W.cursor=W.limit,W.eq_s_b(1,"ç")&&(W.bra=W.cursor,W.slice_from("c")))}var p,g,q,v=[new r("col",-1,-1),new r("par",-1,-1),new r("tap",-1,-1)],h=[new r("",-1,4),new r("I",0,1),new r("U",0,2),new r("Y",0,3)],z=[new r("iqU",-1,3),new r("abl",-1,3),new r("Ièr",-1,4),new r("ièr",-1,4),new r("eus",-1,2),new r("iv",-1,1)],y=[new r("ic",-1,2),new r("abil",-1,1),new r("iv",-1,3)],C=[new r("iqUe",-1,1),new r("atrice",-1,2),new r("ance",-1,1),new r("ence",-1,5),new r("logie",-1,3),new r("able",-1,1),new r("isme",-1,1),new r("euse",-1,11),new r("iste",-1,1),new r("ive",-1,8),new r("if",-1,8),new r("usion",-1,4),new r("ation",-1,2),new r("ution",-1,4),new r("ateur",-1,2),new r("iqUes",-1,1),new r("atrices",-1,2),new r("ances",-1,1),new r("ences",-1,5),new r("logies",-1,3),new r("ables",-1,1),new r("ismes",-1,1),new r("euses",-1,11),new r("istes",-1,1),new r("ives",-1,8),new r("ifs",-1,8),new r("usions",-1,4),new r("ations",-1,2),new r("utions",-1,4),new r("ateurs",-1,2),new r("ments",-1,15),new r("ements",30,6),new r("issements",31,12),new r("ités",-1,7),new r("ment",-1,15),new r("ement",34,6),new r("issement",35,12),new r("amment",34,13),new r("emment",34,14),new r("aux",-1,10),new r("eaux",39,9),new r("eux",-1,1),new r("ité",-1,7)],x=[new r("ira",-1,1),new r("ie",-1,1),new r("isse",-1,1),new r("issante",-1,1),new r("i",-1,1),new r("irai",4,1),new r("ir",-1,1),new r("iras",-1,1),new r("ies",-1,1),new r("îmes",-1,1),new r("isses",-1,1),new r("issantes",-1,1),new r("îtes",-1,1),new r("is",-1,1),new r("irais",13,1),new r("issais",13,1),new r("irions",-1,1),new r("issions",-1,1),new r("irons",-1,1),new r("issons",-1,1),new r("issants",-1,1),new r("it",-1,1),new r("irait",21,1),new r("issait",21,1),new r("issant",-1,1),new r("iraIent",-1,1),new r("issaIent",-1,1),new r("irent",-1,1),new r("issent",-1,1),new r("iront",-1,1),new r("ît",-1,1),new r("iriez",-1,1),new r("issiez",-1,1),new r("irez",-1,1),new r("issez",-1,1)],I=[new r("a",-1,3),new r("era",0,2),new r("asse",-1,3),new r("ante",-1,3),new r("ée",-1,2),new r("ai",-1,3),new r("erai",5,2),new r("er",-1,2),new r("as",-1,3),new r("eras",8,2),new r("âmes",-1,3),new r("asses",-1,3),new r("antes",-1,3),new r("âtes",-1,3),new r("ées",-1,2),new r("ais",-1,3),new r("erais",15,2),new r("ions",-1,1),new r("erions",17,2),new r("assions",17,3),new r("erons",-1,2),new r("ants",-1,3),new r("és",-1,2),new r("ait",-1,3),new r("erait",23,2),new r("ant",-1,3),new r("aIent",-1,3),new r("eraIent",26,2),new r("èrent",-1,2),new r("assent",-1,3),new r("eront",-1,2),new r("ât",-1,3),new r("ez",-1,2),new r("iez",32,2),new r("eriez",33,2),new r("assiez",33,3),new r("erez",32,2),new r("é",-1,2)],P=[new r("e",-1,3),new r("Ière",0,2),new r("ière",0,2),new r("ion",-1,1),new r("Ier",-1,2),new r("ier",-1,2),new r("ë",-1,4)],U=[new r("ell",-1,-1),new r("eill",-1,-1),new r("enn",-1,-1),new r("onn",-1,-1),new r("ett",-1,-1)],F=[17,65,16,1,0,0,0,0,0,0,0,0,0,0,0,128,130,103,8,5],S=[1,65,20,0,0,0,0,0,0,0,0,0,0,0,0,0,128],W=new s;this.setCurrent=function(e){W.setCurrent(e)},this.getCurrent=function(){return W.getCurrent()},this.stem=function(){var e=W.cursor;return n(),W.cursor=e,u(),W.limit_backward=e,W.cursor=W.limit,k(),W.cursor=W.limit,b(),W.cursor=W.limit,d(),W.cursor=W.limit_backward,o(),!0}};return function(e){return"function"==typeof e.update?e.update(function(e){return i.setCurrent(e),i.stem(),i.getCurrent()}):(i.setCurrent(e),i.stem(),i.getCurrent())}}(),e.Pipeline.registerFunction(e.fr.stemmer,"stemmer-fr"),e.fr.stopWordFilter=e.generateStopWordFilter("ai aie aient aies ait as au aura aurai auraient aurais aurait auras aurez auriez aurions aurons auront aux avaient avais avait avec avez aviez avions avons ayant ayez ayons c ce ceci celà ces cet cette d dans de des du elle en es est et eu eue eues eurent eus eusse eussent eusses eussiez eussions eut eux eûmes eût eûtes furent fus fusse fussent fusses fussiez fussions fut fûmes fût fûtes ici il ils j je l la le les leur leurs lui m ma mais me mes moi mon même n ne nos notre nous on ont ou par pas pour qu que quel quelle quelles quels qui s sa sans se sera serai seraient serais serait seras serez seriez serions serons seront ses soi soient sois soit sommes son sont soyez soyons suis sur t ta te tes toi ton tu un une vos votre vous y à étaient étais était étant étiez étions été étée étées étés êtes".split(" ")),e.Pipeline.registerFunction(e.fr.stopWordFilter,"stopWordFilter-fr")}}); \ No newline at end of file diff --git a/docs/assets/javascripts/lunr/min/lunr.he.min.js b/docs/assets/javascripts/lunr/min/lunr.he.min.js new file mode 100644 index 000000000..b863d3eae --- /dev/null +++ b/docs/assets/javascripts/lunr/min/lunr.he.min.js @@ -0,0 +1 @@ +!function(e,r){"function"==typeof define&&define.amd?define(r):"object"==typeof exports?module.exports=r():r()(e.lunr)}(this,function(){return function(e){if(void 0===e)throw new Error("Lunr is not present. Please include / require Lunr before this script.");if(void 0===e.stemmerSupport)throw new Error("Lunr stemmer support is not present. Please include / require Lunr stemmer support before this script.");e.he=function(){this.pipeline.reset(),this.pipeline.add(e.he.trimmer,e.he.stopWordFilter,e.he.stemmer),this.searchPipeline&&(this.searchPipeline.reset(),this.searchPipeline.add(e.he.stemmer))},e.he.wordCharacters="֑-״א-תa-zA-Za-zA-Z0-90-9",e.he.trimmer=e.trimmerSupport.generateTrimmer(e.he.wordCharacters),e.Pipeline.registerFunction(e.he.trimmer,"trimmer-he"),e.he.stemmer=function(){var e=this;return e.result=!1,e.preRemoved=!1,e.sufRemoved=!1,e.pre={pre1:"ה ו י ת",pre2:"ב כ ל מ ש כש",pre3:"הב הכ הל המ הש בש לכ",pre4:"וב וכ ול ומ וש",pre5:"מה שה כל",pre6:"מב מכ מל ממ מש",pre7:"בה בו בי בת כה כו כי כת לה לו לי לת",pre8:"ובה ובו ובי ובת וכה וכו וכי וכת ולה ולו ולי ולת"},e.suf={suf1:"ך כ ם ן נ",suf2:"ים ות וך וכ ום ון ונ הם הן יכ יך ינ ים",suf3:"תי תך תכ תם תן תנ",suf4:"ותי ותך ותכ ותם ותן ותנ",suf5:"נו כם כן הם הן",suf6:"ונו וכם וכן והם והן",suf7:"תכם תכן תנו תהם תהן",suf8:"הוא היא הם הן אני אתה את אנו אתם אתן",suf9:"ני נו כי כו כם כן תי תך תכ תם תן",suf10:"י ך כ ם ן נ ת"},e.patterns=JSON.parse('{"hebrewPatterns": [{"pt1": [{"c": "ה", "l": 0}]}, {"pt2": [{"c": "ו", "l": 0}]}, {"pt3": [{"c": "י", "l": 0}]}, {"pt4": [{"c": "ת", "l": 0}]}, {"pt5": [{"c": "מ", "l": 0}]}, {"pt6": [{"c": "ל", "l": 0}]}, {"pt7": [{"c": "ב", "l": 0}]}, {"pt8": [{"c": "כ", "l": 0}]}, {"pt9": [{"c": "ש", "l": 0}]}, {"pt10": [{"c": "כש", "l": 0}]}, {"pt11": [{"c": "בה", "l": 0}]}, {"pt12": [{"c": "וב", "l": 0}]}, {"pt13": [{"c": "וכ", "l": 0}]}, {"pt14": [{"c": "ול", "l": 0}]}, {"pt15": [{"c": "ומ", "l": 0}]}, {"pt16": [{"c": "וש", "l": 0}]}, {"pt17": [{"c": "הב", "l": 0}]}, {"pt18": [{"c": "הכ", "l": 0}]}, {"pt19": [{"c": "הל", "l": 0}]}, {"pt20": [{"c": "המ", "l": 0}]}, {"pt21": [{"c": "הש", "l": 0}]}, {"pt22": [{"c": "מה", "l": 0}]}, {"pt23": [{"c": "שה", "l": 0}]}, {"pt24": [{"c": "כל", "l": 0}]}]}'),e.execArray=["cleanWord","removeDiacritics","removeStopWords","normalizeHebrewCharacters"],e.stem=function(){var r=0;for(e.result=!1,e.preRemoved=!1,e.sufRemoved=!1;r=0)return!0},e.normalizeHebrewCharacters=function(){return e.word=e.word.replace("ך","כ"),e.word=e.word.replace("ם","מ"),e.word=e.word.replace("ן","נ"),e.word=e.word.replace("ף","פ"),e.word=e.word.replace("ץ","צ"),!1},function(r){return"function"==typeof r.update?r.update(function(r){return e.setCurrent(r),e.stem(),e.getCurrent()}):(e.setCurrent(r),e.stem(),e.getCurrent())}}(),e.Pipeline.registerFunction(e.he.stemmer,"stemmer-he"),e.he.stopWordFilter=e.generateStopWordFilter("אבל או אולי אותו אותי אותך אותם אותן אותנו אז אחר אחרות אחרי אחריכן אחרים אחרת אי איזה איך אין איפה אל אלה אלו אם אנחנו אני אף אפשר את אתה אתכם אתכן אתם אתן באיזה באיזו בגלל בין בלבד בעבור בעזרת בכל בכן בלי במידה במקום שבו ברוב בשביל בשעה ש בתוך גם דרך הוא היא היה היי היכן היתה היתי הם הן הנה הסיבה שבגללה הרי ואילו ואת זאת זה זות יהיה יוכל יוכלו יותר מדי יכול יכולה יכולות יכולים יכל יכלה יכלו יש כאן כאשר כולם כולן כזה כי כיצד כך כל כלל כמו כן כפי כש לא לאו לאיזותך לאן לבין לה להיות להם להן לו לזה לזות לי לך לכם לכן למה למעלה למעלה מ למטה למטה מ למעט למקום שבו למרות לנו לעבר לעיכן לפיכך לפני מאד מאחורי מאיזו סיבה מאין מאיפה מבלי מבעד מדוע מה מהיכן מול מחוץ מי מידע מכאן מכל מכן מלבד מן מנין מסוגל מעט מעטים מעל מצד מקום בו מתחת מתי נגד נגר נו עד עז על עלי עליו עליה עליהם עליך עלינו עם עצמה עצמהם עצמהן עצמו עצמי עצמם עצמן עצמנו פה רק שוב של שלה שלהם שלהן שלו שלי שלך שלכה שלכם שלכן שלנו שם תהיה תחת".split(" ")),e.Pipeline.registerFunction(e.he.stopWordFilter,"stopWordFilter-he")}}); \ No newline at end of file diff --git a/docs/public/assets/javascripts/lunr/min/lunr.hi.min.js b/docs/assets/javascripts/lunr/min/lunr.hi.min.js similarity index 100% rename from docs/public/assets/javascripts/lunr/min/lunr.hi.min.js rename to docs/assets/javascripts/lunr/min/lunr.hi.min.js diff --git a/docs/public/assets/javascripts/lunr/min/lunr.hu.min.js b/docs/assets/javascripts/lunr/min/lunr.hu.min.js similarity index 100% rename from docs/public/assets/javascripts/lunr/min/lunr.hu.min.js rename to docs/assets/javascripts/lunr/min/lunr.hu.min.js diff --git a/docs/public/assets/javascripts/lunr/min/lunr.hy.min.js b/docs/assets/javascripts/lunr/min/lunr.hy.min.js similarity index 100% rename from docs/public/assets/javascripts/lunr/min/lunr.hy.min.js rename to docs/assets/javascripts/lunr/min/lunr.hy.min.js diff --git a/docs/public/assets/javascripts/lunr/min/lunr.it.min.js b/docs/assets/javascripts/lunr/min/lunr.it.min.js similarity index 66% rename from docs/public/assets/javascripts/lunr/min/lunr.it.min.js rename to docs/assets/javascripts/lunr/min/lunr.it.min.js index 7fca763c5..344b6a3c0 100644 --- a/docs/public/assets/javascripts/lunr/min/lunr.it.min.js +++ b/docs/assets/javascripts/lunr/min/lunr.it.min.js @@ -15,4 +15,4 @@ * http://www.mozilla.org/MPL/ */ -!function(e,r){"function"==typeof define&&define.amd?define(r):"object"==typeof exports?module.exports=r():r()(e.lunr)}(this,function(){return function(e){if(void 0===e)throw new Error("Lunr is not present. Please include / require Lunr before this script.");if(void 0===e.stemmerSupport)throw new Error("Lunr stemmer support is not present. Please include / require Lunr stemmer support before this script.");e.it=function(){this.pipeline.reset(),this.pipeline.add(e.it.trimmer,e.it.stopWordFilter,e.it.stemmer),this.searchPipeline&&(this.searchPipeline.reset(),this.searchPipeline.add(e.it.stemmer))},e.it.wordCharacters="A-Za-zªºÀ-ÖØ-öø-ʸˠ-ˤᴀ-ᴥᴬ-ᵜᵢ-ᵥᵫ-ᵷᵹ-ᶾḀ-ỿⁱⁿₐ-ₜKÅℲⅎⅠ-ↈⱠ-ⱿꜢ-ꞇꞋ-ꞭꞰ-ꞷꟷ-ꟿꬰ-ꭚꭜ-ꭤff-stA-Za-z",e.it.trimmer=e.trimmerSupport.generateTrimmer(e.it.wordCharacters),e.Pipeline.registerFunction(e.it.trimmer,"trimmer-it"),e.it.stemmer=function(){var r=e.stemmerSupport.Among,n=e.stemmerSupport.SnowballProgram,i=new function(){function e(e,r,n){return!(!x.eq_s(1,e)||(x.ket=x.cursor,!x.in_grouping(L,97,249)))&&(x.slice_from(r),x.cursor=n,!0)}function i(){for(var r,n,i,o,t=x.cursor;;){if(x.bra=x.cursor,r=x.find_among(h,7))switch(x.ket=x.cursor,r){case 1:x.slice_from("à");continue;case 2:x.slice_from("è");continue;case 3:x.slice_from("ì");continue;case 4:x.slice_from("ò");continue;case 5:x.slice_from("ù");continue;case 6:x.slice_from("qU");continue;case 7:if(x.cursor>=x.limit)break;x.cursor++;continue}break}for(x.cursor=t;;)for(n=x.cursor;;){if(i=x.cursor,x.in_grouping(L,97,249)){if(x.bra=x.cursor,o=x.cursor,e("u","U",i))break;if(x.cursor=o,e("i","I",i))break}if(x.cursor=i,x.cursor>=x.limit)return void(x.cursor=n);x.cursor++}}function o(e){if(x.cursor=e,!x.in_grouping(L,97,249))return!1;for(;!x.out_grouping(L,97,249);){if(x.cursor>=x.limit)return!1;x.cursor++}return!0}function t(){if(x.in_grouping(L,97,249)){var e=x.cursor;if(x.out_grouping(L,97,249)){for(;!x.in_grouping(L,97,249);){if(x.cursor>=x.limit)return o(e);x.cursor++}return!0}return o(e)}return!1}function s(){var e,r=x.cursor;if(!t()){if(x.cursor=r,!x.out_grouping(L,97,249))return;if(e=x.cursor,x.out_grouping(L,97,249)){for(;!x.in_grouping(L,97,249);){if(x.cursor>=x.limit)return x.cursor=e,void(x.in_grouping(L,97,249)&&x.cursor=x.limit)return;x.cursor++}k=x.cursor}function a(){for(;!x.in_grouping(L,97,249);){if(x.cursor>=x.limit)return!1;x.cursor++}for(;!x.out_grouping(L,97,249);){if(x.cursor>=x.limit)return!1;x.cursor++}return!0}function u(){var e=x.cursor;k=x.limit,p=k,g=k,s(),x.cursor=e,a()&&(p=x.cursor,a()&&(g=x.cursor))}function c(){for(var e;;){if(x.bra=x.cursor,!(e=x.find_among(q,3)))break;switch(x.ket=x.cursor,e){case 1:x.slice_from("i");break;case 2:x.slice_from("u");break;case 3:if(x.cursor>=x.limit)return;x.cursor++}}}function w(){return k<=x.cursor}function l(){return p<=x.cursor}function m(){return g<=x.cursor}function f(){var e;if(x.ket=x.cursor,x.find_among_b(C,37)&&(x.bra=x.cursor,(e=x.find_among_b(z,5))&&w()))switch(e){case 1:x.slice_del();break;case 2:x.slice_from("e")}}function v(){var e;if(x.ket=x.cursor,!(e=x.find_among_b(S,51)))return!1;switch(x.bra=x.cursor,e){case 1:if(!m())return!1;x.slice_del();break;case 2:if(!m())return!1;x.slice_del(),x.ket=x.cursor,x.eq_s_b(2,"ic")&&(x.bra=x.cursor,m()&&x.slice_del());break;case 3:if(!m())return!1;x.slice_from("log");break;case 4:if(!m())return!1;x.slice_from("u");break;case 5:if(!m())return!1;x.slice_from("ente");break;case 6:if(!w())return!1;x.slice_del();break;case 7:if(!l())return!1;x.slice_del(),x.ket=x.cursor,e=x.find_among_b(P,4),e&&(x.bra=x.cursor,m()&&(x.slice_del(),1==e&&(x.ket=x.cursor,x.eq_s_b(2,"at")&&(x.bra=x.cursor,m()&&x.slice_del()))));break;case 8:if(!m())return!1;x.slice_del(),x.ket=x.cursor,e=x.find_among_b(F,3),e&&(x.bra=x.cursor,1==e&&m()&&x.slice_del());break;case 9:if(!m())return!1;x.slice_del(),x.ket=x.cursor,x.eq_s_b(2,"at")&&(x.bra=x.cursor,m()&&(x.slice_del(),x.ket=x.cursor,x.eq_s_b(2,"ic")&&(x.bra=x.cursor,m()&&x.slice_del())))}return!0}function b(){var e,r;x.cursor>=k&&(r=x.limit_backward,x.limit_backward=k,x.ket=x.cursor,e=x.find_among_b(W,87),e&&(x.bra=x.cursor,1==e&&x.slice_del()),x.limit_backward=r)}function d(){var e=x.limit-x.cursor;if(x.ket=x.cursor,x.in_grouping_b(y,97,242)&&(x.bra=x.cursor,w()&&(x.slice_del(),x.ket=x.cursor,x.eq_s_b(1,"i")&&(x.bra=x.cursor,w()))))return void x.slice_del();x.cursor=x.limit-e}function _(){d(),x.ket=x.cursor,x.eq_s_b(1,"h")&&(x.bra=x.cursor,x.in_grouping_b(U,99,103)&&w()&&x.slice_del())}var g,p,k,h=[new r("",-1,7),new r("qu",0,6),new r("á",0,1),new r("é",0,2),new r("í",0,3),new r("ó",0,4),new r("ú",0,5)],q=[new r("",-1,3),new r("I",0,1),new r("U",0,2)],C=[new r("la",-1,-1),new r("cela",0,-1),new r("gliela",0,-1),new r("mela",0,-1),new r("tela",0,-1),new r("vela",0,-1),new r("le",-1,-1),new r("cele",6,-1),new r("gliele",6,-1),new r("mele",6,-1),new r("tele",6,-1),new r("vele",6,-1),new r("ne",-1,-1),new r("cene",12,-1),new r("gliene",12,-1),new r("mene",12,-1),new r("sene",12,-1),new r("tene",12,-1),new r("vene",12,-1),new r("ci",-1,-1),new r("li",-1,-1),new r("celi",20,-1),new r("glieli",20,-1),new r("meli",20,-1),new r("teli",20,-1),new r("veli",20,-1),new r("gli",20,-1),new r("mi",-1,-1),new r("si",-1,-1),new r("ti",-1,-1),new r("vi",-1,-1),new r("lo",-1,-1),new r("celo",31,-1),new r("glielo",31,-1),new r("melo",31,-1),new r("telo",31,-1),new r("velo",31,-1)],z=[new r("ando",-1,1),new r("endo",-1,1),new r("ar",-1,2),new r("er",-1,2),new r("ir",-1,2)],P=[new r("ic",-1,-1),new r("abil",-1,-1),new r("os",-1,-1),new r("iv",-1,1)],F=[new r("ic",-1,1),new r("abil",-1,1),new r("iv",-1,1)],S=[new r("ica",-1,1),new r("logia",-1,3),new r("osa",-1,1),new r("ista",-1,1),new r("iva",-1,9),new r("anza",-1,1),new r("enza",-1,5),new r("ice",-1,1),new r("atrice",7,1),new r("iche",-1,1),new r("logie",-1,3),new r("abile",-1,1),new r("ibile",-1,1),new r("usione",-1,4),new r("azione",-1,2),new r("uzione",-1,4),new r("atore",-1,2),new r("ose",-1,1),new r("ante",-1,1),new r("mente",-1,1),new r("amente",19,7),new r("iste",-1,1),new r("ive",-1,9),new r("anze",-1,1),new r("enze",-1,5),new r("ici",-1,1),new r("atrici",25,1),new r("ichi",-1,1),new r("abili",-1,1),new r("ibili",-1,1),new r("ismi",-1,1),new r("usioni",-1,4),new r("azioni",-1,2),new r("uzioni",-1,4),new r("atori",-1,2),new r("osi",-1,1),new r("anti",-1,1),new r("amenti",-1,6),new r("imenti",-1,6),new r("isti",-1,1),new r("ivi",-1,9),new r("ico",-1,1),new r("ismo",-1,1),new r("oso",-1,1),new r("amento",-1,6),new r("imento",-1,6),new r("ivo",-1,9),new r("ità",-1,8),new r("istà",-1,1),new r("istè",-1,1),new r("istì",-1,1)],W=[new r("isca",-1,1),new r("enda",-1,1),new r("ata",-1,1),new r("ita",-1,1),new r("uta",-1,1),new r("ava",-1,1),new r("eva",-1,1),new r("iva",-1,1),new r("erebbe",-1,1),new r("irebbe",-1,1),new r("isce",-1,1),new r("end",-1,1),new r("are",-1,1),new r("ere",-1,1),new r("ire",-1,1),new r("asse",-1,1),new r("ate",-1,1),new r("avate",16,1),new r("evate",16,1),new r("ivate",16,1),new r("ete",-1,1),new r("erete",20,1),new r("irete",20,1),new r("ite",-1,1),new r("ereste",-1,1),new r("ireste",-1,1),new r("ute",-1,1),new r("erai",-1,1),new r("irai",-1,1),new r("isci",-1,1),new r("endi",-1,1),new r("erei",-1,1),new r("irei",-1,1),new r("assi",-1,1),new r("ati",-1,1),new r("iti",-1,1),new r("eresti",-1,1),new r("iresti",-1,1),new r("uti",-1,1),new r("avi",-1,1),new r("evi",-1,1),new r("ivi",-1,1),new r("isco",-1,1),new r("ando",-1,1),new r("endo",-1,1),new r("Yamo",-1,1),new r("iamo",-1,1),new r("avamo",-1,1),new r("evamo",-1,1),new r("ivamo",-1,1),new r("eremo",-1,1),new r("iremo",-1,1),new r("assimo",-1,1),new r("ammo",-1,1),new r("emmo",-1,1),new r("eremmo",54,1),new r("iremmo",54,1),new r("immo",-1,1),new r("ano",-1,1),new r("iscano",58,1),new r("avano",58,1),new r("evano",58,1),new r("ivano",58,1),new r("eranno",-1,1),new r("iranno",-1,1),new r("ono",-1,1),new r("iscono",65,1),new r("arono",65,1),new r("erono",65,1),new r("irono",65,1),new r("erebbero",-1,1),new r("irebbero",-1,1),new r("assero",-1,1),new r("essero",-1,1),new r("issero",-1,1),new r("ato",-1,1),new r("ito",-1,1),new r("uto",-1,1),new r("avo",-1,1),new r("evo",-1,1),new r("ivo",-1,1),new r("ar",-1,1),new r("ir",-1,1),new r("erà",-1,1),new r("irà",-1,1),new r("erò",-1,1),new r("irò",-1,1)],L=[17,65,16,0,0,0,0,0,0,0,0,0,0,0,0,128,128,8,2,1],y=[17,65,0,0,0,0,0,0,0,0,0,0,0,0,0,128,128,8,2],U=[17],x=new n;this.setCurrent=function(e){x.setCurrent(e)},this.getCurrent=function(){return x.getCurrent()},this.stem=function(){var e=x.cursor;return i(),x.cursor=e,u(),x.limit_backward=e,x.cursor=x.limit,f(),x.cursor=x.limit,v()||(x.cursor=x.limit,b()),x.cursor=x.limit,_(),x.cursor=x.limit_backward,c(),!0}};return function(e){return"function"==typeof e.update?e.update(function(e){return i.setCurrent(e),i.stem(),i.getCurrent()}):(i.setCurrent(e),i.stem(),i.getCurrent())}}(),e.Pipeline.registerFunction(e.it.stemmer,"stemmer-it"),e.it.stopWordFilter=e.generateStopWordFilter("a abbia abbiamo abbiano abbiate ad agl agli ai al all alla alle allow anche avemmo avendo avesse avessero avessi avessimo aveste avesti avete aveva avevamo avevano avevate avevi avevo avrai avranno avrebbe avrebbero avrei avremmo avremo avreste avresti avrete avrà avrò avuta avute avuti avuto c che chi ci coi col come con control cui da dagl dagli dai dal dall dalla dalle dallo degl degli dei del dell della delle dello di dov dove e ebbe ebbero ebbi ed era erano eravamo eravate eri ero essendo faccia facciamo facciano facciate faccio facemmo facendo facesse facessero facessi facessimo faceste facesti faceva facevamo facevano facevate facevi facevo fai fanno farai faranno farebbe farebbero farei faremmo faremo fareste faresti farete farà farò fece fecero feci fosse fossero fossi fossimo foste fosti fu fui fummo furono gli ha hai hanno ho i il in io l la le lei li lo loro lui ma mi mia mie miei mio ne negl negli nei nel nell nella nelle nello noi non nostra nostre nostri nostro o per perché più quale quanta quante quanti quanto quella quelle quelli quello questa queste questi questo sarai saranno sarebbe sarebbero sarei saremmo saremo sareste saresti sarete sarà sarò se sei si sia siamo siano siate siete sono sta stai stando stanno starai staranno starebbe starebbero starei staremmo staremo stareste staresti starete starà starò stava stavamo stavano stavate stavi stavo stemmo stesse stessero stessi stessimo steste stesti stette stettero stetti stia stiamo stiano stiate sto su sua sue sugl sugli sui sul sull sulla sulle sullo suo suoi ti tra tu tua tue tuo tuoi tutti tutto un una uno vi voi vostra vostre vostri vostro è".split(" ")),e.Pipeline.registerFunction(e.it.stopWordFilter,"stopWordFilter-it")}}); \ No newline at end of file +!function(e,r){"function"==typeof define&&define.amd?define(r):"object"==typeof exports?module.exports=r():r()(e.lunr)}(this,function(){return function(e){if(void 0===e)throw new Error("Lunr is not present. Please include / require Lunr before this script.");if(void 0===e.stemmerSupport)throw new Error("Lunr stemmer support is not present. Please include / require Lunr stemmer support before this script.");e.it=function(){this.pipeline.reset(),this.pipeline.add(e.it.trimmer,e.it.stopWordFilter,e.it.stemmer),this.searchPipeline&&(this.searchPipeline.reset(),this.searchPipeline.add(e.it.stemmer))},e.it.wordCharacters="A-Za-zªºÀ-ÖØ-öø-ʸˠ-ˤᴀ-ᴥᴬ-ᵜᵢ-ᵥᵫ-ᵷᵹ-ᶾḀ-ỿⁱⁿₐ-ₜKÅℲⅎⅠ-ↈⱠ-ⱿꜢ-ꞇꞋ-ꞭꞰ-ꞷꟷ-ꟿꬰ-ꭚꭜ-ꭤff-stA-Za-z",e.it.trimmer=e.trimmerSupport.generateTrimmer(e.it.wordCharacters),e.Pipeline.registerFunction(e.it.trimmer,"trimmer-it"),e.it.stemmer=function(){var r=e.stemmerSupport.Among,n=e.stemmerSupport.SnowballProgram,i=new function(){function e(e,r,n){return!(!x.eq_s(1,e)||(x.ket=x.cursor,!x.in_grouping(L,97,249)))&&(x.slice_from(r),x.cursor=n,!0)}function i(){for(var r,n,i,o,t=x.cursor;;){if(x.bra=x.cursor,r=x.find_among(h,7))switch(x.ket=x.cursor,r){case 1:x.slice_from("à");continue;case 2:x.slice_from("è");continue;case 3:x.slice_from("ì");continue;case 4:x.slice_from("ò");continue;case 5:x.slice_from("ù");continue;case 6:x.slice_from("qU");continue;case 7:if(x.cursor>=x.limit)break;x.cursor++;continue}break}for(x.cursor=t;;)for(n=x.cursor;;){if(i=x.cursor,x.in_grouping(L,97,249)){if(x.bra=x.cursor,o=x.cursor,e("u","U",i))break;if(x.cursor=o,e("i","I",i))break}if(x.cursor=i,x.cursor>=x.limit)return void(x.cursor=n);x.cursor++}}function o(e){if(x.cursor=e,!x.in_grouping(L,97,249))return!1;for(;!x.out_grouping(L,97,249);){if(x.cursor>=x.limit)return!1;x.cursor++}return!0}function t(){if(x.in_grouping(L,97,249)){var e=x.cursor;if(x.out_grouping(L,97,249)){for(;!x.in_grouping(L,97,249);){if(x.cursor>=x.limit)return o(e);x.cursor++}return!0}return o(e)}return!1}function s(){var e,r=x.cursor;if(!t()){if(x.cursor=r,!x.out_grouping(L,97,249))return;if(e=x.cursor,x.out_grouping(L,97,249)){for(;!x.in_grouping(L,97,249);){if(x.cursor>=x.limit)return x.cursor=e,void(x.in_grouping(L,97,249)&&x.cursor=x.limit)return;x.cursor++}k=x.cursor}function a(){for(;!x.in_grouping(L,97,249);){if(x.cursor>=x.limit)return!1;x.cursor++}for(;!x.out_grouping(L,97,249);){if(x.cursor>=x.limit)return!1;x.cursor++}return!0}function u(){var e=x.cursor;k=x.limit,p=k,g=k,s(),x.cursor=e,a()&&(p=x.cursor,a()&&(g=x.cursor))}function c(){for(var e;;){if(x.bra=x.cursor,!(e=x.find_among(q,3)))break;switch(x.ket=x.cursor,e){case 1:x.slice_from("i");break;case 2:x.slice_from("u");break;case 3:if(x.cursor>=x.limit)return;x.cursor++}}}function w(){return k<=x.cursor}function l(){return p<=x.cursor}function m(){return g<=x.cursor}function f(){var e;if(x.ket=x.cursor,x.find_among_b(C,37)&&(x.bra=x.cursor,(e=x.find_among_b(z,5))&&w()))switch(e){case 1:x.slice_del();break;case 2:x.slice_from("e")}}function v(){var e;if(x.ket=x.cursor,!(e=x.find_among_b(S,51)))return!1;switch(x.bra=x.cursor,e){case 1:if(!m())return!1;x.slice_del();break;case 2:if(!m())return!1;x.slice_del(),x.ket=x.cursor,x.eq_s_b(2,"ic")&&(x.bra=x.cursor,m()&&x.slice_del());break;case 3:if(!m())return!1;x.slice_from("log");break;case 4:if(!m())return!1;x.slice_from("u");break;case 5:if(!m())return!1;x.slice_from("ente");break;case 6:if(!w())return!1;x.slice_del();break;case 7:if(!l())return!1;x.slice_del(),x.ket=x.cursor,e=x.find_among_b(P,4),e&&(x.bra=x.cursor,m()&&(x.slice_del(),1==e&&(x.ket=x.cursor,x.eq_s_b(2,"at")&&(x.bra=x.cursor,m()&&x.slice_del()))));break;case 8:if(!m())return!1;x.slice_del(),x.ket=x.cursor,e=x.find_among_b(F,3),e&&(x.bra=x.cursor,1==e&&m()&&x.slice_del());break;case 9:if(!m())return!1;x.slice_del(),x.ket=x.cursor,x.eq_s_b(2,"at")&&(x.bra=x.cursor,m()&&(x.slice_del(),x.ket=x.cursor,x.eq_s_b(2,"ic")&&(x.bra=x.cursor,m()&&x.slice_del())))}return!0}function b(){var e,r;x.cursor>=k&&(r=x.limit_backward,x.limit_backward=k,x.ket=x.cursor,e=x.find_among_b(W,87),e&&(x.bra=x.cursor,1==e&&x.slice_del()),x.limit_backward=r)}function d(){var e=x.limit-x.cursor;if(x.ket=x.cursor,x.in_grouping_b(y,97,242)&&(x.bra=x.cursor,w()&&(x.slice_del(),x.ket=x.cursor,x.eq_s_b(1,"i")&&(x.bra=x.cursor,w()))))return void x.slice_del();x.cursor=x.limit-e}function _(){d(),x.ket=x.cursor,x.eq_s_b(1,"h")&&(x.bra=x.cursor,x.in_grouping_b(U,99,103)&&w()&&x.slice_del())}var g,p,k,h=[new r("",-1,7),new r("qu",0,6),new r("á",0,1),new r("é",0,2),new r("í",0,3),new r("ó",0,4),new r("ú",0,5)],q=[new r("",-1,3),new r("I",0,1),new r("U",0,2)],C=[new r("la",-1,-1),new r("cela",0,-1),new r("gliela",0,-1),new r("mela",0,-1),new r("tela",0,-1),new r("vela",0,-1),new r("le",-1,-1),new r("cele",6,-1),new r("gliele",6,-1),new r("mele",6,-1),new r("tele",6,-1),new r("vele",6,-1),new r("ne",-1,-1),new r("cene",12,-1),new r("gliene",12,-1),new r("mene",12,-1),new r("sene",12,-1),new r("tene",12,-1),new r("vene",12,-1),new r("ci",-1,-1),new r("li",-1,-1),new r("celi",20,-1),new r("glieli",20,-1),new r("meli",20,-1),new r("teli",20,-1),new r("veli",20,-1),new r("gli",20,-1),new r("mi",-1,-1),new r("si",-1,-1),new r("ti",-1,-1),new r("vi",-1,-1),new r("lo",-1,-1),new r("celo",31,-1),new r("glielo",31,-1),new r("melo",31,-1),new r("telo",31,-1),new r("velo",31,-1)],z=[new r("ando",-1,1),new r("endo",-1,1),new r("ar",-1,2),new r("er",-1,2),new r("ir",-1,2)],P=[new r("ic",-1,-1),new r("abil",-1,-1),new r("os",-1,-1),new r("iv",-1,1)],F=[new r("ic",-1,1),new r("abil",-1,1),new r("iv",-1,1)],S=[new r("ica",-1,1),new r("logia",-1,3),new r("osa",-1,1),new r("ista",-1,1),new r("iva",-1,9),new r("anza",-1,1),new r("enza",-1,5),new r("ice",-1,1),new r("atrice",7,1),new r("iche",-1,1),new r("logie",-1,3),new r("abile",-1,1),new r("ibile",-1,1),new r("usione",-1,4),new r("azione",-1,2),new r("uzione",-1,4),new r("atore",-1,2),new r("ose",-1,1),new r("ante",-1,1),new r("mente",-1,1),new r("amente",19,7),new r("iste",-1,1),new r("ive",-1,9),new r("anze",-1,1),new r("enze",-1,5),new r("ici",-1,1),new r("atrici",25,1),new r("ichi",-1,1),new r("abili",-1,1),new r("ibili",-1,1),new r("ismi",-1,1),new r("usioni",-1,4),new r("azioni",-1,2),new r("uzioni",-1,4),new r("atori",-1,2),new r("osi",-1,1),new r("anti",-1,1),new r("amenti",-1,6),new r("imenti",-1,6),new r("isti",-1,1),new r("ivi",-1,9),new r("ico",-1,1),new r("ismo",-1,1),new r("oso",-1,1),new r("amento",-1,6),new r("imento",-1,6),new r("ivo",-1,9),new r("ità",-1,8),new r("istà",-1,1),new r("istè",-1,1),new r("istì",-1,1)],W=[new r("isca",-1,1),new r("enda",-1,1),new r("ata",-1,1),new r("ita",-1,1),new r("uta",-1,1),new r("ava",-1,1),new r("eva",-1,1),new r("iva",-1,1),new r("erebbe",-1,1),new r("irebbe",-1,1),new r("isce",-1,1),new r("ende",-1,1),new r("are",-1,1),new r("ere",-1,1),new r("ire",-1,1),new r("asse",-1,1),new r("ate",-1,1),new r("avate",16,1),new r("evate",16,1),new r("ivate",16,1),new r("ete",-1,1),new r("erete",20,1),new r("irete",20,1),new r("ite",-1,1),new r("ereste",-1,1),new r("ireste",-1,1),new r("ute",-1,1),new r("erai",-1,1),new r("irai",-1,1),new r("isci",-1,1),new r("endi",-1,1),new r("erei",-1,1),new r("irei",-1,1),new r("assi",-1,1),new r("ati",-1,1),new r("iti",-1,1),new r("eresti",-1,1),new r("iresti",-1,1),new r("uti",-1,1),new r("avi",-1,1),new r("evi",-1,1),new r("ivi",-1,1),new r("isco",-1,1),new r("ando",-1,1),new r("endo",-1,1),new r("Yamo",-1,1),new r("iamo",-1,1),new r("avamo",-1,1),new r("evamo",-1,1),new r("ivamo",-1,1),new r("eremo",-1,1),new r("iremo",-1,1),new r("assimo",-1,1),new r("ammo",-1,1),new r("emmo",-1,1),new r("eremmo",54,1),new r("iremmo",54,1),new r("immo",-1,1),new r("ano",-1,1),new r("iscano",58,1),new r("avano",58,1),new r("evano",58,1),new r("ivano",58,1),new r("eranno",-1,1),new r("iranno",-1,1),new r("ono",-1,1),new r("iscono",65,1),new r("arono",65,1),new r("erono",65,1),new r("irono",65,1),new r("erebbero",-1,1),new r("irebbero",-1,1),new r("assero",-1,1),new r("essero",-1,1),new r("issero",-1,1),new r("ato",-1,1),new r("ito",-1,1),new r("uto",-1,1),new r("avo",-1,1),new r("evo",-1,1),new r("ivo",-1,1),new r("ar",-1,1),new r("ir",-1,1),new r("erà",-1,1),new r("irà",-1,1),new r("erò",-1,1),new r("irò",-1,1)],L=[17,65,16,0,0,0,0,0,0,0,0,0,0,0,0,128,128,8,2,1],y=[17,65,0,0,0,0,0,0,0,0,0,0,0,0,0,128,128,8,2],U=[17],x=new n;this.setCurrent=function(e){x.setCurrent(e)},this.getCurrent=function(){return x.getCurrent()},this.stem=function(){var e=x.cursor;return i(),x.cursor=e,u(),x.limit_backward=e,x.cursor=x.limit,f(),x.cursor=x.limit,v()||(x.cursor=x.limit,b()),x.cursor=x.limit,_(),x.cursor=x.limit_backward,c(),!0}};return function(e){return"function"==typeof e.update?e.update(function(e){return i.setCurrent(e),i.stem(),i.getCurrent()}):(i.setCurrent(e),i.stem(),i.getCurrent())}}(),e.Pipeline.registerFunction(e.it.stemmer,"stemmer-it"),e.it.stopWordFilter=e.generateStopWordFilter("a abbia abbiamo abbiano abbiate ad agl agli ai al all alla alle allo anche avemmo avendo avesse avessero avessi avessimo aveste avesti avete aveva avevamo avevano avevate avevi avevo avrai avranno avrebbe avrebbero avrei avremmo avremo avreste avresti avrete avrà avrò avuta avute avuti avuto c che chi ci coi col come con contro cui da dagl dagli dai dal dall dalla dalle dallo degl degli dei del dell della delle dello di dov dove e ebbe ebbero ebbi ed era erano eravamo eravate eri ero essendo faccia facciamo facciano facciate faccio facemmo facendo facesse facessero facessi facessimo faceste facesti faceva facevamo facevano facevate facevi facevo fai fanno farai faranno farebbe farebbero farei faremmo faremo fareste faresti farete farà farò fece fecero feci fosse fossero fossi fossimo foste fosti fu fui fummo furono gli ha hai hanno ho i il in io l la le lei li lo loro lui ma mi mia mie miei mio ne negl negli nei nel nell nella nelle nello noi non nostra nostre nostri nostro o per perché più quale quanta quante quanti quanto quella quelle quelli quello questa queste questi questo sarai saranno sarebbe sarebbero sarei saremmo saremo sareste saresti sarete sarà sarò se sei si sia siamo siano siate siete sono sta stai stando stanno starai staranno starebbe starebbero starei staremmo staremo stareste staresti starete starà starò stava stavamo stavano stavate stavi stavo stemmo stesse stessero stessi stessimo steste stesti stette stettero stetti stia stiamo stiano stiate sto su sua sue sugl sugli sui sul sull sulla sulle sullo suo suoi ti tra tu tua tue tuo tuoi tutti tutto un una uno vi voi vostra vostre vostri vostro è".split(" ")),e.Pipeline.registerFunction(e.it.stopWordFilter,"stopWordFilter-it")}}); \ No newline at end of file diff --git a/docs/public/assets/javascripts/lunr/min/lunr.ja.min.js b/docs/assets/javascripts/lunr/min/lunr.ja.min.js similarity index 100% rename from docs/public/assets/javascripts/lunr/min/lunr.ja.min.js rename to docs/assets/javascripts/lunr/min/lunr.ja.min.js diff --git a/docs/public/assets/javascripts/lunr/min/lunr.jp.min.js b/docs/assets/javascripts/lunr/min/lunr.jp.min.js similarity index 100% rename from docs/public/assets/javascripts/lunr/min/lunr.jp.min.js rename to docs/assets/javascripts/lunr/min/lunr.jp.min.js diff --git a/docs/public/assets/javascripts/lunr/min/lunr.kn.min.js b/docs/assets/javascripts/lunr/min/lunr.kn.min.js similarity index 100% rename from docs/public/assets/javascripts/lunr/min/lunr.kn.min.js rename to docs/assets/javascripts/lunr/min/lunr.kn.min.js diff --git a/docs/public/assets/javascripts/lunr/min/lunr.ko.min.js b/docs/assets/javascripts/lunr/min/lunr.ko.min.js similarity index 100% rename from docs/public/assets/javascripts/lunr/min/lunr.ko.min.js rename to docs/assets/javascripts/lunr/min/lunr.ko.min.js diff --git a/docs/public/assets/javascripts/lunr/min/lunr.multi.min.js b/docs/assets/javascripts/lunr/min/lunr.multi.min.js similarity index 100% rename from docs/public/assets/javascripts/lunr/min/lunr.multi.min.js rename to docs/assets/javascripts/lunr/min/lunr.multi.min.js diff --git a/docs/public/assets/javascripts/lunr/min/lunr.nl.min.js b/docs/assets/javascripts/lunr/min/lunr.nl.min.js similarity index 90% rename from docs/public/assets/javascripts/lunr/min/lunr.nl.min.js rename to docs/assets/javascripts/lunr/min/lunr.nl.min.js index 69e685a2e..c4a253594 100644 --- a/docs/public/assets/javascripts/lunr/min/lunr.nl.min.js +++ b/docs/assets/javascripts/lunr/min/lunr.nl.min.js @@ -15,4 +15,4 @@ * http://www.mozilla.org/MPL/ */ -!function(r,e){"function"==typeof define&&define.amd?define(e):"object"==typeof exports?module.exports=e():e()(r.lunr)}(this,function(){return function(r){if(void 0===r)throw new Error("Lunr is not present. Please include / require Lunr before this script.");if(void 0===r.stemmerSupport)throw new Error("Lunr stemmer support is not present. Please include / require Lunr stemmer support before this script.");r.nl=function(){this.pipeline.reset(),this.pipeline.add(r.nl.trimmer,r.nl.stopWordFilter,r.nl.stemmer),this.searchPipeline&&(this.searchPipeline.reset(),this.searchPipeline.add(r.nl.stemmer))},r.nl.wordCharacters="A-Za-zªºÀ-ÖØ-öø-ʸˠ-ˤᴀ-ᴥᴬ-ᵜᵢ-ᵥᵫ-ᵷᵹ-ᶾḀ-ỿⁱⁿₐ-ₜKÅℲⅎⅠ-ↈⱠ-ⱿꜢ-ꞇꞋ-ꞭꞰ-ꞷꟷ-ꟿꬰ-ꭚꭜ-ꭤff-stA-Za-z",r.nl.trimmer=r.trimmerSupport.generateTrimmer(r.nl.wordCharacters),r.Pipeline.registerFunction(r.nl.trimmer,"trimmer-nl"),r.nl.stemmer=function(){var e=r.stemmerSupport.Among,i=r.stemmerSupport.SnowballProgram,n=new function(){function r(){for(var r,e,i,o=C.cursor;;){if(C.bra=C.cursor,r=C.find_among(b,11))switch(C.ket=C.cursor,r){case 1:C.slice_from("a");continue;case 2:C.slice_from("e");continue;case 3:C.slice_from("i");continue;case 4:C.slice_from("o");continue;case 5:C.slice_from("u");continue;case 6:if(C.cursor>=C.limit)break;C.cursor++;continue}break}for(C.cursor=o,C.bra=o,C.eq_s(1,"y")?(C.ket=C.cursor,C.slice_from("Y")):C.cursor=o;;)if(e=C.cursor,C.in_grouping(q,97,232)){if(i=C.cursor,C.bra=i,C.eq_s(1,"i"))C.ket=C.cursor,C.in_grouping(q,97,232)&&(C.slice_from("I"),C.cursor=e);else if(C.cursor=i,C.eq_s(1,"y"))C.ket=C.cursor,C.slice_from("Y"),C.cursor=e;else if(n(e))break}else if(n(e))break}function n(r){return C.cursor=r,r>=C.limit||(C.cursor++,!1)}function o(){_=C.limit,d=_,t()||(_=C.cursor,_<3&&(_=3),t()||(d=C.cursor))}function t(){for(;!C.in_grouping(q,97,232);){if(C.cursor>=C.limit)return!0;C.cursor++}for(;!C.out_grouping(q,97,232);){if(C.cursor>=C.limit)return!0;C.cursor++}return!1}function s(){for(var r;;)if(C.bra=C.cursor,r=C.find_among(p,3))switch(C.ket=C.cursor,r){case 1:C.slice_from("y");break;case 2:C.slice_from("i");break;case 3:if(C.cursor>=C.limit)return;C.cursor++}}function u(){return _<=C.cursor}function c(){return d<=C.cursor}function a(){var r=C.limit-C.cursor;C.find_among_b(g,3)&&(C.cursor=C.limit-r,C.ket=C.cursor,C.cursor>C.limit_backward&&(C.cursor--,C.bra=C.cursor,C.slice_del()))}function l(){var r;w=!1,C.ket=C.cursor,C.eq_s_b(1,"e")&&(C.bra=C.cursor,u()&&(r=C.limit-C.cursor,C.out_grouping_b(q,97,232)&&(C.cursor=C.limit-r,C.slice_del(),w=!0,a())))}function m(){var r;u()&&(r=C.limit-C.cursor,C.out_grouping_b(q,97,232)&&(C.cursor=C.limit-r,C.eq_s_b(3,"gem")||(C.cursor=C.limit-r,C.slice_del(),a())))}function f(){var r,e,i,n,o,t,s=C.limit-C.cursor;if(C.ket=C.cursor,r=C.find_among_b(h,5))switch(C.bra=C.cursor,r){case 1:u()&&C.slice_from("heid");break;case 2:m();break;case 3:u()&&C.out_grouping_b(j,97,232)&&C.slice_del()}if(C.cursor=C.limit-s,l(),C.cursor=C.limit-s,C.ket=C.cursor,C.eq_s_b(4,"heid")&&(C.bra=C.cursor,c()&&(e=C.limit-C.cursor,C.eq_s_b(1,"c")||(C.cursor=C.limit-e,C.slice_del(),C.ket=C.cursor,C.eq_s_b(2,"en")&&(C.bra=C.cursor,m())))),C.cursor=C.limit-s,C.ket=C.cursor,r=C.find_among_b(k,6))switch(C.bra=C.cursor,r){case 1:if(c()){if(C.slice_del(),i=C.limit-C.cursor,C.ket=C.cursor,C.eq_s_b(2,"ig")&&(C.bra=C.cursor,c()&&(n=C.limit-C.cursor,!C.eq_s_b(1,"e")))){C.cursor=C.limit-n,C.slice_del();break}C.cursor=C.limit-i,a()}break;case 2:c()&&(o=C.limit-C.cursor,C.eq_s_b(1,"e")||(C.cursor=C.limit-o,C.slice_del()));break;case 3:c()&&(C.slice_del(),l());break;case 4:c()&&C.slice_del();break;case 5:c()&&w&&C.slice_del()}C.cursor=C.limit-s,C.out_grouping_b(z,73,232)&&(t=C.limit-C.cursor,C.find_among_b(v,4)&&C.out_grouping_b(q,97,232)&&(C.cursor=C.limit-t,C.ket=C.cursor,C.cursor>C.limit_backward&&(C.cursor--,C.bra=C.cursor,C.slice_del())))}var d,_,w,b=[new e("",-1,6),new e("á",0,1),new e("ä",0,1),new e("é",0,2),new e("ë",0,2),new e("í",0,3),new e("ï",0,3),new e("ó",0,4),new e("ö",0,4),new e("ú",0,5),new e("ü",0,5)],p=[new e("",-1,3),new e("I",0,2),new e("Y",0,1)],g=[new e("dd",-1,-1),new e("kk",-1,-1),new e("tt",-1,-1)],h=[new e("ene",-1,2),new e("se",-1,3),new e("en",-1,2),new e("heden",2,1),new e("s",-1,3)],k=[new e("end",-1,1),new e("ig",-1,2),new e("ing",-1,1),new e("lijk",-1,3),new e("baar",-1,4),new e("bar",-1,5)],v=[new e("aa",-1,-1),new e("ee",-1,-1),new e("oo",-1,-1),new e("uu",-1,-1)],q=[17,65,16,1,0,0,0,0,0,0,0,0,0,0,0,0,128],z=[1,0,0,17,65,16,1,0,0,0,0,0,0,0,0,0,0,0,0,128],j=[17,67,16,1,0,0,0,0,0,0,0,0,0,0,0,0,128],C=new i;this.setCurrent=function(r){C.setCurrent(r)},this.getCurrent=function(){return C.getCurrent()},this.stem=function(){var e=C.cursor;return r(),C.cursor=e,o(),C.limit_backward=e,C.cursor=C.limit,f(),C.cursor=C.limit_backward,s(),!0}};return function(r){return"function"==typeof r.update?r.update(function(r){return n.setCurrent(r),n.stem(),n.getCurrent()}):(n.setCurrent(r),n.stem(),n.getCurrent())}}(),r.Pipeline.registerFunction(r.nl.stemmer,"stemmer-nl"),r.nl.stopWordFilter=r.generateStopWordFilter(" aan al alles also altijd andere ben bij daar dan dat de der deze die dit doch doen door dus een eens en er ge geen geweest haar had heb hebben heeft hem het hier hij hoe hun iemand iets ik in is ja je kan kon kunnen maar me meer men met mij mijn moet na naar niet niets nog nu of om omdat onder ons ook op over reeds te tegen toch toen tot u uit uw van veel voor want waren was wat werd wezen wie wil worden wordt zal ze zelf zich zij zijn zo zonder zou".split(" ")),r.Pipeline.registerFunction(r.nl.stopWordFilter,"stopWordFilter-nl")}}); \ No newline at end of file +!function(r,e){"function"==typeof define&&define.amd?define(e):"object"==typeof exports?module.exports=e():e()(r.lunr)}(this,function(){return function(r){if(void 0===r)throw new Error("Lunr is not present. Please include / require Lunr before this script.");if(void 0===r.stemmerSupport)throw new Error("Lunr stemmer support is not present. Please include / require Lunr stemmer support before this script.");r.nl=function(){this.pipeline.reset(),this.pipeline.add(r.nl.trimmer,r.nl.stopWordFilter,r.nl.stemmer),this.searchPipeline&&(this.searchPipeline.reset(),this.searchPipeline.add(r.nl.stemmer))},r.nl.wordCharacters="A-Za-zªºÀ-ÖØ-öø-ʸˠ-ˤᴀ-ᴥᴬ-ᵜᵢ-ᵥᵫ-ᵷᵹ-ᶾḀ-ỿⁱⁿₐ-ₜKÅℲⅎⅠ-ↈⱠ-ⱿꜢ-ꞇꞋ-ꞭꞰ-ꞷꟷ-ꟿꬰ-ꭚꭜ-ꭤff-stA-Za-z",r.nl.trimmer=r.trimmerSupport.generateTrimmer(r.nl.wordCharacters),r.Pipeline.registerFunction(r.nl.trimmer,"trimmer-nl"),r.nl.stemmer=function(){var e=r.stemmerSupport.Among,i=r.stemmerSupport.SnowballProgram,n=new function(){function r(){for(var r,e,i,o=C.cursor;;){if(C.bra=C.cursor,r=C.find_among(b,11))switch(C.ket=C.cursor,r){case 1:C.slice_from("a");continue;case 2:C.slice_from("e");continue;case 3:C.slice_from("i");continue;case 4:C.slice_from("o");continue;case 5:C.slice_from("u");continue;case 6:if(C.cursor>=C.limit)break;C.cursor++;continue}break}for(C.cursor=o,C.bra=o,C.eq_s(1,"y")?(C.ket=C.cursor,C.slice_from("Y")):C.cursor=o;;)if(e=C.cursor,C.in_grouping(q,97,232)){if(i=C.cursor,C.bra=i,C.eq_s(1,"i"))C.ket=C.cursor,C.in_grouping(q,97,232)&&(C.slice_from("I"),C.cursor=e);else if(C.cursor=i,C.eq_s(1,"y"))C.ket=C.cursor,C.slice_from("Y"),C.cursor=e;else if(n(e))break}else if(n(e))break}function n(r){return C.cursor=r,r>=C.limit||(C.cursor++,!1)}function o(){_=C.limit,d=_,t()||(_=C.cursor,_<3&&(_=3),t()||(d=C.cursor))}function t(){for(;!C.in_grouping(q,97,232);){if(C.cursor>=C.limit)return!0;C.cursor++}for(;!C.out_grouping(q,97,232);){if(C.cursor>=C.limit)return!0;C.cursor++}return!1}function s(){for(var r;;)if(C.bra=C.cursor,r=C.find_among(p,3))switch(C.ket=C.cursor,r){case 1:C.slice_from("y");break;case 2:C.slice_from("i");break;case 3:if(C.cursor>=C.limit)return;C.cursor++}}function u(){return _<=C.cursor}function c(){return d<=C.cursor}function a(){var r=C.limit-C.cursor;C.find_among_b(g,3)&&(C.cursor=C.limit-r,C.ket=C.cursor,C.cursor>C.limit_backward&&(C.cursor--,C.bra=C.cursor,C.slice_del()))}function l(){var r;w=!1,C.ket=C.cursor,C.eq_s_b(1,"e")&&(C.bra=C.cursor,u()&&(r=C.limit-C.cursor,C.out_grouping_b(q,97,232)&&(C.cursor=C.limit-r,C.slice_del(),w=!0,a())))}function m(){var r;u()&&(r=C.limit-C.cursor,C.out_grouping_b(q,97,232)&&(C.cursor=C.limit-r,C.eq_s_b(3,"gem")||(C.cursor=C.limit-r,C.slice_del(),a())))}function f(){var r,e,i,n,o,t,s=C.limit-C.cursor;if(C.ket=C.cursor,r=C.find_among_b(h,5))switch(C.bra=C.cursor,r){case 1:u()&&C.slice_from("heid");break;case 2:m();break;case 3:u()&&C.out_grouping_b(j,97,232)&&C.slice_del()}if(C.cursor=C.limit-s,l(),C.cursor=C.limit-s,C.ket=C.cursor,C.eq_s_b(4,"heid")&&(C.bra=C.cursor,c()&&(e=C.limit-C.cursor,C.eq_s_b(1,"c")||(C.cursor=C.limit-e,C.slice_del(),C.ket=C.cursor,C.eq_s_b(2,"en")&&(C.bra=C.cursor,m())))),C.cursor=C.limit-s,C.ket=C.cursor,r=C.find_among_b(k,6))switch(C.bra=C.cursor,r){case 1:if(c()){if(C.slice_del(),i=C.limit-C.cursor,C.ket=C.cursor,C.eq_s_b(2,"ig")&&(C.bra=C.cursor,c()&&(n=C.limit-C.cursor,!C.eq_s_b(1,"e")))){C.cursor=C.limit-n,C.slice_del();break}C.cursor=C.limit-i,a()}break;case 2:c()&&(o=C.limit-C.cursor,C.eq_s_b(1,"e")||(C.cursor=C.limit-o,C.slice_del()));break;case 3:c()&&(C.slice_del(),l());break;case 4:c()&&C.slice_del();break;case 5:c()&&w&&C.slice_del()}C.cursor=C.limit-s,C.out_grouping_b(z,73,232)&&(t=C.limit-C.cursor,C.find_among_b(v,4)&&C.out_grouping_b(q,97,232)&&(C.cursor=C.limit-t,C.ket=C.cursor,C.cursor>C.limit_backward&&(C.cursor--,C.bra=C.cursor,C.slice_del())))}var d,_,w,b=[new e("",-1,6),new e("á",0,1),new e("ä",0,1),new e("é",0,2),new e("ë",0,2),new e("í",0,3),new e("ï",0,3),new e("ó",0,4),new e("ö",0,4),new e("ú",0,5),new e("ü",0,5)],p=[new e("",-1,3),new e("I",0,2),new e("Y",0,1)],g=[new e("dd",-1,-1),new e("kk",-1,-1),new e("tt",-1,-1)],h=[new e("ene",-1,2),new e("se",-1,3),new e("en",-1,2),new e("heden",2,1),new e("s",-1,3)],k=[new e("end",-1,1),new e("ig",-1,2),new e("ing",-1,1),new e("lijk",-1,3),new e("baar",-1,4),new e("bar",-1,5)],v=[new e("aa",-1,-1),new e("ee",-1,-1),new e("oo",-1,-1),new e("uu",-1,-1)],q=[17,65,16,1,0,0,0,0,0,0,0,0,0,0,0,0,128],z=[1,0,0,17,65,16,1,0,0,0,0,0,0,0,0,0,0,0,0,128],j=[17,67,16,1,0,0,0,0,0,0,0,0,0,0,0,0,128],C=new i;this.setCurrent=function(r){C.setCurrent(r)},this.getCurrent=function(){return C.getCurrent()},this.stem=function(){var e=C.cursor;return r(),C.cursor=e,o(),C.limit_backward=e,C.cursor=C.limit,f(),C.cursor=C.limit_backward,s(),!0}};return function(r){return"function"==typeof r.update?r.update(function(r){return n.setCurrent(r),n.stem(),n.getCurrent()}):(n.setCurrent(r),n.stem(),n.getCurrent())}}(),r.Pipeline.registerFunction(r.nl.stemmer,"stemmer-nl"),r.nl.stopWordFilter=r.generateStopWordFilter(" aan al alles als altijd andere ben bij daar dan dat de der deze die dit doch doen door dus een eens en er ge geen geweest haar had heb hebben heeft hem het hier hij hoe hun iemand iets ik in is ja je kan kon kunnen maar me meer men met mij mijn moet na naar niet niets nog nu of om omdat onder ons ook op over reeds te tegen toch toen tot u uit uw van veel voor want waren was wat werd wezen wie wil worden wordt zal ze zelf zich zij zijn zo zonder zou".split(" ")),r.Pipeline.registerFunction(r.nl.stopWordFilter,"stopWordFilter-nl")}}); \ No newline at end of file diff --git a/docs/public/assets/javascripts/lunr/min/lunr.no.min.js b/docs/assets/javascripts/lunr/min/lunr.no.min.js similarity index 90% rename from docs/public/assets/javascripts/lunr/min/lunr.no.min.js rename to docs/assets/javascripts/lunr/min/lunr.no.min.js index 38f1fba6b..92bc7e4e8 100644 --- a/docs/public/assets/javascripts/lunr/min/lunr.no.min.js +++ b/docs/assets/javascripts/lunr/min/lunr.no.min.js @@ -15,4 +15,4 @@ * http://www.mozilla.org/MPL/ */ -!function(e,r){"function"==typeof define&&define.amd?define(r):"object"==typeof exports?module.exports=r():r()(e.lunr)}(this,function(){return function(e){if(void 0===e)throw new Error("Lunr is not present. Please include / require Lunr before this script.");if(void 0===e.stemmerSupport)throw new Error("Lunr stemmer support is not present. Please include / require Lunr stemmer support before this script.");e.no=function(){this.pipeline.reset(),this.pipeline.add(e.no.trimmer,e.no.stopWordFilter,e.no.stemmer),this.searchPipeline&&(this.searchPipeline.reset(),this.searchPipeline.add(e.no.stemmer))},e.no.wordCharacters="A-Za-zªºÀ-ÖØ-öø-ʸˠ-ˤᴀ-ᴥᴬ-ᵜᵢ-ᵥᵫ-ᵷᵹ-ᶾḀ-ỿⁱⁿₐ-ₜKÅℲⅎⅠ-ↈⱠ-ⱿꜢ-ꞇꞋ-ꞭꞰ-ꞷꟷ-ꟿꬰ-ꭚꭜ-ꭤff-stA-Za-z",e.no.trimmer=e.trimmerSupport.generateTrimmer(e.no.wordCharacters),e.Pipeline.registerFunction(e.no.trimmer,"trimmer-no"),e.no.stemmer=function(){var r=e.stemmerSupport.Among,n=e.stemmerSupport.SnowballProgram,i=new function(){function e(){var e,r=w.cursor+3;if(a=w.limit,0<=r||r<=w.limit){for(s=r;;){if(e=w.cursor,w.in_grouping(d,97,248)){w.cursor=e;break}if(e>=w.limit)return;w.cursor=e+1}for(;!w.out_grouping(d,97,248);){if(w.cursor>=w.limit)return;w.cursor++}a=w.cursor,a=a&&(r=w.limit_backward,w.limit_backward=a,w.ket=w.cursor,e=w.find_among_b(m,29),w.limit_backward=r,e))switch(w.bra=w.cursor,e){case 1:w.slice_del();break;case 2:n=w.limit-w.cursor,w.in_grouping_b(c,98,122)?w.slice_del():(w.cursor=w.limit-n,w.eq_s_b(1,"k")&&w.out_grouping_b(d,97,248)&&w.slice_del());break;case 3:w.slice_from("er")}}function t(){var e,r=w.limit-w.cursor;w.cursor>=a&&(e=w.limit_backward,w.limit_backward=a,w.ket=w.cursor,w.find_among_b(u,2)?(w.bra=w.cursor,w.limit_backward=e,w.cursor=w.limit-r,w.cursor>w.limit_backward&&(w.cursor--,w.bra=w.cursor,w.slice_del())):w.limit_backward=e)}function o(){var e,r;w.cursor>=a&&(r=w.limit_backward,w.limit_backward=a,w.ket=w.cursor,e=w.find_among_b(l,11),e?(w.bra=w.cursor,w.limit_backward=r,1==e&&w.slice_del()):w.limit_backward=r)}var s,a,m=[new r("a",-1,1),new r("e",-1,1),new r("edge",1,1),new r("ande",1,1),new r("end",1,1),new r("and",1,1),new r("ene",1,1),new r("hetene",6,1),new r("erte",1,3),new r("en",-1,1),new r("heten",9,1),new r("ar",-1,1),new r("er",-1,1),new r("heter",12,1),new r("s",-1,2),new r("as",14,1),new r("es",14,1),new r("edes",16,1),new r("endes",16,1),new r("enes",16,1),new r("hetenes",19,1),new r("ens",14,1),new r("hetens",21,1),new r("ers",14,1),new r("ets",14,1),new r("et",-1,1),new r("het",25,1),new r("ert",-1,3),new r("ast",-1,1)],u=[new r("dt",-1,-1),new r("vt",-1,-1)],l=[new r("leg",-1,1),new r("eleg",0,1),new r("ig",-1,1),new r("eig",2,1),new r("lig",2,1),new r("elig",4,1),new r("els",-1,1),new r("lov",-1,1),new r("elov",7,1),new r("slov",7,1),new r("hetslov",9,1)],d=[17,65,16,1,0,0,0,0,0,0,0,0,0,0,0,0,48,0,128],c=[119,125,149,1],w=new n;this.setCurrent=function(e){w.setCurrent(e)},this.getCurrent=function(){return w.getCurrent()},this.stem=function(){var r=w.cursor;return e(),w.limit_backward=r,w.cursor=w.limit,i(),w.cursor=w.limit,t(),w.cursor=w.limit,o(),!0}};return function(e){return"function"==typeof e.update?e.update(function(e){return i.setCurrent(e),i.stem(),i.getCurrent()}):(i.setCurrent(e),i.stem(),i.getCurrent())}}(),e.Pipeline.registerFunction(e.no.stemmer,"stemmer-no"),e.no.stopWordFilter=e.generateStopWordFilter("alle at av bare begge ble blei bli blir blitt både båe da de deg dei deim deira deires dem den denne der dere deres det dette di din disse ditt du dykk dykkar då eg ein eit eitt eller elles en enn er et ett etter for fordi fra før ha hadde han hans har hennar henne hennes her hjå ho hoe honom hoss hossen hun hva hvem hver hvilke hvilken hvis hvor hvordan hvorfor i ikke ikkje ikkje ingen ingi inkje inn inni ja jeg kan kom korleis korso kun kunne kva kvar kvarhelst kven kvi kvifor man mange me med medan meg meget mellom men mi min mine mitt mot mykje ned no noe noen noka noko nokon nokor nokre nå når og også om opp oss over på samme seg self si si sia sidan siden sin sine sitt sjøl skal skulle slik so some some some somt så sånn til um upp ut uten var vart varte ved vere verte vi vil ville vore vors vort vår være være vært å".split(" ")),e.Pipeline.registerFunction(e.no.stopWordFilter,"stopWordFilter-no")}}); \ No newline at end of file +!function(e,r){"function"==typeof define&&define.amd?define(r):"object"==typeof exports?module.exports=r():r()(e.lunr)}(this,function(){return function(e){if(void 0===e)throw new Error("Lunr is not present. Please include / require Lunr before this script.");if(void 0===e.stemmerSupport)throw new Error("Lunr stemmer support is not present. Please include / require Lunr stemmer support before this script.");e.no=function(){this.pipeline.reset(),this.pipeline.add(e.no.trimmer,e.no.stopWordFilter,e.no.stemmer),this.searchPipeline&&(this.searchPipeline.reset(),this.searchPipeline.add(e.no.stemmer))},e.no.wordCharacters="A-Za-zªºÀ-ÖØ-öø-ʸˠ-ˤᴀ-ᴥᴬ-ᵜᵢ-ᵥᵫ-ᵷᵹ-ᶾḀ-ỿⁱⁿₐ-ₜKÅℲⅎⅠ-ↈⱠ-ⱿꜢ-ꞇꞋ-ꞭꞰ-ꞷꟷ-ꟿꬰ-ꭚꭜ-ꭤff-stA-Za-z",e.no.trimmer=e.trimmerSupport.generateTrimmer(e.no.wordCharacters),e.Pipeline.registerFunction(e.no.trimmer,"trimmer-no"),e.no.stemmer=function(){var r=e.stemmerSupport.Among,n=e.stemmerSupport.SnowballProgram,i=new function(){function e(){var e,r=w.cursor+3;if(a=w.limit,0<=r||r<=w.limit){for(s=r;;){if(e=w.cursor,w.in_grouping(d,97,248)){w.cursor=e;break}if(e>=w.limit)return;w.cursor=e+1}for(;!w.out_grouping(d,97,248);){if(w.cursor>=w.limit)return;w.cursor++}a=w.cursor,a=a&&(r=w.limit_backward,w.limit_backward=a,w.ket=w.cursor,e=w.find_among_b(m,29),w.limit_backward=r,e))switch(w.bra=w.cursor,e){case 1:w.slice_del();break;case 2:n=w.limit-w.cursor,w.in_grouping_b(c,98,122)?w.slice_del():(w.cursor=w.limit-n,w.eq_s_b(1,"k")&&w.out_grouping_b(d,97,248)&&w.slice_del());break;case 3:w.slice_from("er")}}function t(){var e,r=w.limit-w.cursor;w.cursor>=a&&(e=w.limit_backward,w.limit_backward=a,w.ket=w.cursor,w.find_among_b(u,2)?(w.bra=w.cursor,w.limit_backward=e,w.cursor=w.limit-r,w.cursor>w.limit_backward&&(w.cursor--,w.bra=w.cursor,w.slice_del())):w.limit_backward=e)}function o(){var e,r;w.cursor>=a&&(r=w.limit_backward,w.limit_backward=a,w.ket=w.cursor,e=w.find_among_b(l,11),e?(w.bra=w.cursor,w.limit_backward=r,1==e&&w.slice_del()):w.limit_backward=r)}var s,a,m=[new r("a",-1,1),new r("e",-1,1),new r("ede",1,1),new r("ande",1,1),new r("ende",1,1),new r("ane",1,1),new r("ene",1,1),new r("hetene",6,1),new r("erte",1,3),new r("en",-1,1),new r("heten",9,1),new r("ar",-1,1),new r("er",-1,1),new r("heter",12,1),new r("s",-1,2),new r("as",14,1),new r("es",14,1),new r("edes",16,1),new r("endes",16,1),new r("enes",16,1),new r("hetenes",19,1),new r("ens",14,1),new r("hetens",21,1),new r("ers",14,1),new r("ets",14,1),new r("et",-1,1),new r("het",25,1),new r("ert",-1,3),new r("ast",-1,1)],u=[new r("dt",-1,-1),new r("vt",-1,-1)],l=[new r("leg",-1,1),new r("eleg",0,1),new r("ig",-1,1),new r("eig",2,1),new r("lig",2,1),new r("elig",4,1),new r("els",-1,1),new r("lov",-1,1),new r("elov",7,1),new r("slov",7,1),new r("hetslov",9,1)],d=[17,65,16,1,0,0,0,0,0,0,0,0,0,0,0,0,48,0,128],c=[119,125,149,1],w=new n;this.setCurrent=function(e){w.setCurrent(e)},this.getCurrent=function(){return w.getCurrent()},this.stem=function(){var r=w.cursor;return e(),w.limit_backward=r,w.cursor=w.limit,i(),w.cursor=w.limit,t(),w.cursor=w.limit,o(),!0}};return function(e){return"function"==typeof e.update?e.update(function(e){return i.setCurrent(e),i.stem(),i.getCurrent()}):(i.setCurrent(e),i.stem(),i.getCurrent())}}(),e.Pipeline.registerFunction(e.no.stemmer,"stemmer-no"),e.no.stopWordFilter=e.generateStopWordFilter("alle at av bare begge ble blei bli blir blitt både båe da de deg dei deim deira deires dem den denne der dere deres det dette di din disse ditt du dykk dykkar då eg ein eit eitt eller elles en enn er et ett etter for fordi fra før ha hadde han hans har hennar henne hennes her hjå ho hoe honom hoss hossen hun hva hvem hver hvilke hvilken hvis hvor hvordan hvorfor i ikke ikkje ikkje ingen ingi inkje inn inni ja jeg kan kom korleis korso kun kunne kva kvar kvarhelst kven kvi kvifor man mange me med medan meg meget mellom men mi min mine mitt mot mykje ned no noe noen noka noko nokon nokor nokre nå når og også om opp oss over på samme seg selv si si sia sidan siden sin sine sitt sjøl skal skulle slik so som som somme somt så sånn til um upp ut uten var vart varte ved vere verte vi vil ville vore vors vort vår være være vært å".split(" ")),e.Pipeline.registerFunction(e.no.stopWordFilter,"stopWordFilter-no")}}); \ No newline at end of file diff --git a/docs/public/assets/javascripts/lunr/min/lunr.pt.min.js b/docs/assets/javascripts/lunr/min/lunr.pt.min.js similarity index 58% rename from docs/public/assets/javascripts/lunr/min/lunr.pt.min.js rename to docs/assets/javascripts/lunr/min/lunr.pt.min.js index ae6b1f9fd..6c16996d6 100644 --- a/docs/public/assets/javascripts/lunr/min/lunr.pt.min.js +++ b/docs/assets/javascripts/lunr/min/lunr.pt.min.js @@ -15,4 +15,4 @@ * http://www.mozilla.org/MPL/ */ -!function(e,r){"function"==typeof define&&define.amd?define(r):"object"==typeof exports?module.exports=r():r()(e.lunr)}(this,function(){return function(e){if(void 0===e)throw new Error("Lunr is not present. Please include / require Lunr before this script.");if(void 0===e.stemmerSupport)throw new Error("Lunr stemmer support is not present. Please include / require Lunr stemmer support before this script.");e.pt=function(){this.pipeline.reset(),this.pipeline.add(e.pt.trimmer,e.pt.stopWordFilter,e.pt.stemmer),this.searchPipeline&&(this.searchPipeline.reset(),this.searchPipeline.add(e.pt.stemmer))},e.pt.wordCharacters="A-Za-zªºÀ-ÖØ-öø-ʸˠ-ˤᴀ-ᴥᴬ-ᵜᵢ-ᵥᵫ-ᵷᵹ-ᶾḀ-ỿⁱⁿₐ-ₜKÅℲⅎⅠ-ↈⱠ-ⱿꜢ-ꞇꞋ-ꞭꞰ-ꞷꟷ-ꟿꬰ-ꭚꭜ-ꭤff-stA-Za-z",e.pt.trimmer=e.trimmerSupport.generateTrimmer(e.pt.wordCharacters),e.Pipeline.registerFunction(e.pt.trimmer,"trimmer-pt"),e.pt.stemmer=function(){var r=e.stemmerSupport.Among,s=e.stemmerSupport.SnowballProgram,n=new function(){function e(){for(var e;;){if(z.bra=z.cursor,e=z.find_among(k,3))switch(z.ket=z.cursor,e){case 1:z.slice_from("a~");continue;case 2:z.slice_from("o~");continue;case 3:if(z.cursor>=z.limit)break;z.cursor++;continue}break}}function n(){if(z.out_grouping(y,97,250)){for(;!z.in_grouping(y,97,250);){if(z.cursor>=z.limit)return!0;z.cursor++}return!1}return!0}function i(){if(z.in_grouping(y,97,250))for(;!z.out_grouping(y,97,250);){if(z.cursor>=z.limit)return!1;z.cursor++}return g=z.cursor,!0}function o(){var e,r,s=z.cursor;if(z.in_grouping(y,97,250))if(e=z.cursor,n()){if(z.cursor=e,i())return}else g=z.cursor;if(z.cursor=s,z.out_grouping(y,97,250)){if(r=z.cursor,n()){if(z.cursor=r,!z.in_grouping(y,97,250)||z.cursor>=z.limit)return;z.cursor++}g=z.cursor}}function t(){for(;!z.in_grouping(y,97,250);){if(z.cursor>=z.limit)return!1;z.cursor++}for(;!z.out_grouping(y,97,250);){if(z.cursor>=z.limit)return!1;z.cursor++}return!0}function a(){var e=z.cursor;g=z.limit,b=g,h=g,o(),z.cursor=e,t()&&(b=z.cursor,t()&&(h=z.cursor))}function u(){for(var e;;){if(z.bra=z.cursor,e=z.find_among(q,3))switch(z.ket=z.cursor,e){case 1:z.slice_from("ã");continue;case 2:z.slice_from("õ");continue;case 3:if(z.cursor>=z.limit)break;z.cursor++;continue}break}}function w(){return g<=z.cursor}function m(){return b<=z.cursor}function c(){return h<=z.cursor}function l(){var e;if(z.ket=z.cursor,!(e=z.find_among_b(F,45)))return!1;switch(z.bra=z.cursor,e){case 1:if(!c())return!1;z.slice_del();break;case 2:if(!c())return!1;z.slice_from("log");break;case 3:if(!c())return!1;z.slice_from("u");break;case 4:if(!c())return!1;z.slice_from("ente");break;case 5:if(!m())return!1;z.slice_del(),z.ket=z.cursor,e=z.find_among_b(j,4),e&&(z.bra=z.cursor,c()&&(z.slice_del(),1==e&&(z.ket=z.cursor,z.eq_s_b(2,"at")&&(z.bra=z.cursor,c()&&z.slice_del()))));break;case 6:if(!c())return!1;z.slice_del(),z.ket=z.cursor,e=z.find_among_b(C,3),e&&(z.bra=z.cursor,1==e&&c()&&z.slice_del());break;case 7:if(!c())return!1;z.slice_del(),z.ket=z.cursor,e=z.find_among_b(P,3),e&&(z.bra=z.cursor,1==e&&c()&&z.slice_del());break;case 8:if(!c())return!1;z.slice_del(),z.ket=z.cursor,z.eq_s_b(2,"at")&&(z.bra=z.cursor,c()&&z.slice_del());break;case 9:if(!w()||!z.eq_s_b(1,"e"))return!1;z.slice_from("ir")}return!0}function f(){var e,r;if(z.cursor>=g){if(r=z.limit_backward,z.limit_backward=g,z.ket=z.cursor,e=z.find_among_b(S,120))return z.bra=z.cursor,1==e&&z.slice_del(),z.limit_backward=r,!0;z.limit_backward=r}return!1}function d(){var e;z.ket=z.cursor,(e=z.find_among_b(W,7))&&(z.bra=z.cursor,1==e&&w()&&z.slice_del())}function v(e,r){if(z.eq_s_b(1,e)){z.bra=z.cursor;var s=z.limit-z.cursor;if(z.eq_s_b(1,r))return z.cursor=z.limit-s,w()&&z.slice_del(),!1}return!0}function p(){var e;if(z.ket=z.cursor,e=z.find_among_b(L,4))switch(z.bra=z.cursor,e){case 1:w()&&(z.slice_del(),z.ket=z.cursor,z.limit-z.cursor,v("u","g")&&v("i","c"));break;case 2:z.slice_from("c")}}function _(){if(!l()&&(z.cursor=z.limit,!f()))return z.cursor=z.limit,void d();z.cursor=z.limit,z.ket=z.cursor,z.eq_s_b(1,"i")&&(z.bra=z.cursor,z.eq_s_b(1,"c")&&(z.cursor=z.limit,w()&&z.slice_del()))}var h,b,g,k=[new r("",-1,3),new r("ã",0,1),new r("õ",0,2)],q=[new r("",-1,3),new r("a~",0,1),new r("o~",0,2)],j=[new r("ic",-1,-1),new r("ad",-1,-1),new r("os",-1,-1),new r("iv",-1,1)],C=[new r("ante",-1,1),new r("avel",-1,1),new r("ível",-1,1)],P=[new r("ic",-1,1),new r("abil",-1,1),new r("iv",-1,1)],F=[new r("ica",-1,1),new r("ância",-1,1),new r("ência",-1,4),new r("ira",-1,9),new r("adora",-1,1),new r("osa",-1,1),new r("ista",-1,1),new r("iva",-1,8),new r("eza",-1,1),new r("logía",-1,2),new r("idade",-1,7),new r("ante",-1,1),new r("mente",-1,6),new r("amente",12,5),new r("ável",-1,1),new r("ível",-1,1),new r("ución",-1,3),new r("ico",-1,1),new r("ismo",-1,1),new r("oso",-1,1),new r("amento",-1,1),new r("imento",-1,1),new r("ivo",-1,8),new r("aça~o",-1,1),new r("ador",-1,1),new r("icas",-1,1),new r("ências",-1,4),new r("iras",-1,9),new r("adoras",-1,1),new r("osas",-1,1),new r("istas",-1,1),new r("ivas",-1,8),new r("ezas",-1,1),new r("logías",-1,2),new r("idades",-1,7),new r("uciones",-1,3),new r("adores",-1,1),new r("antes",-1,1),new r("aço~es",-1,1),new r("icos",-1,1),new r("ismos",-1,1),new r("osos",-1,1),new r("amentos",-1,1),new r("imentos",-1,1),new r("ivos",-1,8)],S=[new r("ada",-1,1),new r("ida",-1,1),new r("ia",-1,1),new r("aria",2,1),new r("eria",2,1),new r("iria",2,1),new r("ara",-1,1),new r("era",-1,1),new r("ira",-1,1),new r("ava",-1,1),new r("asse",-1,1),new r("esse",-1,1),new r("issue",-1,1),new r("aste",-1,1),new r("este",-1,1),new r("iste",-1,1),new r("ei",-1,1),new r("arei",16,1),new r("erei",16,1),new r("irei",16,1),new r("am",-1,1),new r("iam",20,1),new r("ariam",21,1),new r("eriam",21,1),new r("iriam",21,1),new r("aram",20,1),new r("eram",20,1),new r("iram",20,1),new r("avam",20,1),new r("em",-1,1),new r("arem",29,1),new r("erem",29,1),new r("irem",29,1),new r("assem",29,1),new r("essem",29,1),new r("issem",29,1),new r("ado",-1,1),new r("ido",-1,1),new r("ando",-1,1),new r("endo",-1,1),new r("indo",-1,1),new r("ara~o",-1,1),new r("era~o",-1,1),new r("ira~o",-1,1),new r("ar",-1,1),new r("er",-1,1),new r("ir",-1,1),new r("as",-1,1),new r("adas",47,1),new r("idas",47,1),new r("ias",47,1),new r("arias",50,1),new r("erias",50,1),new r("irias",50,1),new r("aras",47,1),new r("eras",47,1),new r("iras",47,1),new r("avas",47,1),new r("es",-1,1),new r("ardes",58,1),new r("erdes",58,1),new r("irdes",58,1),new r("ares",58,1),new r("eres",58,1),new r("ires",58,1),new r("asses",58,1),new r("esses",58,1),new r("issues",58,1),new r("astes",58,1),new r("estes",58,1),new r("istes",58,1),new r("is",-1,1),new r("ais",71,1),new r("eis",71,1),new r("areis",73,1),new r("ereis",73,1),new r("ireis",73,1),new r("áreis",73,1),new r("éreis",73,1),new r("íreis",73,1),new r("ásseis",73,1),new r("ésseis",73,1),new r("ísseis",73,1),new r("áveis",73,1),new r("íeis",73,1),new r("aríeis",84,1),new r("eríeis",84,1),new r("iríeis",84,1),new r("ados",-1,1),new r("idos",-1,1),new r("amos",-1,1),new r("áramos",90,1),new r("éramos",90,1),new r("íramos",90,1),new r("ávamos",90,1),new r("íamos",90,1),new r("aríamos",95,1),new r("eríamos",95,1),new r("iríamos",95,1),new r("emos",-1,1),new r("aremos",99,1),new r("eremos",99,1),new r("iremos",99,1),new r("ássemos",99,1),new r("êssemos",99,1),new r("íssemos",99,1),new r("imos",-1,1),new r("armos",-1,1),new r("ermos",-1,1),new r("irmos",-1,1),new r("ámos",-1,1),new r("arás",-1,1),new r("erás",-1,1),new r("irás",-1,1),new r("eu",-1,1),new r("iu",-1,1),new r("ou",-1,1),new r("ará",-1,1),new r("erá",-1,1),new r("irá",-1,1)],W=[new r("a",-1,1),new r("i",-1,1),new r("o",-1,1),new r("os",-1,1),new r("á",-1,1),new r("í",-1,1),new r("ó",-1,1)],L=[new r("e",-1,1),new r("ç",-1,2),new r("é",-1,1),new r("ê",-1,1)],y=[17,65,16,0,0,0,0,0,0,0,0,0,0,0,0,0,3,19,12,2],z=new s;this.setCurrent=function(e){z.setCurrent(e)},this.getCurrent=function(){return z.getCurrent()},this.stem=function(){var r=z.cursor;return e(),z.cursor=r,a(),z.limit_backward=r,z.cursor=z.limit,_(),z.cursor=z.limit,p(),z.cursor=z.limit_backward,u(),!0}};return function(e){return"function"==typeof e.update?e.update(function(e){return n.setCurrent(e),n.stem(),n.getCurrent()}):(n.setCurrent(e),n.stem(),n.getCurrent())}}(),e.Pipeline.registerFunction(e.pt.stemmer,"stemmer-pt"),e.pt.stopWordFilter=e.generateStopWordFilter("a ao aos aquela aquelas aquele aqueles aquilo as até com como da das de dela delas dele deles depois do dos e ela elas ele eles em entre era eram essa essas esse esses esta estamos estas estava estavam este esteja estejam estejamos estes esteve estive estivemos estiver estivera estiveram estiverem estivermos estivesse estivessem estivéramos estivéssemos estou está estávamos estão eu foi fomos for fora foram forem formos fosse fossem fui fôramos fôssemos haja hajam hajamos havemos hei houve houvemos houver houvera houveram houverei houverem houveremos houveria houveriam houvermos houverá houverão houveríamos houvesse houvessem houvéramos houvéssemos há hão isso isto já lhe lhes mais mas me mesmo meu meus minha minhas muito na nas nem no nos nossa nossas nosso nossos num numa não nós o os ou para pela pelas pelo pelos por qual quando que quem se seja sejam sejamos sem serei seremos seria seriam será serão seríamos seu seus somos sou sua suas são só também te tem temos tenha tenham tenhamos tenho terei teremos teria teriam terá terão teríamos teu teus teve tinha tinham tive tivemos tiver tivera tiveram tiverem tivermos tivesse tivessem tivéramos tivéssemos tu tua tuas tém tínhamos um uma você vocês vos à às éramos".split(" ")),e.Pipeline.registerFunction(e.pt.stopWordFilter,"stopWordFilter-pt")}}); \ No newline at end of file +!function(e,r){"function"==typeof define&&define.amd?define(r):"object"==typeof exports?module.exports=r():r()(e.lunr)}(this,function(){return function(e){if(void 0===e)throw new Error("Lunr is not present. Please include / require Lunr before this script.");if(void 0===e.stemmerSupport)throw new Error("Lunr stemmer support is not present. Please include / require Lunr stemmer support before this script.");e.pt=function(){this.pipeline.reset(),this.pipeline.add(e.pt.trimmer,e.pt.stopWordFilter,e.pt.stemmer),this.searchPipeline&&(this.searchPipeline.reset(),this.searchPipeline.add(e.pt.stemmer))},e.pt.wordCharacters="A-Za-zªºÀ-ÖØ-öø-ʸˠ-ˤᴀ-ᴥᴬ-ᵜᵢ-ᵥᵫ-ᵷᵹ-ᶾḀ-ỿⁱⁿₐ-ₜKÅℲⅎⅠ-ↈⱠ-ⱿꜢ-ꞇꞋ-ꞭꞰ-ꞷꟷ-ꟿꬰ-ꭚꭜ-ꭤff-stA-Za-z",e.pt.trimmer=e.trimmerSupport.generateTrimmer(e.pt.wordCharacters),e.Pipeline.registerFunction(e.pt.trimmer,"trimmer-pt"),e.pt.stemmer=function(){var r=e.stemmerSupport.Among,s=e.stemmerSupport.SnowballProgram,n=new function(){function e(){for(var e;;){if(z.bra=z.cursor,e=z.find_among(k,3))switch(z.ket=z.cursor,e){case 1:z.slice_from("a~");continue;case 2:z.slice_from("o~");continue;case 3:if(z.cursor>=z.limit)break;z.cursor++;continue}break}}function n(){if(z.out_grouping(y,97,250)){for(;!z.in_grouping(y,97,250);){if(z.cursor>=z.limit)return!0;z.cursor++}return!1}return!0}function i(){if(z.in_grouping(y,97,250))for(;!z.out_grouping(y,97,250);){if(z.cursor>=z.limit)return!1;z.cursor++}return g=z.cursor,!0}function o(){var e,r,s=z.cursor;if(z.in_grouping(y,97,250))if(e=z.cursor,n()){if(z.cursor=e,i())return}else g=z.cursor;if(z.cursor=s,z.out_grouping(y,97,250)){if(r=z.cursor,n()){if(z.cursor=r,!z.in_grouping(y,97,250)||z.cursor>=z.limit)return;z.cursor++}g=z.cursor}}function t(){for(;!z.in_grouping(y,97,250);){if(z.cursor>=z.limit)return!1;z.cursor++}for(;!z.out_grouping(y,97,250);){if(z.cursor>=z.limit)return!1;z.cursor++}return!0}function a(){var e=z.cursor;g=z.limit,b=g,h=g,o(),z.cursor=e,t()&&(b=z.cursor,t()&&(h=z.cursor))}function u(){for(var e;;){if(z.bra=z.cursor,e=z.find_among(q,3))switch(z.ket=z.cursor,e){case 1:z.slice_from("ã");continue;case 2:z.slice_from("õ");continue;case 3:if(z.cursor>=z.limit)break;z.cursor++;continue}break}}function w(){return g<=z.cursor}function m(){return b<=z.cursor}function c(){return h<=z.cursor}function l(){var e;if(z.ket=z.cursor,!(e=z.find_among_b(F,45)))return!1;switch(z.bra=z.cursor,e){case 1:if(!c())return!1;z.slice_del();break;case 2:if(!c())return!1;z.slice_from("log");break;case 3:if(!c())return!1;z.slice_from("u");break;case 4:if(!c())return!1;z.slice_from("ente");break;case 5:if(!m())return!1;z.slice_del(),z.ket=z.cursor,e=z.find_among_b(j,4),e&&(z.bra=z.cursor,c()&&(z.slice_del(),1==e&&(z.ket=z.cursor,z.eq_s_b(2,"at")&&(z.bra=z.cursor,c()&&z.slice_del()))));break;case 6:if(!c())return!1;z.slice_del(),z.ket=z.cursor,e=z.find_among_b(C,3),e&&(z.bra=z.cursor,1==e&&c()&&z.slice_del());break;case 7:if(!c())return!1;z.slice_del(),z.ket=z.cursor,e=z.find_among_b(P,3),e&&(z.bra=z.cursor,1==e&&c()&&z.slice_del());break;case 8:if(!c())return!1;z.slice_del(),z.ket=z.cursor,z.eq_s_b(2,"at")&&(z.bra=z.cursor,c()&&z.slice_del());break;case 9:if(!w()||!z.eq_s_b(1,"e"))return!1;z.slice_from("ir")}return!0}function f(){var e,r;if(z.cursor>=g){if(r=z.limit_backward,z.limit_backward=g,z.ket=z.cursor,e=z.find_among_b(S,120))return z.bra=z.cursor,1==e&&z.slice_del(),z.limit_backward=r,!0;z.limit_backward=r}return!1}function d(){var e;z.ket=z.cursor,(e=z.find_among_b(W,7))&&(z.bra=z.cursor,1==e&&w()&&z.slice_del())}function v(e,r){if(z.eq_s_b(1,e)){z.bra=z.cursor;var s=z.limit-z.cursor;if(z.eq_s_b(1,r))return z.cursor=z.limit-s,w()&&z.slice_del(),!1}return!0}function p(){var e;if(z.ket=z.cursor,e=z.find_among_b(L,4))switch(z.bra=z.cursor,e){case 1:w()&&(z.slice_del(),z.ket=z.cursor,z.limit-z.cursor,v("u","g")&&v("i","c"));break;case 2:z.slice_from("c")}}function _(){if(!l()&&(z.cursor=z.limit,!f()))return z.cursor=z.limit,void d();z.cursor=z.limit,z.ket=z.cursor,z.eq_s_b(1,"i")&&(z.bra=z.cursor,z.eq_s_b(1,"c")&&(z.cursor=z.limit,w()&&z.slice_del()))}var h,b,g,k=[new r("",-1,3),new r("ã",0,1),new r("õ",0,2)],q=[new r("",-1,3),new r("a~",0,1),new r("o~",0,2)],j=[new r("ic",-1,-1),new r("ad",-1,-1),new r("os",-1,-1),new r("iv",-1,1)],C=[new r("ante",-1,1),new r("avel",-1,1),new r("ível",-1,1)],P=[new r("ic",-1,1),new r("abil",-1,1),new r("iv",-1,1)],F=[new r("ica",-1,1),new r("ância",-1,1),new r("ência",-1,4),new r("ira",-1,9),new r("adora",-1,1),new r("osa",-1,1),new r("ista",-1,1),new r("iva",-1,8),new r("eza",-1,1),new r("logía",-1,2),new r("idade",-1,7),new r("ante",-1,1),new r("mente",-1,6),new r("amente",12,5),new r("ável",-1,1),new r("ível",-1,1),new r("ución",-1,3),new r("ico",-1,1),new r("ismo",-1,1),new r("oso",-1,1),new r("amento",-1,1),new r("imento",-1,1),new r("ivo",-1,8),new r("aça~o",-1,1),new r("ador",-1,1),new r("icas",-1,1),new r("ências",-1,4),new r("iras",-1,9),new r("adoras",-1,1),new r("osas",-1,1),new r("istas",-1,1),new r("ivas",-1,8),new r("ezas",-1,1),new r("logías",-1,2),new r("idades",-1,7),new r("uciones",-1,3),new r("adores",-1,1),new r("antes",-1,1),new r("aço~es",-1,1),new r("icos",-1,1),new r("ismos",-1,1),new r("osos",-1,1),new r("amentos",-1,1),new r("imentos",-1,1),new r("ivos",-1,8)],S=[new r("ada",-1,1),new r("ida",-1,1),new r("ia",-1,1),new r("aria",2,1),new r("eria",2,1),new r("iria",2,1),new r("ara",-1,1),new r("era",-1,1),new r("ira",-1,1),new r("ava",-1,1),new r("asse",-1,1),new r("esse",-1,1),new r("isse",-1,1),new r("aste",-1,1),new r("este",-1,1),new r("iste",-1,1),new r("ei",-1,1),new r("arei",16,1),new r("erei",16,1),new r("irei",16,1),new r("am",-1,1),new r("iam",20,1),new r("ariam",21,1),new r("eriam",21,1),new r("iriam",21,1),new r("aram",20,1),new r("eram",20,1),new r("iram",20,1),new r("avam",20,1),new r("em",-1,1),new r("arem",29,1),new r("erem",29,1),new r("irem",29,1),new r("assem",29,1),new r("essem",29,1),new r("issem",29,1),new r("ado",-1,1),new r("ido",-1,1),new r("ando",-1,1),new r("endo",-1,1),new r("indo",-1,1),new r("ara~o",-1,1),new r("era~o",-1,1),new r("ira~o",-1,1),new r("ar",-1,1),new r("er",-1,1),new r("ir",-1,1),new r("as",-1,1),new r("adas",47,1),new r("idas",47,1),new r("ias",47,1),new r("arias",50,1),new r("erias",50,1),new r("irias",50,1),new r("aras",47,1),new r("eras",47,1),new r("iras",47,1),new r("avas",47,1),new r("es",-1,1),new r("ardes",58,1),new r("erdes",58,1),new r("irdes",58,1),new r("ares",58,1),new r("eres",58,1),new r("ires",58,1),new r("asses",58,1),new r("esses",58,1),new r("isses",58,1),new r("astes",58,1),new r("estes",58,1),new r("istes",58,1),new r("is",-1,1),new r("ais",71,1),new r("eis",71,1),new r("areis",73,1),new r("ereis",73,1),new r("ireis",73,1),new r("áreis",73,1),new r("éreis",73,1),new r("íreis",73,1),new r("ásseis",73,1),new r("ésseis",73,1),new r("ísseis",73,1),new r("áveis",73,1),new r("íeis",73,1),new r("aríeis",84,1),new r("eríeis",84,1),new r("iríeis",84,1),new r("ados",-1,1),new r("idos",-1,1),new r("amos",-1,1),new r("áramos",90,1),new r("éramos",90,1),new r("íramos",90,1),new r("ávamos",90,1),new r("íamos",90,1),new r("aríamos",95,1),new r("eríamos",95,1),new r("iríamos",95,1),new r("emos",-1,1),new r("aremos",99,1),new r("eremos",99,1),new r("iremos",99,1),new r("ássemos",99,1),new r("êssemos",99,1),new r("íssemos",99,1),new r("imos",-1,1),new r("armos",-1,1),new r("ermos",-1,1),new r("irmos",-1,1),new r("ámos",-1,1),new r("arás",-1,1),new r("erás",-1,1),new r("irás",-1,1),new r("eu",-1,1),new r("iu",-1,1),new r("ou",-1,1),new r("ará",-1,1),new r("erá",-1,1),new r("irá",-1,1)],W=[new r("a",-1,1),new r("i",-1,1),new r("o",-1,1),new r("os",-1,1),new r("á",-1,1),new r("í",-1,1),new r("ó",-1,1)],L=[new r("e",-1,1),new r("ç",-1,2),new r("é",-1,1),new r("ê",-1,1)],y=[17,65,16,0,0,0,0,0,0,0,0,0,0,0,0,0,3,19,12,2],z=new s;this.setCurrent=function(e){z.setCurrent(e)},this.getCurrent=function(){return z.getCurrent()},this.stem=function(){var r=z.cursor;return e(),z.cursor=r,a(),z.limit_backward=r,z.cursor=z.limit,_(),z.cursor=z.limit,p(),z.cursor=z.limit_backward,u(),!0}};return function(e){return"function"==typeof e.update?e.update(function(e){return n.setCurrent(e),n.stem(),n.getCurrent()}):(n.setCurrent(e),n.stem(),n.getCurrent())}}(),e.Pipeline.registerFunction(e.pt.stemmer,"stemmer-pt"),e.pt.stopWordFilter=e.generateStopWordFilter("a ao aos aquela aquelas aquele aqueles aquilo as até com como da das de dela delas dele deles depois do dos e ela elas ele eles em entre era eram essa essas esse esses esta estamos estas estava estavam este esteja estejam estejamos estes esteve estive estivemos estiver estivera estiveram estiverem estivermos estivesse estivessem estivéramos estivéssemos estou está estávamos estão eu foi fomos for fora foram forem formos fosse fossem fui fôramos fôssemos haja hajam hajamos havemos hei houve houvemos houver houvera houveram houverei houverem houveremos houveria houveriam houvermos houverá houverão houveríamos houvesse houvessem houvéramos houvéssemos há hão isso isto já lhe lhes mais mas me mesmo meu meus minha minhas muito na nas nem no nos nossa nossas nosso nossos num numa não nós o os ou para pela pelas pelo pelos por qual quando que quem se seja sejam sejamos sem serei seremos seria seriam será serão seríamos seu seus somos sou sua suas são só também te tem temos tenha tenham tenhamos tenho terei teremos teria teriam terá terão teríamos teu teus teve tinha tinham tive tivemos tiver tivera tiveram tiverem tivermos tivesse tivessem tivéramos tivéssemos tu tua tuas tém tínhamos um uma você vocês vos à às éramos".split(" ")),e.Pipeline.registerFunction(e.pt.stopWordFilter,"stopWordFilter-pt")}}); \ No newline at end of file diff --git a/docs/public/assets/javascripts/lunr/min/lunr.ro.min.js b/docs/assets/javascripts/lunr/min/lunr.ro.min.js similarity index 100% rename from docs/public/assets/javascripts/lunr/min/lunr.ro.min.js rename to docs/assets/javascripts/lunr/min/lunr.ro.min.js diff --git a/docs/public/assets/javascripts/lunr/min/lunr.ru.min.js b/docs/assets/javascripts/lunr/min/lunr.ru.min.js similarity index 100% rename from docs/public/assets/javascripts/lunr/min/lunr.ru.min.js rename to docs/assets/javascripts/lunr/min/lunr.ru.min.js diff --git a/docs/public/assets/javascripts/lunr/min/lunr.sa.min.js b/docs/assets/javascripts/lunr/min/lunr.sa.min.js similarity index 100% rename from docs/public/assets/javascripts/lunr/min/lunr.sa.min.js rename to docs/assets/javascripts/lunr/min/lunr.sa.min.js diff --git a/docs/public/assets/javascripts/lunr/min/lunr.stemmer.support.min.js b/docs/assets/javascripts/lunr/min/lunr.stemmer.support.min.js similarity index 100% rename from docs/public/assets/javascripts/lunr/min/lunr.stemmer.support.min.js rename to docs/assets/javascripts/lunr/min/lunr.stemmer.support.min.js diff --git a/docs/public/assets/javascripts/lunr/min/lunr.sv.min.js b/docs/assets/javascripts/lunr/min/lunr.sv.min.js similarity index 94% rename from docs/public/assets/javascripts/lunr/min/lunr.sv.min.js rename to docs/assets/javascripts/lunr/min/lunr.sv.min.js index 9361f4c31..3e5eb6400 100644 --- a/docs/public/assets/javascripts/lunr/min/lunr.sv.min.js +++ b/docs/assets/javascripts/lunr/min/lunr.sv.min.js @@ -15,4 +15,4 @@ * http://www.mozilla.org/MPL/ */ -!function(e,r){"function"==typeof define&&define.amd?define(r):"object"==typeof exports?module.exports=r():r()(e.lunr)}(this,function(){return function(e){if(void 0===e)throw new Error("Lunr is not present. Please include / require Lunr before this script.");if(void 0===e.stemmerSupport)throw new Error("Lunr stemmer support is not present. Please include / require Lunr stemmer support before this script.");e.sv=function(){this.pipeline.reset(),this.pipeline.add(e.sv.trimmer,e.sv.stopWordFilter,e.sv.stemmer),this.searchPipeline&&(this.searchPipeline.reset(),this.searchPipeline.add(e.sv.stemmer))},e.sv.wordCharacters="A-Za-zªºÀ-ÖØ-öø-ʸˠ-ˤᴀ-ᴥᴬ-ᵜᵢ-ᵥᵫ-ᵷᵹ-ᶾḀ-ỿⁱⁿₐ-ₜKÅℲⅎⅠ-ↈⱠ-ⱿꜢ-ꞇꞋ-ꞭꞰ-ꞷꟷ-ꟿꬰ-ꭚꭜ-ꭤff-stA-Za-z",e.sv.trimmer=e.trimmerSupport.generateTrimmer(e.sv.wordCharacters),e.Pipeline.registerFunction(e.sv.trimmer,"trimmer-sv"),e.sv.stemmer=function(){var r=e.stemmerSupport.Among,n=e.stemmerSupport.SnowballProgram,t=new function(){function e(){var e,r=w.cursor+3;if(o=w.limit,0<=r||r<=w.limit){for(a=r;;){if(e=w.cursor,w.in_grouping(l,97,246)){w.cursor=e;break}if(w.cursor=e,w.cursor>=w.limit)return;w.cursor++}for(;!w.out_grouping(l,97,246);){if(w.cursor>=w.limit)return;w.cursor++}o=w.cursor,o=o&&(w.limit_backward=o,w.cursor=w.limit,w.ket=w.cursor,e=w.find_among_b(u,37),w.limit_backward=r,e))switch(w.bra=w.cursor,e){case 1:w.slice_del();break;case 2:w.in_grouping_b(d,98,121)&&w.slice_del()}}function i(){var e=w.limit_backward;w.cursor>=o&&(w.limit_backward=o,w.cursor=w.limit,w.find_among_b(c,7)&&(w.cursor=w.limit,w.ket=w.cursor,w.cursor>w.limit_backward&&(w.bra=--w.cursor,w.slice_del())),w.limit_backward=e)}function s(){var e,r;if(w.cursor>=o){if(r=w.limit_backward,w.limit_backward=o,w.cursor=w.limit,w.ket=w.cursor,e=w.find_among_b(m,5))switch(w.bra=w.cursor,e){case 1:w.slice_del();break;case 2:w.slice_from("lös");break;case 3:w.slice_from("full")}w.limit_backward=r}}var a,o,u=[new r("a",-1,1),new r("arna",0,1),new r("erna",0,1),new r("heterna",2,1),new r("orna",0,1),new r("ad",-1,1),new r("e",-1,1),new r("ade",6,1),new r("ande",6,1),new r("arne",6,1),new r("are",6,1),new r("aste",6,1),new r("en",-1,1),new r("anden",12,1),new r("aren",12,1),new r("heten",12,1),new r("ern",-1,1),new r("ar",-1,1),new r("er",-1,1),new r("heter",18,1),new r("or",-1,1),new r("s",-1,2),new r("as",21,1),new r("arnas",22,1),new r("ernas",22,1),new r("ornas",22,1),new r("es",21,1),new r("ades",26,1),new r("andes",26,1),new r("ens",21,1),new r("arens",29,1),new r("hetens",29,1),new r("erns",21,1),new r("at",-1,1),new r("andet",-1,1),new r("het",-1,1),new r("ast",-1,1)],c=[new r("dd",-1,-1),new r("gd",-1,-1),new r("nn",-1,-1),new r("dt",-1,-1),new r("gt",-1,-1),new r("kt",-1,-1),new r("tt",-1,-1)],m=[new r("ig",-1,1),new r("lig",0,1),new r("els",-1,1),new r("fullt",-1,3),new r("löst",-1,2)],l=[17,65,16,1,0,0,0,0,0,0,0,0,0,0,0,0,24,0,32],d=[119,127,149],w=new n;this.setCurrent=function(e){w.setCurrent(e)},this.getCurrent=function(){return w.getCurrent()},this.stem=function(){var r=w.cursor;return e(),w.limit_backward=r,w.cursor=w.limit,t(),w.cursor=w.limit,i(),w.cursor=w.limit,s(),!0}};return function(e){return"function"==typeof e.update?e.update(function(e){return t.setCurrent(e),t.stem(),t.getCurrent()}):(t.setCurrent(e),t.stem(),t.getCurrent())}}(),e.Pipeline.registerFunction(e.sv.stemmer,"stemmer-sv"),e.sv.stopWordFilter=e.generateStopWordFilter("alla allt att av blev bli blir blivit de dem den denna deras dess dessa det detta dig din dina ditt du där då efter ej eller en er era ert ett från för ha hade han hans har henne hennes hon honom hur här i icke ingen inom inte jag ju kan kunde man med mellan men mig min mina mitt mot mycket ni nu när någon något några och om oss på samma sedan sig sin sina sitta själv skulle some så sådan sådana sådant till under upp ut utan vad var vara varför varit varje vars vart vem vi vid vilka vilkas vilken vilket vår våra vårt än är åt över".split(" ")),e.Pipeline.registerFunction(e.sv.stopWordFilter,"stopWordFilter-sv")}}); \ No newline at end of file +!function(e,r){"function"==typeof define&&define.amd?define(r):"object"==typeof exports?module.exports=r():r()(e.lunr)}(this,function(){return function(e){if(void 0===e)throw new Error("Lunr is not present. Please include / require Lunr before this script.");if(void 0===e.stemmerSupport)throw new Error("Lunr stemmer support is not present. Please include / require Lunr stemmer support before this script.");e.sv=function(){this.pipeline.reset(),this.pipeline.add(e.sv.trimmer,e.sv.stopWordFilter,e.sv.stemmer),this.searchPipeline&&(this.searchPipeline.reset(),this.searchPipeline.add(e.sv.stemmer))},e.sv.wordCharacters="A-Za-zªºÀ-ÖØ-öø-ʸˠ-ˤᴀ-ᴥᴬ-ᵜᵢ-ᵥᵫ-ᵷᵹ-ᶾḀ-ỿⁱⁿₐ-ₜKÅℲⅎⅠ-ↈⱠ-ⱿꜢ-ꞇꞋ-ꞭꞰ-ꞷꟷ-ꟿꬰ-ꭚꭜ-ꭤff-stA-Za-z",e.sv.trimmer=e.trimmerSupport.generateTrimmer(e.sv.wordCharacters),e.Pipeline.registerFunction(e.sv.trimmer,"trimmer-sv"),e.sv.stemmer=function(){var r=e.stemmerSupport.Among,n=e.stemmerSupport.SnowballProgram,t=new function(){function e(){var e,r=w.cursor+3;if(o=w.limit,0<=r||r<=w.limit){for(a=r;;){if(e=w.cursor,w.in_grouping(l,97,246)){w.cursor=e;break}if(w.cursor=e,w.cursor>=w.limit)return;w.cursor++}for(;!w.out_grouping(l,97,246);){if(w.cursor>=w.limit)return;w.cursor++}o=w.cursor,o=o&&(w.limit_backward=o,w.cursor=w.limit,w.ket=w.cursor,e=w.find_among_b(u,37),w.limit_backward=r,e))switch(w.bra=w.cursor,e){case 1:w.slice_del();break;case 2:w.in_grouping_b(d,98,121)&&w.slice_del()}}function i(){var e=w.limit_backward;w.cursor>=o&&(w.limit_backward=o,w.cursor=w.limit,w.find_among_b(c,7)&&(w.cursor=w.limit,w.ket=w.cursor,w.cursor>w.limit_backward&&(w.bra=--w.cursor,w.slice_del())),w.limit_backward=e)}function s(){var e,r;if(w.cursor>=o){if(r=w.limit_backward,w.limit_backward=o,w.cursor=w.limit,w.ket=w.cursor,e=w.find_among_b(m,5))switch(w.bra=w.cursor,e){case 1:w.slice_del();break;case 2:w.slice_from("lös");break;case 3:w.slice_from("full")}w.limit_backward=r}}var a,o,u=[new r("a",-1,1),new r("arna",0,1),new r("erna",0,1),new r("heterna",2,1),new r("orna",0,1),new r("ad",-1,1),new r("e",-1,1),new r("ade",6,1),new r("ande",6,1),new r("arne",6,1),new r("are",6,1),new r("aste",6,1),new r("en",-1,1),new r("anden",12,1),new r("aren",12,1),new r("heten",12,1),new r("ern",-1,1),new r("ar",-1,1),new r("er",-1,1),new r("heter",18,1),new r("or",-1,1),new r("s",-1,2),new r("as",21,1),new r("arnas",22,1),new r("ernas",22,1),new r("ornas",22,1),new r("es",21,1),new r("ades",26,1),new r("andes",26,1),new r("ens",21,1),new r("arens",29,1),new r("hetens",29,1),new r("erns",21,1),new r("at",-1,1),new r("andet",-1,1),new r("het",-1,1),new r("ast",-1,1)],c=[new r("dd",-1,-1),new r("gd",-1,-1),new r("nn",-1,-1),new r("dt",-1,-1),new r("gt",-1,-1),new r("kt",-1,-1),new r("tt",-1,-1)],m=[new r("ig",-1,1),new r("lig",0,1),new r("els",-1,1),new r("fullt",-1,3),new r("löst",-1,2)],l=[17,65,16,1,0,0,0,0,0,0,0,0,0,0,0,0,24,0,32],d=[119,127,149],w=new n;this.setCurrent=function(e){w.setCurrent(e)},this.getCurrent=function(){return w.getCurrent()},this.stem=function(){var r=w.cursor;return e(),w.limit_backward=r,w.cursor=w.limit,t(),w.cursor=w.limit,i(),w.cursor=w.limit,s(),!0}};return function(e){return"function"==typeof e.update?e.update(function(e){return t.setCurrent(e),t.stem(),t.getCurrent()}):(t.setCurrent(e),t.stem(),t.getCurrent())}}(),e.Pipeline.registerFunction(e.sv.stemmer,"stemmer-sv"),e.sv.stopWordFilter=e.generateStopWordFilter("alla allt att av blev bli blir blivit de dem den denna deras dess dessa det detta dig din dina ditt du där då efter ej eller en er era ert ett från för ha hade han hans har henne hennes hon honom hur här i icke ingen inom inte jag ju kan kunde man med mellan men mig min mina mitt mot mycket ni nu när någon något några och om oss på samma sedan sig sin sina sitta själv skulle som så sådan sådana sådant till under upp ut utan vad var vara varför varit varje vars vart vem vi vid vilka vilkas vilken vilket vår våra vårt än är åt över".split(" ")),e.Pipeline.registerFunction(e.sv.stopWordFilter,"stopWordFilter-sv")}}); \ No newline at end of file diff --git a/docs/public/assets/javascripts/lunr/min/lunr.ta.min.js b/docs/assets/javascripts/lunr/min/lunr.ta.min.js similarity index 100% rename from docs/public/assets/javascripts/lunr/min/lunr.ta.min.js rename to docs/assets/javascripts/lunr/min/lunr.ta.min.js diff --git a/docs/public/assets/javascripts/lunr/min/lunr.te.min.js b/docs/assets/javascripts/lunr/min/lunr.te.min.js similarity index 100% rename from docs/public/assets/javascripts/lunr/min/lunr.te.min.js rename to docs/assets/javascripts/lunr/min/lunr.te.min.js diff --git a/docs/public/assets/javascripts/lunr/min/lunr.th.min.js b/docs/assets/javascripts/lunr/min/lunr.th.min.js similarity index 100% rename from docs/public/assets/javascripts/lunr/min/lunr.th.min.js rename to docs/assets/javascripts/lunr/min/lunr.th.min.js diff --git a/docs/public/assets/javascripts/lunr/min/lunr.tr.min.js b/docs/assets/javascripts/lunr/min/lunr.tr.min.js similarity index 79% rename from docs/public/assets/javascripts/lunr/min/lunr.tr.min.js rename to docs/assets/javascripts/lunr/min/lunr.tr.min.js index a6c41f496..563f6ec1f 100644 --- a/docs/public/assets/javascripts/lunr/min/lunr.tr.min.js +++ b/docs/assets/javascripts/lunr/min/lunr.tr.min.js @@ -15,4 +15,4 @@ * http://www.mozilla.org/MPL/ */ -!function(r,i){"function"==typeof define&&define.amd?define(i):"object"==typeof exports?module.exports=i():i()(r.lunr)}(this,function(){return function(r){if(void 0===r)throw new Error("Lunr is not present. Please include / require Lunr before this script.");if(void 0===r.stemmerSupport)throw new Error("Lunr stemmer support is not present. Please include / require Lunr stemmer support before this script.");r.tr=function(){this.pipeline.reset(),this.pipeline.add(r.tr.trimmer,r.tr.stopWordFilter,r.tr.stemmer),this.searchPipeline&&(this.searchPipeline.reset(),this.searchPipeline.add(r.tr.stemmer))},r.tr.wordCharacters="A-Za-zªºÀ-ÖØ-öø-ʸˠ-ˤᴀ-ᴥᴬ-ᵜᵢ-ᵥᵫ-ᵷᵹ-ᶾḀ-ỿⁱⁿₐ-ₜKÅℲⅎⅠ-ↈⱠ-ⱿꜢ-ꞇꞋ-ꞭꞰ-ꞷꟷ-ꟿꬰ-ꭚꭜ-ꭤff-stA-Za-z",r.tr.trimmer=r.trimmerSupport.generateTrimmer(r.tr.wordCharacters),r.Pipeline.registerFunction(r.tr.trimmer,"trimmer-tr"),r.tr.stemmer=function(){var i=r.stemmerSupport.Among,e=r.stemmerSupport.SnowballProgram,n=new function(){function r(r,i,e){for(;;){var n=Dr.limit-Dr.cursor;if(Dr.in_grouping_b(r,i,e)){Dr.cursor=Dr.limit-n;break}if(Dr.cursor=Dr.limit-n,Dr.cursor<=Dr.limit_backward)return!1;Dr.cursor--}return!0}function n(){var i,e;i=Dr.limit-Dr.cursor,r(Wr,97,305);for(var n=0;nDr.limit_backward&&(Dr.cursor--,e=Dr.limit-Dr.cursor,i()))?(Dr.cursor=Dr.limit-e,!0):(Dr.cursor=Dr.limit-n,r()?(Dr.cursor=Dr.limit-n,!1):(Dr.cursor=Dr.limit-n,!(Dr.cursor<=Dr.limit_backward)&&(Dr.cursor--,!!i()&&(Dr.cursor=Dr.limit-n,!0))))}function u(r){return t(r,function(){return Dr.in_grouping_b(Wr,97,305)})}function o(){return u(function(){return Dr.eq_s_b(1,"n")})}function s(){return u(function(){return Dr.eq_s_b(1,"s")})}function c(){return u(function(){return Dr.eq_s_b(1,"y")})}function l(){return t(function(){return Dr.in_grouping_b(Lr,105,305)},function(){return Dr.out_grouping_b(Wr,97,305)})}function a(){return Dr.find_among_b(ur,10)&&l()}function m(){return n()&&Dr.in_grouping_b(Lr,105,305)&&s()}function d(){return Dr.find_among_b(or,2)}function f(){return n()&&Dr.in_grouping_b(Lr,105,305)&&c()}function b(){return n()&&Dr.find_among_b(sr,4)}function w(){return n()&&Dr.find_among_b(cr,4)&&o()}function _(){return n()&&Dr.find_among_b(lr,2)&&c()}function k(){return n()&&Dr.find_among_b(ar,2)}function p(){return n()&&Dr.find_among_b(mr,4)}function g(){return n()&&Dr.find_among_b(dr,2)}function y(){return n()&&Dr.find_among_b(fr,4)}function z(){return n()&&Dr.find_among_b(br,2)}function v(){return n()&&Dr.find_among_b(wr,2)&&c()}function h(){return Dr.eq_s_b(2,"ki")}function q(){return n()&&Dr.find_among_b(_r,2)&&o()}function C(){return n()&&Dr.find_among_b(kr,4)&&c()}function P(){return n()&&Dr.find_among_b(pr,4)}function F(){return n()&&Dr.find_among_b(gr,4)&&c()}function S(){return Dr.find_among_b(yr,4)}function W(){return n()&&Dr.find_among_b(zr,2)}function L(){return n()&&Dr.find_among_b(vr,4)}function x(){return n()&&Dr.find_among_b(hr,8)}function A(){return Dr.find_among_b(qr,2)}function E(){return n()&&Dr.find_among_b(Cr,32)&&c()}function j(){return Dr.find_among_b(Pr,8)&&c()}function T(){return n()&&Dr.find_among_b(Fr,4)&&c()}function Z(){return Dr.eq_s_b(3,"ken")&&c()}function B(){var r=Dr.limit-Dr.cursor;return!(T()||(Dr.cursor=Dr.limit-r,E()||(Dr.cursor=Dr.limit-r,j()||(Dr.cursor=Dr.limit-r,Z()))))}function D(){if(A()){var r=Dr.limit-Dr.cursor;if(S()||(Dr.cursor=Dr.limit-r,W()||(Dr.cursor=Dr.limit-r,C()||(Dr.cursor=Dr.limit-r,P()||(Dr.cursor=Dr.limit-r,F()||(Dr.cursor=Dr.limit-r))))),T())return!1}return!0}function G(){if(W()){Dr.bra=Dr.cursor,Dr.slice_del();var r=Dr.limit-Dr.cursor;return Dr.ket=Dr.cursor,x()||(Dr.cursor=Dr.limit-r,E()||(Dr.cursor=Dr.limit-r,j()||(Dr.cursor=Dr.limit-r,T()||(Dr.cursor=Dr.limit-r)))),nr=!1,!1}return!0}function H(){if(!L())return!0;var r=Dr.limit-Dr.cursor;return!E()&&(Dr.cursor=Dr.limit-r,!j())}function I(){var r,i=Dr.limit-Dr.cursor;return!(S()||(Dr.cursor=Dr.limit-i,F()||(Dr.cursor=Dr.limit-i,P()||(Dr.cursor=Dr.limit-i,C()))))||(Dr.bra=Dr.cursor,Dr.slice_del(),r=Dr.limit-Dr.cursor,Dr.ket=Dr.cursor,T()||(Dr.cursor=Dr.limit-r),!1)}function J(){var r,i=Dr.limit-Dr.cursor;if(Dr.ket=Dr.cursor,nr=!0,B()&&(Dr.cursor=Dr.limit-i,D()&&(Dr.cursor=Dr.limit-i,G()&&(Dr.cursor=Dr.limit-i,H()&&(Dr.cursor=Dr.limit-i,I()))))){if(Dr.cursor=Dr.limit-i,!x())return;Dr.bra=Dr.cursor,Dr.slice_del(),Dr.ket=Dr.cursor,r=Dr.limit-Dr.cursor,S()||(Dr.cursor=Dr.limit-r,W()||(Dr.cursor=Dr.limit-r,C()||(Dr.cursor=Dr.limit-r,P()||(Dr.cursor=Dr.limit-r,F()||(Dr.cursor=Dr.limit-r))))),T()||(Dr.cursor=Dr.limit-r)}Dr.bra=Dr.cursor,Dr.slice_del()}function K(){var r,i,e,n;if(Dr.ket=Dr.cursor,h()){if(r=Dr.limit-Dr.cursor,p())return Dr.bra=Dr.cursor,Dr.slice_del(),i=Dr.limit-Dr.cursor,Dr.ket=Dr.cursor,W()?(Dr.bra=Dr.cursor,Dr.slice_del(),K()):(Dr.cursor=Dr.limit-i,a()&&(Dr.bra=Dr.cursor,Dr.slice_del(),Dr.ket=Dr.cursor,W()&&(Dr.bra=Dr.cursor,Dr.slice_del(),K()))),!0;if(Dr.cursor=Dr.limit-r,w()){if(Dr.bra=Dr.cursor,Dr.slice_del(),Dr.ket=Dr.cursor,e=Dr.limit-Dr.cursor,d())Dr.bra=Dr.cursor,Dr.slice_del();else{if(Dr.cursor=Dr.limit-e,Dr.ket=Dr.cursor,!a()&&(Dr.cursor=Dr.limit-e,!m()&&(Dr.cursor=Dr.limit-e,!K())))return!0;Dr.bra=Dr.cursor,Dr.slice_del(),Dr.ket=Dr.cursor,W()&&(Dr.bra=Dr.cursor,Dr.slice_del(),K())}return!0}if(Dr.cursor=Dr.limit-r,g()){if(n=Dr.limit-Dr.cursor,d())Dr.bra=Dr.cursor,Dr.slice_del();else if(Dr.cursor=Dr.limit-n,m())Dr.bra=Dr.cursor,Dr.slice_del(),Dr.ket=Dr.cursor,W()&&(Dr.bra=Dr.cursor,Dr.slice_del(),K());else if(Dr.cursor=Dr.limit-n,!K())return!1;return!0}}return!1}function M(r){if(Dr.ket=Dr.cursor,!g()&&(Dr.cursor=Dr.limit-r,!k()))return!1;var i=Dr.limit-Dr.cursor;if(d())Dr.bra=Dr.cursor,Dr.slice_del();else if(Dr.cursor=Dr.limit-i,m())Dr.bra=Dr.cursor,Dr.slice_del(),Dr.ket=Dr.cursor,W()&&(Dr.bra=Dr.cursor,Dr.slice_del(),K());else if(Dr.cursor=Dr.limit-i,!K())return!1;return!0}function N(r){if(Dr.ket=Dr.cursor,!z()&&(Dr.cursor=Dr.limit-r,!b()))return!1;var i=Dr.limit-Dr.cursor;return!(!m()&&(Dr.cursor=Dr.limit-i,!d()))&&(Dr.bra=Dr.cursor,Dr.slice_del(),Dr.ket=Dr.cursor,W()&&(Dr.bra=Dr.cursor,Dr.slice_del(),K()),!0)}function O(){var r,i=Dr.limit-Dr.cursor;return Dr.ket=Dr.cursor,!(!w()&&(Dr.cursor=Dr.limit-i,!v()))&&(Dr.bra=Dr.cursor,Dr.slice_del(),r=Dr.limit-Dr.cursor,Dr.ket=Dr.cursor,!(!W()||(Dr.bra=Dr.cursor,Dr.slice_del(),!K()))||(Dr.cursor=Dr.limit-r,Dr.ket=Dr.cursor,!(a()||(Dr.cursor=Dr.limit-r,m()||(Dr.cursor=Dr.limit-r,K())))||(Dr.bra=Dr.cursor,Dr.slice_del(),Dr.ket=Dr.cursor,W()&&(Dr.bra=Dr.cursor,Dr.slice_del(),K()),!0)))}function Q(){var r,i,e=Dr.limit-Dr.cursor;if(Dr.ket=Dr.cursor,!p()&&(Dr.cursor=Dr.limit-e,!f()&&(Dr.cursor=Dr.limit-e,!_())))return!1;if(Dr.bra=Dr.cursor,Dr.slice_del(),Dr.ket=Dr.cursor,r=Dr.limit-Dr.cursor,a())Dr.bra=Dr.cursor,Dr.slice_del(),i=Dr.limit-Dr.cursor,Dr.ket=Dr.cursor,W()||(Dr.cursor=Dr.limit-i);else if(Dr.cursor=Dr.limit-r,!W())return!0;return Dr.bra=Dr.cursor,Dr.slice_del(),Dr.ket=Dr.cursor,K(),!0}function R(){var r,i,e=Dr.limit-Dr.cursor;if(Dr.ket=Dr.cursor,W())return Dr.bra=Dr.cursor,Dr.slice_del(),void K();if(Dr.cursor=Dr.limit-e,Dr.ket=Dr.cursor,q())if(Dr.bra=Dr.cursor,Dr.slice_del(),r=Dr.limit-Dr.cursor,Dr.ket=Dr.cursor,d())Dr.bra=Dr.cursor,Dr.slice_del();else{if(Dr.cursor=Dr.limit-r,Dr.ket=Dr.cursor,!a()&&(Dr.cursor=Dr.limit-r,!m())){if(Dr.cursor=Dr.limit-r,Dr.ket=Dr.cursor,!W())return;if(Dr.bra=Dr.cursor,Dr.slice_del(),!K())return}Dr.bra=Dr.cursor,Dr.slice_del(),Dr.ket=Dr.cursor,W()&&(Dr.bra=Dr.cursor,Dr.slice_del(),K())}else if(Dr.cursor=Dr.limit-e,!M(e)&&(Dr.cursor=Dr.limit-e,!N(e))){if(Dr.cursor=Dr.limit-e,Dr.ket=Dr.cursor,y())return Dr.bra=Dr.cursor,Dr.slice_del(),Dr.ket=Dr.cursor,i=Dr.limit-Dr.cursor,void(a()?(Dr.bra=Dr.cursor,Dr.slice_del(),Dr.ket=Dr.cursor,W()&&(Dr.bra=Dr.cursor,Dr.slice_del(),K())):(Dr.cursor=Dr.limit-i,W()?(Dr.bra=Dr.cursor,Dr.slice_del(),K()):(Dr.cursor=Dr.limit-i,K())));if(Dr.cursor=Dr.limit-e,!O()){if(Dr.cursor=Dr.limit-e,d())return Dr.bra=Dr.cursor,void Dr.slice_del();Dr.cursor=Dr.limit-e,K()||(Dr.cursor=Dr.limit-e,Q()||(Dr.cursor=Dr.limit-e,Dr.ket=Dr.cursor,(a()||(Dr.cursor=Dr.limit-e,m()))&&(Dr.bra=Dr.cursor,Dr.slice_del(),Dr.ket=Dr.cursor,W()&&(Dr.bra=Dr.cursor,Dr.slice_del(),K()))))}}}function U(){var r;if(Dr.ket=Dr.cursor,r=Dr.find_among_b(Sr,4))switch(Dr.bra=Dr.cursor,r){case 1:Dr.slice_from("p");break;case 2:Dr.slice_from("ç");break;case 3:Dr.slice_from("t");break;case 4:Dr.slice_from("k")}}function V(){for(;;){var r=Dr.limit-Dr.cursor;if(Dr.in_grouping_b(Wr,97,305)){Dr.cursor=Dr.limit-r;break}if(Dr.cursor=Dr.limit-r,Dr.cursor<=Dr.limit_backward)return!1;Dr.cursor--}return!0}function X(r,i,e){if(Dr.cursor=Dr.limit-r,V()){var n=Dr.limit-Dr.cursor;if(!Dr.eq_s_b(1,i)&&(Dr.cursor=Dr.limit-n,!Dr.eq_s_b(1,e)))return!0;Dr.cursor=Dr.limit-r;var t=Dr.cursor;return Dr.insert(Dr.cursor,Dr.cursor,e),Dr.cursor=t,!1}return!0}function Y(){var r=Dr.limit-Dr.cursor;(Dr.eq_s_b(1,"d")||(Dr.cursor=Dr.limit-r,Dr.eq_s_b(1,"g")))&&X(r,"a","ı")&&X(r,"e","i")&&X(r,"o","u")&&X(r,"ö","ü")}function $(){for(var r,i=Dr.cursor,e=2;;){for(r=Dr.cursor;!Dr.in_grouping(Wr,97,305);){if(Dr.cursor>=Dr.limit)return Dr.cursor=r,!(e>0)&&(Dr.cursor=i,!0);Dr.cursor++}e--}}function rr(r,i,e){for(;!Dr.eq_s(i,e);){if(Dr.cursor>=Dr.limit)return!0;Dr.cursor++}return(tr=i)!=Dr.limit||(Dr.cursor=r,!1)}function ir(){var r=Dr.cursor;return!rr(r,2,"ad")||(Dr.cursor=r,!rr(r,5,"soyad"))}function er(){var r=Dr.cursor;return!ir()&&(Dr.limit_backward=r,Dr.cursor=Dr.limit,Y(),Dr.cursor=Dr.limit,U(),!0)}var nr,tr,ur=[new i("m",-1,-1),new i("n",-1,-1),new i("miz",-1,-1),new i("niz",-1,-1),new i("muz",-1,-1),new i("nuz",-1,-1),new i("müz",-1,-1),new i("nüz",-1,-1),new i("mız",-1,-1),new i("nız",-1,-1)],or=[new i("leri",-1,-1),new i("ları",-1,-1)],sr=[new i("ni",-1,-1),new i("nu",-1,-1),new i("nü",-1,-1),new i("nı",-1,-1)],cr=[new i("in",-1,-1),new i("un",-1,-1),new i("ün",-1,-1),new i("ın",-1,-1)],lr=[new i("a",-1,-1),new i("e",-1,-1)],ar=[new i("na",-1,-1),new i("ne",-1,-1)],mr=[new i("da",-1,-1),new i("ta",-1,-1),new i("de",-1,-1),new i("te",-1,-1)],dr=[new i("nda",-1,-1),new i("nde",-1,-1)],fr=[new i("dan",-1,-1),new i("tan",-1,-1),new i("den",-1,-1),new i("ten",-1,-1)],br=[new i("ndan",-1,-1),new i("nden",-1,-1)],wr=[new i("la",-1,-1),new i("le",-1,-1)],_r=[new i("ca",-1,-1),new i("ce",-1,-1)],kr=[new i("im",-1,-1),new i("um",-1,-1),new i("üm",-1,-1),new i("ım",-1,-1)],pr=[new i("sin",-1,-1),new i("sun",-1,-1),new i("sün",-1,-1),new i("sın",-1,-1)],gr=[new i("iz",-1,-1),new i("uz",-1,-1),new i("üz",-1,-1),new i("ız",-1,-1)],yr=[new i("siniz",-1,-1),new i("sunuz",-1,-1),new i("sünüz",-1,-1),new i("sınız",-1,-1)],zr=[new i("lar",-1,-1),new i("ler",-1,-1)],vr=[new i("niz",-1,-1),new i("nuz",-1,-1),new i("nüz",-1,-1),new i("nız",-1,-1)],hr=[new i("dir",-1,-1),new i("tir",-1,-1),new i("dur",-1,-1),new i("tur",-1,-1),new i("dür",-1,-1),new i("tür",-1,-1),new i("dır",-1,-1),new i("tır",-1,-1)],qr=[new i("casına",-1,-1),new i("cesine",-1,-1)],Cr=[new i("di",-1,-1),new i("ti",-1,-1),new i("dik",-1,-1),new i("tik",-1,-1),new i("duk",-1,-1),new i("tuk",-1,-1),new i("dük",-1,-1),new i("tük",-1,-1),new i("dık",-1,-1),new i("tık",-1,-1),new i("dim",-1,-1),new i("tim",-1,-1),new i("dumb",-1,-1),new i("tum",-1,-1),new i("düm",-1,-1),new i("tüm",-1,-1),new i("dım",-1,-1),new i("tım",-1,-1),new i("din",-1,-1),new i("tin",-1,-1),new i("dun",-1,-1),new i("tun",-1,-1),new i("dün",-1,-1),new i("tün",-1,-1),new i("dın",-1,-1),new i("tın",-1,-1),new i("du",-1,-1),new i("tu",-1,-1),new i("dü",-1,-1),new i("tü",-1,-1),new i("dı",-1,-1),new i("tı",-1,-1)],Pr=[new i("sa",-1,-1),new i("se",-1,-1),new i("sak",-1,-1),new i("sek",-1,-1),new i("sam",-1,-1),new i("sem",-1,-1),new i("san",-1,-1),new i("sen",-1,-1)],Fr=[new i("miş",-1,-1),new i("muş",-1,-1),new i("müş",-1,-1),new i("mış",-1,-1)],Sr=[new i("b",-1,1),new i("c",-1,2),new i("d",-1,3),new i("ğ",-1,4)],Wr=[17,65,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,32,8,0,0,0,0,0,0,1],Lr=[1,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,0,0,0,0,0,0,1],xr=[1,64,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1],Ar=[17,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,130],Er=[1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1],jr=[17],Tr=[65],Zr=[65],Br=[["a",xr,97,305],["e",Ar,101,252],["ı",Er,97,305],["i",jr,101,105],["o",Tr,111,117],["ö",Zr,246,252],["u",Tr,111,117]],Dr=new e;this.setCurrent=function(r){Dr.setCurrent(r)},this.getCurrent=function(){return Dr.getCurrent()},this.stem=function(){return!!($()&&(Dr.limit_backward=Dr.cursor,Dr.cursor=Dr.limit,J(),Dr.cursor=Dr.limit,nr&&(R(),Dr.cursor=Dr.limit_backward,er())))}};return function(r){return"function"==typeof r.update?r.update(function(r){return n.setCurrent(r),n.stem(),n.getCurrent()}):(n.setCurrent(r),n.stem(),n.getCurrent())}}(),r.Pipeline.registerFunction(r.tr.stemmer,"stemmer-tr"),r.tr.stopWordFilter=r.generateStopWordFilter("acaba altmış altı ama ancak arada aslında ayrıca bana bazı belki ben benden beni benim beri beş bile bin bir biri birkaç birkez birçok birşey birşeyi biz bizden bize bizi bizim bu buna bunda bundan bunlar bunları bunların bunu bunun burada böyle böylece da daha dahi de defa değil diye diğer doksan dokuz dolayı dolayısıyla dört edecek eden ederek edilecek ediliyor edilmesi ediyor elli en etmesi etti ettiği ettiğini eğer gibi göre halen hangi hatta hem henüz hep hepsi her herhangi herkesin hiç hiçbir iki ile ilgili ise itibaren itibariyle için işte kadar karşın katrilyon kendi kendilerine kendini kendisi kendisine kendisini kez ki kim kimden kime kimi kimse kırk milyar milyon mu mü mı nasıl ne neden nedenle nerde nerede nereye niye niçin o olan olarak oldu olduklarını olduğu olduğunu olmadı olmadığı olmak olması olmayan olmaz olsa olsun olup olur olursa oluyor on ona ondan onlar onlardan onları onların onu onun otuz oysa pek rağmen sadece sanki sekiz seksen sen senden seni senin siz sizden sizi sizin tarafından trilyon tüm var vardı ve veya ya yani yapacak yapmak yaptı yaptıkları yaptığı yaptığını yapılan yapılması yapıyor yedi yerine yetmiş yine yirmi yoksa yüz zaten çok çünkü öyle üzere üç şey şeyden şeyi şeyler şu şuna şunda şundan şunları şunu şöyle".split(" ")),r.Pipeline.registerFunction(r.tr.stopWordFilter,"stopWordFilter-tr")}}); \ No newline at end of file +!function(r,i){"function"==typeof define&&define.amd?define(i):"object"==typeof exports?module.exports=i():i()(r.lunr)}(this,function(){return function(r){if(void 0===r)throw new Error("Lunr is not present. Please include / require Lunr before this script.");if(void 0===r.stemmerSupport)throw new Error("Lunr stemmer support is not present. Please include / require Lunr stemmer support before this script.");r.tr=function(){this.pipeline.reset(),this.pipeline.add(r.tr.trimmer,r.tr.stopWordFilter,r.tr.stemmer),this.searchPipeline&&(this.searchPipeline.reset(),this.searchPipeline.add(r.tr.stemmer))},r.tr.wordCharacters="A-Za-zªºÀ-ÖØ-öø-ʸˠ-ˤᴀ-ᴥᴬ-ᵜᵢ-ᵥᵫ-ᵷᵹ-ᶾḀ-ỿⁱⁿₐ-ₜKÅℲⅎⅠ-ↈⱠ-ⱿꜢ-ꞇꞋ-ꞭꞰ-ꞷꟷ-ꟿꬰ-ꭚꭜ-ꭤff-stA-Za-z",r.tr.trimmer=r.trimmerSupport.generateTrimmer(r.tr.wordCharacters),r.Pipeline.registerFunction(r.tr.trimmer,"trimmer-tr"),r.tr.stemmer=function(){var i=r.stemmerSupport.Among,e=r.stemmerSupport.SnowballProgram,n=new function(){function r(r,i,e){for(;;){var n=Dr.limit-Dr.cursor;if(Dr.in_grouping_b(r,i,e)){Dr.cursor=Dr.limit-n;break}if(Dr.cursor=Dr.limit-n,Dr.cursor<=Dr.limit_backward)return!1;Dr.cursor--}return!0}function n(){var i,e;i=Dr.limit-Dr.cursor,r(Wr,97,305);for(var n=0;nDr.limit_backward&&(Dr.cursor--,e=Dr.limit-Dr.cursor,i()))?(Dr.cursor=Dr.limit-e,!0):(Dr.cursor=Dr.limit-n,r()?(Dr.cursor=Dr.limit-n,!1):(Dr.cursor=Dr.limit-n,!(Dr.cursor<=Dr.limit_backward)&&(Dr.cursor--,!!i()&&(Dr.cursor=Dr.limit-n,!0))))}function u(r){return t(r,function(){return Dr.in_grouping_b(Wr,97,305)})}function o(){return u(function(){return Dr.eq_s_b(1,"n")})}function s(){return u(function(){return Dr.eq_s_b(1,"s")})}function c(){return u(function(){return Dr.eq_s_b(1,"y")})}function l(){return t(function(){return Dr.in_grouping_b(Lr,105,305)},function(){return Dr.out_grouping_b(Wr,97,305)})}function a(){return Dr.find_among_b(ur,10)&&l()}function m(){return n()&&Dr.in_grouping_b(Lr,105,305)&&s()}function d(){return Dr.find_among_b(or,2)}function f(){return n()&&Dr.in_grouping_b(Lr,105,305)&&c()}function b(){return n()&&Dr.find_among_b(sr,4)}function w(){return n()&&Dr.find_among_b(cr,4)&&o()}function _(){return n()&&Dr.find_among_b(lr,2)&&c()}function k(){return n()&&Dr.find_among_b(ar,2)}function p(){return n()&&Dr.find_among_b(mr,4)}function g(){return n()&&Dr.find_among_b(dr,2)}function y(){return n()&&Dr.find_among_b(fr,4)}function z(){return n()&&Dr.find_among_b(br,2)}function v(){return n()&&Dr.find_among_b(wr,2)&&c()}function h(){return Dr.eq_s_b(2,"ki")}function q(){return n()&&Dr.find_among_b(_r,2)&&o()}function C(){return n()&&Dr.find_among_b(kr,4)&&c()}function P(){return n()&&Dr.find_among_b(pr,4)}function F(){return n()&&Dr.find_among_b(gr,4)&&c()}function S(){return Dr.find_among_b(yr,4)}function W(){return n()&&Dr.find_among_b(zr,2)}function L(){return n()&&Dr.find_among_b(vr,4)}function x(){return n()&&Dr.find_among_b(hr,8)}function A(){return Dr.find_among_b(qr,2)}function E(){return n()&&Dr.find_among_b(Cr,32)&&c()}function j(){return Dr.find_among_b(Pr,8)&&c()}function T(){return n()&&Dr.find_among_b(Fr,4)&&c()}function Z(){return Dr.eq_s_b(3,"ken")&&c()}function B(){var r=Dr.limit-Dr.cursor;return!(T()||(Dr.cursor=Dr.limit-r,E()||(Dr.cursor=Dr.limit-r,j()||(Dr.cursor=Dr.limit-r,Z()))))}function D(){if(A()){var r=Dr.limit-Dr.cursor;if(S()||(Dr.cursor=Dr.limit-r,W()||(Dr.cursor=Dr.limit-r,C()||(Dr.cursor=Dr.limit-r,P()||(Dr.cursor=Dr.limit-r,F()||(Dr.cursor=Dr.limit-r))))),T())return!1}return!0}function G(){if(W()){Dr.bra=Dr.cursor,Dr.slice_del();var r=Dr.limit-Dr.cursor;return Dr.ket=Dr.cursor,x()||(Dr.cursor=Dr.limit-r,E()||(Dr.cursor=Dr.limit-r,j()||(Dr.cursor=Dr.limit-r,T()||(Dr.cursor=Dr.limit-r)))),nr=!1,!1}return!0}function H(){if(!L())return!0;var r=Dr.limit-Dr.cursor;return!E()&&(Dr.cursor=Dr.limit-r,!j())}function I(){var r,i=Dr.limit-Dr.cursor;return!(S()||(Dr.cursor=Dr.limit-i,F()||(Dr.cursor=Dr.limit-i,P()||(Dr.cursor=Dr.limit-i,C()))))||(Dr.bra=Dr.cursor,Dr.slice_del(),r=Dr.limit-Dr.cursor,Dr.ket=Dr.cursor,T()||(Dr.cursor=Dr.limit-r),!1)}function J(){var r,i=Dr.limit-Dr.cursor;if(Dr.ket=Dr.cursor,nr=!0,B()&&(Dr.cursor=Dr.limit-i,D()&&(Dr.cursor=Dr.limit-i,G()&&(Dr.cursor=Dr.limit-i,H()&&(Dr.cursor=Dr.limit-i,I()))))){if(Dr.cursor=Dr.limit-i,!x())return;Dr.bra=Dr.cursor,Dr.slice_del(),Dr.ket=Dr.cursor,r=Dr.limit-Dr.cursor,S()||(Dr.cursor=Dr.limit-r,W()||(Dr.cursor=Dr.limit-r,C()||(Dr.cursor=Dr.limit-r,P()||(Dr.cursor=Dr.limit-r,F()||(Dr.cursor=Dr.limit-r))))),T()||(Dr.cursor=Dr.limit-r)}Dr.bra=Dr.cursor,Dr.slice_del()}function K(){var r,i,e,n;if(Dr.ket=Dr.cursor,h()){if(r=Dr.limit-Dr.cursor,p())return Dr.bra=Dr.cursor,Dr.slice_del(),i=Dr.limit-Dr.cursor,Dr.ket=Dr.cursor,W()?(Dr.bra=Dr.cursor,Dr.slice_del(),K()):(Dr.cursor=Dr.limit-i,a()&&(Dr.bra=Dr.cursor,Dr.slice_del(),Dr.ket=Dr.cursor,W()&&(Dr.bra=Dr.cursor,Dr.slice_del(),K()))),!0;if(Dr.cursor=Dr.limit-r,w()){if(Dr.bra=Dr.cursor,Dr.slice_del(),Dr.ket=Dr.cursor,e=Dr.limit-Dr.cursor,d())Dr.bra=Dr.cursor,Dr.slice_del();else{if(Dr.cursor=Dr.limit-e,Dr.ket=Dr.cursor,!a()&&(Dr.cursor=Dr.limit-e,!m()&&(Dr.cursor=Dr.limit-e,!K())))return!0;Dr.bra=Dr.cursor,Dr.slice_del(),Dr.ket=Dr.cursor,W()&&(Dr.bra=Dr.cursor,Dr.slice_del(),K())}return!0}if(Dr.cursor=Dr.limit-r,g()){if(n=Dr.limit-Dr.cursor,d())Dr.bra=Dr.cursor,Dr.slice_del();else if(Dr.cursor=Dr.limit-n,m())Dr.bra=Dr.cursor,Dr.slice_del(),Dr.ket=Dr.cursor,W()&&(Dr.bra=Dr.cursor,Dr.slice_del(),K());else if(Dr.cursor=Dr.limit-n,!K())return!1;return!0}}return!1}function M(r){if(Dr.ket=Dr.cursor,!g()&&(Dr.cursor=Dr.limit-r,!k()))return!1;var i=Dr.limit-Dr.cursor;if(d())Dr.bra=Dr.cursor,Dr.slice_del();else if(Dr.cursor=Dr.limit-i,m())Dr.bra=Dr.cursor,Dr.slice_del(),Dr.ket=Dr.cursor,W()&&(Dr.bra=Dr.cursor,Dr.slice_del(),K());else if(Dr.cursor=Dr.limit-i,!K())return!1;return!0}function N(r){if(Dr.ket=Dr.cursor,!z()&&(Dr.cursor=Dr.limit-r,!b()))return!1;var i=Dr.limit-Dr.cursor;return!(!m()&&(Dr.cursor=Dr.limit-i,!d()))&&(Dr.bra=Dr.cursor,Dr.slice_del(),Dr.ket=Dr.cursor,W()&&(Dr.bra=Dr.cursor,Dr.slice_del(),K()),!0)}function O(){var r,i=Dr.limit-Dr.cursor;return Dr.ket=Dr.cursor,!(!w()&&(Dr.cursor=Dr.limit-i,!v()))&&(Dr.bra=Dr.cursor,Dr.slice_del(),r=Dr.limit-Dr.cursor,Dr.ket=Dr.cursor,!(!W()||(Dr.bra=Dr.cursor,Dr.slice_del(),!K()))||(Dr.cursor=Dr.limit-r,Dr.ket=Dr.cursor,!(a()||(Dr.cursor=Dr.limit-r,m()||(Dr.cursor=Dr.limit-r,K())))||(Dr.bra=Dr.cursor,Dr.slice_del(),Dr.ket=Dr.cursor,W()&&(Dr.bra=Dr.cursor,Dr.slice_del(),K()),!0)))}function Q(){var r,i,e=Dr.limit-Dr.cursor;if(Dr.ket=Dr.cursor,!p()&&(Dr.cursor=Dr.limit-e,!f()&&(Dr.cursor=Dr.limit-e,!_())))return!1;if(Dr.bra=Dr.cursor,Dr.slice_del(),Dr.ket=Dr.cursor,r=Dr.limit-Dr.cursor,a())Dr.bra=Dr.cursor,Dr.slice_del(),i=Dr.limit-Dr.cursor,Dr.ket=Dr.cursor,W()||(Dr.cursor=Dr.limit-i);else if(Dr.cursor=Dr.limit-r,!W())return!0;return Dr.bra=Dr.cursor,Dr.slice_del(),Dr.ket=Dr.cursor,K(),!0}function R(){var r,i,e=Dr.limit-Dr.cursor;if(Dr.ket=Dr.cursor,W())return Dr.bra=Dr.cursor,Dr.slice_del(),void K();if(Dr.cursor=Dr.limit-e,Dr.ket=Dr.cursor,q())if(Dr.bra=Dr.cursor,Dr.slice_del(),r=Dr.limit-Dr.cursor,Dr.ket=Dr.cursor,d())Dr.bra=Dr.cursor,Dr.slice_del();else{if(Dr.cursor=Dr.limit-r,Dr.ket=Dr.cursor,!a()&&(Dr.cursor=Dr.limit-r,!m())){if(Dr.cursor=Dr.limit-r,Dr.ket=Dr.cursor,!W())return;if(Dr.bra=Dr.cursor,Dr.slice_del(),!K())return}Dr.bra=Dr.cursor,Dr.slice_del(),Dr.ket=Dr.cursor,W()&&(Dr.bra=Dr.cursor,Dr.slice_del(),K())}else if(Dr.cursor=Dr.limit-e,!M(e)&&(Dr.cursor=Dr.limit-e,!N(e))){if(Dr.cursor=Dr.limit-e,Dr.ket=Dr.cursor,y())return Dr.bra=Dr.cursor,Dr.slice_del(),Dr.ket=Dr.cursor,i=Dr.limit-Dr.cursor,void(a()?(Dr.bra=Dr.cursor,Dr.slice_del(),Dr.ket=Dr.cursor,W()&&(Dr.bra=Dr.cursor,Dr.slice_del(),K())):(Dr.cursor=Dr.limit-i,W()?(Dr.bra=Dr.cursor,Dr.slice_del(),K()):(Dr.cursor=Dr.limit-i,K())));if(Dr.cursor=Dr.limit-e,!O()){if(Dr.cursor=Dr.limit-e,d())return Dr.bra=Dr.cursor,void Dr.slice_del();Dr.cursor=Dr.limit-e,K()||(Dr.cursor=Dr.limit-e,Q()||(Dr.cursor=Dr.limit-e,Dr.ket=Dr.cursor,(a()||(Dr.cursor=Dr.limit-e,m()))&&(Dr.bra=Dr.cursor,Dr.slice_del(),Dr.ket=Dr.cursor,W()&&(Dr.bra=Dr.cursor,Dr.slice_del(),K()))))}}}function U(){var r;if(Dr.ket=Dr.cursor,r=Dr.find_among_b(Sr,4))switch(Dr.bra=Dr.cursor,r){case 1:Dr.slice_from("p");break;case 2:Dr.slice_from("ç");break;case 3:Dr.slice_from("t");break;case 4:Dr.slice_from("k")}}function V(){for(;;){var r=Dr.limit-Dr.cursor;if(Dr.in_grouping_b(Wr,97,305)){Dr.cursor=Dr.limit-r;break}if(Dr.cursor=Dr.limit-r,Dr.cursor<=Dr.limit_backward)return!1;Dr.cursor--}return!0}function X(r,i,e){if(Dr.cursor=Dr.limit-r,V()){var n=Dr.limit-Dr.cursor;if(!Dr.eq_s_b(1,i)&&(Dr.cursor=Dr.limit-n,!Dr.eq_s_b(1,e)))return!0;Dr.cursor=Dr.limit-r;var t=Dr.cursor;return Dr.insert(Dr.cursor,Dr.cursor,e),Dr.cursor=t,!1}return!0}function Y(){var r=Dr.limit-Dr.cursor;(Dr.eq_s_b(1,"d")||(Dr.cursor=Dr.limit-r,Dr.eq_s_b(1,"g")))&&X(r,"a","ı")&&X(r,"e","i")&&X(r,"o","u")&&X(r,"ö","ü")}function $(){for(var r,i=Dr.cursor,e=2;;){for(r=Dr.cursor;!Dr.in_grouping(Wr,97,305);){if(Dr.cursor>=Dr.limit)return Dr.cursor=r,!(e>0)&&(Dr.cursor=i,!0);Dr.cursor++}e--}}function rr(r,i,e){for(;!Dr.eq_s(i,e);){if(Dr.cursor>=Dr.limit)return!0;Dr.cursor++}return(tr=i)!=Dr.limit||(Dr.cursor=r,!1)}function ir(){var r=Dr.cursor;return!rr(r,2,"ad")||(Dr.cursor=r,!rr(r,5,"soyad"))}function er(){var r=Dr.cursor;return!ir()&&(Dr.limit_backward=r,Dr.cursor=Dr.limit,Y(),Dr.cursor=Dr.limit,U(),!0)}var nr,tr,ur=[new i("m",-1,-1),new i("n",-1,-1),new i("miz",-1,-1),new i("niz",-1,-1),new i("muz",-1,-1),new i("nuz",-1,-1),new i("müz",-1,-1),new i("nüz",-1,-1),new i("mız",-1,-1),new i("nız",-1,-1)],or=[new i("leri",-1,-1),new i("ları",-1,-1)],sr=[new i("ni",-1,-1),new i("nu",-1,-1),new i("nü",-1,-1),new i("nı",-1,-1)],cr=[new i("in",-1,-1),new i("un",-1,-1),new i("ün",-1,-1),new i("ın",-1,-1)],lr=[new i("a",-1,-1),new i("e",-1,-1)],ar=[new i("na",-1,-1),new i("ne",-1,-1)],mr=[new i("da",-1,-1),new i("ta",-1,-1),new i("de",-1,-1),new i("te",-1,-1)],dr=[new i("nda",-1,-1),new i("nde",-1,-1)],fr=[new i("dan",-1,-1),new i("tan",-1,-1),new i("den",-1,-1),new i("ten",-1,-1)],br=[new i("ndan",-1,-1),new i("nden",-1,-1)],wr=[new i("la",-1,-1),new i("le",-1,-1)],_r=[new i("ca",-1,-1),new i("ce",-1,-1)],kr=[new i("im",-1,-1),new i("um",-1,-1),new i("üm",-1,-1),new i("ım",-1,-1)],pr=[new i("sin",-1,-1),new i("sun",-1,-1),new i("sün",-1,-1),new i("sın",-1,-1)],gr=[new i("iz",-1,-1),new i("uz",-1,-1),new i("üz",-1,-1),new i("ız",-1,-1)],yr=[new i("siniz",-1,-1),new i("sunuz",-1,-1),new i("sünüz",-1,-1),new i("sınız",-1,-1)],zr=[new i("lar",-1,-1),new i("ler",-1,-1)],vr=[new i("niz",-1,-1),new i("nuz",-1,-1),new i("nüz",-1,-1),new i("nız",-1,-1)],hr=[new i("dir",-1,-1),new i("tir",-1,-1),new i("dur",-1,-1),new i("tur",-1,-1),new i("dür",-1,-1),new i("tür",-1,-1),new i("dır",-1,-1),new i("tır",-1,-1)],qr=[new i("casına",-1,-1),new i("cesine",-1,-1)],Cr=[new i("di",-1,-1),new i("ti",-1,-1),new i("dik",-1,-1),new i("tik",-1,-1),new i("duk",-1,-1),new i("tuk",-1,-1),new i("dük",-1,-1),new i("tük",-1,-1),new i("dık",-1,-1),new i("tık",-1,-1),new i("dim",-1,-1),new i("tim",-1,-1),new i("dum",-1,-1),new i("tum",-1,-1),new i("düm",-1,-1),new i("tüm",-1,-1),new i("dım",-1,-1),new i("tım",-1,-1),new i("din",-1,-1),new i("tin",-1,-1),new i("dun",-1,-1),new i("tun",-1,-1),new i("dün",-1,-1),new i("tün",-1,-1),new i("dın",-1,-1),new i("tın",-1,-1),new i("du",-1,-1),new i("tu",-1,-1),new i("dü",-1,-1),new i("tü",-1,-1),new i("dı",-1,-1),new i("tı",-1,-1)],Pr=[new i("sa",-1,-1),new i("se",-1,-1),new i("sak",-1,-1),new i("sek",-1,-1),new i("sam",-1,-1),new i("sem",-1,-1),new i("san",-1,-1),new i("sen",-1,-1)],Fr=[new i("miş",-1,-1),new i("muş",-1,-1),new i("müş",-1,-1),new i("mış",-1,-1)],Sr=[new i("b",-1,1),new i("c",-1,2),new i("d",-1,3),new i("ğ",-1,4)],Wr=[17,65,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,32,8,0,0,0,0,0,0,1],Lr=[1,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,0,0,0,0,0,0,1],xr=[1,64,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1],Ar=[17,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,130],Er=[1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1],jr=[17],Tr=[65],Zr=[65],Br=[["a",xr,97,305],["e",Ar,101,252],["ı",Er,97,305],["i",jr,101,105],["o",Tr,111,117],["ö",Zr,246,252],["u",Tr,111,117]],Dr=new e;this.setCurrent=function(r){Dr.setCurrent(r)},this.getCurrent=function(){return Dr.getCurrent()},this.stem=function(){return!!($()&&(Dr.limit_backward=Dr.cursor,Dr.cursor=Dr.limit,J(),Dr.cursor=Dr.limit,nr&&(R(),Dr.cursor=Dr.limit_backward,er())))}};return function(r){return"function"==typeof r.update?r.update(function(r){return n.setCurrent(r),n.stem(),n.getCurrent()}):(n.setCurrent(r),n.stem(),n.getCurrent())}}(),r.Pipeline.registerFunction(r.tr.stemmer,"stemmer-tr"),r.tr.stopWordFilter=r.generateStopWordFilter("acaba altmış altı ama ancak arada aslında ayrıca bana bazı belki ben benden beni benim beri beş bile bin bir biri birkaç birkez birçok birşey birşeyi biz bizden bize bizi bizim bu buna bunda bundan bunlar bunları bunların bunu bunun burada böyle böylece da daha dahi de defa değil diye diğer doksan dokuz dolayı dolayısıyla dört edecek eden ederek edilecek ediliyor edilmesi ediyor elli en etmesi etti ettiği ettiğini eğer gibi göre halen hangi hatta hem henüz hep hepsi her herhangi herkesin hiç hiçbir iki ile ilgili ise itibaren itibariyle için işte kadar karşın katrilyon kendi kendilerine kendini kendisi kendisine kendisini kez ki kim kimden kime kimi kimse kırk milyar milyon mu mü mı nasıl ne neden nedenle nerde nerede nereye niye niçin o olan olarak oldu olduklarını olduğu olduğunu olmadı olmadığı olmak olması olmayan olmaz olsa olsun olup olur olursa oluyor on ona ondan onlar onlardan onları onların onu onun otuz oysa pek rağmen sadece sanki sekiz seksen sen senden seni senin siz sizden sizi sizin tarafından trilyon tüm var vardı ve veya ya yani yapacak yapmak yaptı yaptıkları yaptığı yaptığını yapılan yapılması yapıyor yedi yerine yetmiş yine yirmi yoksa yüz zaten çok çünkü öyle üzere üç şey şeyden şeyi şeyler şu şuna şunda şundan şunları şunu şöyle".split(" ")),r.Pipeline.registerFunction(r.tr.stopWordFilter,"stopWordFilter-tr")}}); \ No newline at end of file diff --git a/docs/public/assets/javascripts/lunr/min/lunr.vi.min.js b/docs/assets/javascripts/lunr/min/lunr.vi.min.js similarity index 100% rename from docs/public/assets/javascripts/lunr/min/lunr.vi.min.js rename to docs/assets/javascripts/lunr/min/lunr.vi.min.js diff --git a/docs/public/assets/javascripts/lunr/min/lunr.zh.min.js b/docs/assets/javascripts/lunr/min/lunr.zh.min.js similarity index 100% rename from docs/public/assets/javascripts/lunr/min/lunr.zh.min.js rename to docs/assets/javascripts/lunr/min/lunr.zh.min.js diff --git a/docs/public/assets/javascripts/lunr/tinyseg.js b/docs/assets/javascripts/lunr/tinyseg.js similarity index 100% rename from docs/public/assets/javascripts/lunr/tinyseg.js rename to docs/assets/javascripts/lunr/tinyseg.js diff --git a/docs/public/assets/javascripts/lunr/wordcut.js b/docs/assets/javascripts/lunr/wordcut.js similarity index 99% rename from docs/public/assets/javascripts/lunr/wordcut.js rename to docs/assets/javascripts/lunr/wordcut.js index 6dffd9c32..0d898c9ed 100644 --- a/docs/public/assets/javascripts/lunr/wordcut.js +++ b/docs/assets/javascripts/lunr/wordcut.js @@ -4346,7 +4346,7 @@ var process = module.exports = {}; var cachedSetTimeout; var cachedClearTimeout; -function defaultSetTimeout() { +function defaultSetTimout() { throw new Error('setTimeout has not been defined'); } function defaultClearTimeout () { @@ -4357,10 +4357,10 @@ function defaultClearTimeout () { if (typeof setTimeout === 'function') { cachedSetTimeout = setTimeout; } else { - cachedSetTimeout = defaultSetTimeout; + cachedSetTimeout = defaultSetTimout; } } catch (e) { - cachedSetTimeout = defaultSetTimeout; + cachedSetTimeout = defaultSetTimout; } try { if (typeof clearTimeout === 'function') { @@ -4374,23 +4374,23 @@ function defaultClearTimeout () { } ()) function runTimeout(fun) { if (cachedSetTimeout === setTimeout) { - //normal environments in sane situations + //normal enviroments in sane situations return setTimeout(fun, 0); } // if setTimeout wasn't available but was latter defined - if ((cachedSetTimeout === defaultSetTimeout || !cachedSetTimeout) && setTimeout) { + if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { cachedSetTimeout = setTimeout; return setTimeout(fun, 0); } try { - // when when somebody has screwed with setTimeout but no I.E. madness + // when when somebody has screwed with setTimeout but no I.E. maddness return cachedSetTimeout(fun, 0); } catch(e){ try { // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally return cachedSetTimeout.call(null, fun, 0); } catch(e){ - // same as above but when it's a version of I.E. that must have the global object for 'this', hopefully our context correct otherwise it will throw a global error + // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error return cachedSetTimeout.call(this, fun, 0); } } @@ -4399,7 +4399,7 @@ function runTimeout(fun) { } function runClearTimeout(marker) { if (cachedClearTimeout === clearTimeout) { - //normal environments in sane situations + //normal enviroments in sane situations return clearTimeout(marker); } // if clearTimeout wasn't available but was latter defined @@ -4408,14 +4408,14 @@ function runClearTimeout(marker) { return clearTimeout(marker); } try { - // when when somebody has screwed with setTimeout but no I.E. madness + // when when somebody has screwed with setTimeout but no I.E. maddness return cachedClearTimeout(marker); } catch (e){ try { // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally return cachedClearTimeout.call(null, marker); } catch (e){ - // same as above but when it's a version of I.E. that must have the global object for 'this', hopefully our context correct otherwise it will throw a global error. + // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. // Some versions of I.E. have different rules for clearTimeout vs setTimeout return cachedClearTimeout.call(this, marker); } @@ -4481,7 +4481,7 @@ process.nextTick = function (fun) { } }; -// v8 likes predictable objects +// v8 likes predictible objects function Item(fun, array) { this.fun = fun; this.array = array; @@ -5617,7 +5617,7 @@ process.umask = function() { return 0; }; // Internal recursive comparison function for `isEqual`. var eq = function(a, b, aStack, bStack) { // Identical objects are equal. `0 === -0`, but they aren't identical. - // See the [Harmony `equal` proposal](http://wiki.ecmascript.org/doku.php?id=harmony:egal). + // See the [Harmony `egal` proposal](http://wiki.ecmascript.org/doku.php?id=harmony:egal). if (a === b) return a !== 0 || 1 / a === 1 / b; // A strict comparison is necessary because `null == undefined`. if (a == null || b == null) return a === b; @@ -5639,7 +5639,7 @@ process.umask = function() { return 0; }; // `NaN`s are equivalent, but non-reflexive. // Object(NaN) is equivalent to NaN if (+a !== +a) return +b !== +b; - // An `equal` comparison is performed for other numeric values. + // An `egal` comparison is performed for other numeric values. return +a === 0 ? 1 / +a === 1 / b : +a === +b; case '[object Date]': case '[object Boolean]': @@ -5961,7 +5961,7 @@ process.umask = function() { return 0; }; source += "';\n" + evaluate + "\n__p+='"; } - // Adobe VMs need the match returned to produce the correct offset. + // Adobe VMs need the match returned to produce the correct offest. return match; }); source += "';\n"; @@ -6198,7 +6198,7 @@ exports.debuglog = function(set) { /** - * Echos the value of a value. Tries to print the value out + * Echos the value of a value. Trys to print the value out * in the best way possible given the different types. * * @param {Object} obj The object to print out. diff --git a/docs/assets/javascripts/workers/search.f2da59ea.min.js b/docs/assets/javascripts/workers/search.f2da59ea.min.js new file mode 100644 index 000000000..b53ca596b --- /dev/null +++ b/docs/assets/javascripts/workers/search.f2da59ea.min.js @@ -0,0 +1,2 @@ +"use strict";(()=>{var xe=Object.create;var G=Object.defineProperty,ve=Object.defineProperties,Se=Object.getOwnPropertyDescriptor,Te=Object.getOwnPropertyDescriptors,Qe=Object.getOwnPropertyNames,Y=Object.getOwnPropertySymbols,Ee=Object.getPrototypeOf,X=Object.prototype.hasOwnProperty,be=Object.prototype.propertyIsEnumerable;var Z=Math.pow,J=(t,e,r)=>e in t?G(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,_=(t,e)=>{for(var r in e||(e={}))X.call(e,r)&&J(t,r,e[r]);if(Y)for(var r of Y(e))be.call(e,r)&&J(t,r,e[r]);return t},B=(t,e)=>ve(t,Te(e));var Le=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var we=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Qe(e))!X.call(t,i)&&i!==r&&G(t,i,{get:()=>e[i],enumerable:!(n=Se(e,i))||n.enumerable});return t};var Pe=(t,e,r)=>(r=t!=null?xe(Ee(t)):{},we(e||!t||!t.__esModule?G(r,"default",{value:t,enumerable:!0}):r,t));var W=(t,e,r)=>new Promise((n,i)=>{var s=u=>{try{a(r.next(u))}catch(c){i(c)}},o=u=>{try{a(r.throw(u))}catch(c){i(c)}},a=u=>u.done?n(u.value):Promise.resolve(u.value).then(s,o);a((r=r.apply(t,e)).next())});var te=Le((K,ee)=>{(function(){var t=function(e){var r=new t.Builder;return r.pipeline.add(t.trimmer,t.stopWordFilter,t.stemmer),r.searchPipeline.add(t.stemmer),e.call(r,r),r.build()};t.version="2.3.9";t.utils={},t.utils.warn=function(e){return function(r){e.console&&console.warn&&console.warn(r)}}(this),t.utils.asString=function(e){return e==null?"":e.toString()},t.utils.clone=function(e){if(e==null)return e;for(var r=Object.create(null),n=Object.keys(e),i=0;i0){var l=t.utils.clone(r)||{};l.position=[a,c],l.index=s.length,s.push(new t.Token(n.slice(a,o),l))}a=o+1}}return s},t.tokenizer.separator=/[\s\-]+/;t.Pipeline=function(){this._stack=[]},t.Pipeline.registeredFunctions=Object.create(null),t.Pipeline.registerFunction=function(e,r){r in this.registeredFunctions&&t.utils.warn("Overwriting existing registered function: "+r),e.label=r,t.Pipeline.registeredFunctions[e.label]=e},t.Pipeline.warnIfFunctionNotRegistered=function(e){var r=e.label&&e.label in this.registeredFunctions;r||t.utils.warn(`Function is not registered with pipeline. This may cause problems when serialising the index. +`,e)},t.Pipeline.load=function(e){var r=new t.Pipeline;return e.forEach(function(n){var i=t.Pipeline.registeredFunctions[n];if(i)r.add(i);else throw new Error("Cannot load unregistered function: "+n)}),r},t.Pipeline.prototype.add=function(){var e=Array.prototype.slice.call(arguments);e.forEach(function(r){t.Pipeline.warnIfFunctionNotRegistered(r),this._stack.push(r)},this)},t.Pipeline.prototype.after=function(e,r){t.Pipeline.warnIfFunctionNotRegistered(r);var n=this._stack.indexOf(e);if(n==-1)throw new Error("Cannot find existingFn");n=n+1,this._stack.splice(n,0,r)},t.Pipeline.prototype.before=function(e,r){t.Pipeline.warnIfFunctionNotRegistered(r);var n=this._stack.indexOf(e);if(n==-1)throw new Error("Cannot find existingFn");this._stack.splice(n,0,r)},t.Pipeline.prototype.remove=function(e){var r=this._stack.indexOf(e);r!=-1&&this._stack.splice(r,1)},t.Pipeline.prototype.run=function(e){for(var r=this._stack.length,n=0;n1&&(oe&&(n=s),o!=e);)i=n-r,s=r+Math.floor(i/2),o=this.elements[s*2];if(o==e||o>e)return s*2;if(ou?l+=2:a==u&&(r+=n[c+1]*i[l+1],c+=2,l+=2);return r},t.Vector.prototype.similarity=function(e){return this.dot(e)/this.magnitude()||0},t.Vector.prototype.toArray=function(){for(var e=new Array(this.elements.length/2),r=1,n=0;r0){var o=s.str.charAt(0),a;o in s.node.edges?a=s.node.edges[o]:(a=new t.TokenSet,s.node.edges[o]=a),s.str.length==1&&(a.final=!0),i.push({node:a,editsRemaining:s.editsRemaining,str:s.str.slice(1)})}if(s.editsRemaining!=0){if("*"in s.node.edges)var u=s.node.edges["*"];else{var u=new t.TokenSet;s.node.edges["*"]=u}if(s.str.length==0&&(u.final=!0),i.push({node:u,editsRemaining:s.editsRemaining-1,str:s.str}),s.str.length>1&&i.push({node:s.node,editsRemaining:s.editsRemaining-1,str:s.str.slice(1)}),s.str.length==1&&(s.node.final=!0),s.str.length>=1){if("*"in s.node.edges)var c=s.node.edges["*"];else{var c=new t.TokenSet;s.node.edges["*"]=c}s.str.length==1&&(c.final=!0),i.push({node:c,editsRemaining:s.editsRemaining-1,str:s.str.slice(1)})}if(s.str.length>1){var l=s.str.charAt(0),g=s.str.charAt(1),f;g in s.node.edges?f=s.node.edges[g]:(f=new t.TokenSet,s.node.edges[g]=f),s.str.length==1&&(f.final=!0),i.push({node:f,editsRemaining:s.editsRemaining-1,str:l+s.str.slice(2)})}}}return n},t.TokenSet.fromString=function(e){for(var r=new t.TokenSet,n=r,i=0,s=e.length;i=e;r--){var n=this.uncheckedNodes[r],i=n.child.toString();i in this.minimizedNodes?n.parent.edges[n.char]=this.minimizedNodes[i]:(n.child._str=i,this.minimizedNodes[i]=n.child),this.uncheckedNodes.pop()}};t.Index=function(e){this.invertedIndex=e.invertedIndex,this.fieldVectors=e.fieldVectors,this.tokenSet=e.tokenSet,this.fields=e.fields,this.pipeline=e.pipeline},t.Index.prototype.search=function(e){return this.query(function(r){var n=new t.QueryParser(e,r);n.parse()})},t.Index.prototype.query=function(e){for(var r=new t.Query(this.fields),n=Object.create(null),i=Object.create(null),s=Object.create(null),o=Object.create(null),a=Object.create(null),u=0;u1?this._b=1:this._b=e},t.Builder.prototype.k1=function(e){this._k1=e},t.Builder.prototype.add=function(e,r){var n=e[this._ref],i=Object.keys(this._fields);this._documents[n]=r||{},this.documentCount+=1;for(var s=0;s=this.length)return t.QueryLexer.EOS;var e=this.str.charAt(this.pos);return this.pos+=1,e},t.QueryLexer.prototype.width=function(){return this.pos-this.start},t.QueryLexer.prototype.ignore=function(){this.start==this.pos&&(this.pos+=1),this.start=this.pos},t.QueryLexer.prototype.backup=function(){this.pos-=1},t.QueryLexer.prototype.acceptDigitRun=function(){var e,r;do e=this.next(),r=e.charCodeAt(0);while(r>47&&r<58);e!=t.QueryLexer.EOS&&this.backup()},t.QueryLexer.prototype.more=function(){return this.pos1&&(e.backup(),e.emit(t.QueryLexer.TERM)),e.ignore(),e.more())return t.QueryLexer.lexText},t.QueryLexer.lexEditDistance=function(e){return e.ignore(),e.acceptDigitRun(),e.emit(t.QueryLexer.EDIT_DISTANCE),t.QueryLexer.lexText},t.QueryLexer.lexBoost=function(e){return e.ignore(),e.acceptDigitRun(),e.emit(t.QueryLexer.BOOST),t.QueryLexer.lexText},t.QueryLexer.lexEOS=function(e){e.width()>0&&e.emit(t.QueryLexer.TERM)},t.QueryLexer.termSeparator=t.tokenizer.separator,t.QueryLexer.lexText=function(e){for(;;){var r=e.next();if(r==t.QueryLexer.EOS)return t.QueryLexer.lexEOS;if(r.charCodeAt(0)==92){e.escapeCharacter();continue}if(r==":")return t.QueryLexer.lexField;if(r=="~")return e.backup(),e.width()>0&&e.emit(t.QueryLexer.TERM),t.QueryLexer.lexEditDistance;if(r=="^")return e.backup(),e.width()>0&&e.emit(t.QueryLexer.TERM),t.QueryLexer.lexBoost;if(r=="+"&&e.width()===1||r=="-"&&e.width()===1)return e.emit(t.QueryLexer.PRESENCE),t.QueryLexer.lexText;if(r.match(t.QueryLexer.termSeparator))return t.QueryLexer.lexTerm}},t.QueryParser=function(e,r){this.lexer=new t.QueryLexer(e),this.query=r,this.currentClause={},this.lexemeIdx=0},t.QueryParser.prototype.parse=function(){this.lexer.run(),this.lexemes=this.lexer.lexemes;for(var e=t.QueryParser.parseClause;e;)e=e(this);return this.query},t.QueryParser.prototype.peekLexeme=function(){return this.lexemes[this.lexemeIdx]},t.QueryParser.prototype.consumeLexeme=function(){var e=this.peekLexeme();return this.lexemeIdx+=1,e},t.QueryParser.prototype.nextClause=function(){var e=this.currentClause;this.query.clause(e),this.currentClause={}},t.QueryParser.parseClause=function(e){var r=e.peekLexeme();if(r!=null)switch(r.type){case t.QueryLexer.PRESENCE:return t.QueryParser.parsePresence;case t.QueryLexer.FIELD:return t.QueryParser.parseField;case t.QueryLexer.TERM:return t.QueryParser.parseTerm;default:var n="expected either a field or a term, found "+r.type;throw r.str.length>=1&&(n+=" with value '"+r.str+"'"),new t.QueryParseError(n,r.start,r.end)}},t.QueryParser.parsePresence=function(e){var r=e.consumeLexeme();if(r!=null){switch(r.str){case"-":e.currentClause.presence=t.Query.presence.PROHIBITED;break;case"+":e.currentClause.presence=t.Query.presence.REQUIRED;break;default:var n="unrecognised presence operator'"+r.str+"'";throw new t.QueryParseError(n,r.start,r.end)}var i=e.peekLexeme();if(i==null){var n="expecting term or field, found nothing";throw new t.QueryParseError(n,r.start,r.end)}switch(i.type){case t.QueryLexer.FIELD:return t.QueryParser.parseField;case t.QueryLexer.TERM:return t.QueryParser.parseTerm;default:var n="expecting term or field, found '"+i.type+"'";throw new t.QueryParseError(n,i.start,i.end)}}},t.QueryParser.parseField=function(e){var r=e.consumeLexeme();if(r!=null){if(e.query.allFields.indexOf(r.str)==-1){var n=e.query.allFields.map(function(o){return"'"+o+"'"}).join(", "),i="unrecognised field '"+r.str+"', possible fields: "+n;throw new t.QueryParseError(i,r.start,r.end)}e.currentClause.fields=[r.str];var s=e.peekLexeme();if(s==null){var i="expecting term, found nothing";throw new t.QueryParseError(i,r.start,r.end)}switch(s.type){case t.QueryLexer.TERM:return t.QueryParser.parseTerm;default:var i="expecting term, found '"+s.type+"'";throw new t.QueryParseError(i,s.start,s.end)}}},t.QueryParser.parseTerm=function(e){var r=e.consumeLexeme();if(r!=null){e.currentClause.term=r.str.toLowerCase(),r.str.indexOf("*")!=-1&&(e.currentClause.usePipeline=!1);var n=e.peekLexeme();if(n==null){e.nextClause();return}switch(n.type){case t.QueryLexer.TERM:return e.nextClause(),t.QueryParser.parseTerm;case t.QueryLexer.FIELD:return e.nextClause(),t.QueryParser.parseField;case t.QueryLexer.EDIT_DISTANCE:return t.QueryParser.parseEditDistance;case t.QueryLexer.BOOST:return t.QueryParser.parseBoost;case t.QueryLexer.PRESENCE:return e.nextClause(),t.QueryParser.parsePresence;default:var i="Unexpected lexeme type '"+n.type+"'";throw new t.QueryParseError(i,n.start,n.end)}}},t.QueryParser.parseEditDistance=function(e){var r=e.consumeLexeme();if(r!=null){var n=parseInt(r.str,10);if(isNaN(n)){var i="edit distance must be numeric";throw new t.QueryParseError(i,r.start,r.end)}e.currentClause.editDistance=n;var s=e.peekLexeme();if(s==null){e.nextClause();return}switch(s.type){case t.QueryLexer.TERM:return e.nextClause(),t.QueryParser.parseTerm;case t.QueryLexer.FIELD:return e.nextClause(),t.QueryParser.parseField;case t.QueryLexer.EDIT_DISTANCE:return t.QueryParser.parseEditDistance;case t.QueryLexer.BOOST:return t.QueryParser.parseBoost;case t.QueryLexer.PRESENCE:return e.nextClause(),t.QueryParser.parsePresence;default:var i="Unexpected lexeme type '"+s.type+"'";throw new t.QueryParseError(i,s.start,s.end)}}},t.QueryParser.parseBoost=function(e){var r=e.consumeLexeme();if(r!=null){var n=parseInt(r.str,10);if(isNaN(n)){var i="boost must be numeric";throw new t.QueryParseError(i,r.start,r.end)}e.currentClause.boost=n;var s=e.peekLexeme();if(s==null){e.nextClause();return}switch(s.type){case t.QueryLexer.TERM:return e.nextClause(),t.QueryParser.parseTerm;case t.QueryLexer.FIELD:return e.nextClause(),t.QueryParser.parseField;case t.QueryLexer.EDIT_DISTANCE:return t.QueryParser.parseEditDistance;case t.QueryLexer.BOOST:return t.QueryParser.parseBoost;case t.QueryLexer.PRESENCE:return e.nextClause(),t.QueryParser.parsePresence;default:var i="Unexpected lexeme type '"+s.type+"'";throw new t.QueryParseError(i,s.start,s.end)}}},function(e,r){typeof define=="function"&&define.amd?define(r):typeof K=="object"?ee.exports=r():e.lunr=r()}(this,function(){return t})})()});var de=Pe(te());function re(t,e=document){let r=ke(t,e);if(typeof r=="undefined")throw new ReferenceError(`Missing element: expected "${t}" to be present`);return r}function ke(t,e=document){return e.querySelector(t)||void 0}Object.entries||(Object.entries=function(t){let e=[];for(let r of Object.keys(t))e.push([r,t[r]]);return e});Object.values||(Object.values=function(t){let e=[];for(let r of Object.keys(t))e.push(t[r]);return e});typeof Element!="undefined"&&(Element.prototype.scrollTo||(Element.prototype.scrollTo=function(t,e){typeof t=="object"?(this.scrollLeft=t.left,this.scrollTop=t.top):(this.scrollLeft=t,this.scrollTop=e)}),Element.prototype.replaceWith||(Element.prototype.replaceWith=function(...t){let e=this.parentNode;if(e){t.length===0&&e.removeChild(this);for(let r=t.length-1;r>=0;r--){let n=t[r];typeof n=="string"?n=document.createTextNode(n):n.parentNode&&n.parentNode.removeChild(n),r?e.insertBefore(this.previousSibling,n):e.replaceChild(n,this)}}}));function ne(t){let e=new Map;for(let r of t){let[n]=r.location.split("#"),i=e.get(n);typeof i=="undefined"?e.set(n,r):(e.set(r.location,r),r.parent=i)}return e}function H(t,e,r){var s;e=new RegExp(e,"g");let n,i=0;do{n=e.exec(t);let o=(s=n==null?void 0:n.index)!=null?s:t.length;if(in?e(r,1,n,n=i):t.charAt(i)===">"&&(t.charAt(n+1)==="/"?--s===0&&e(r++,2,n,i+1):t.charAt(i-1)!=="/"&&s++===0&&e(r,0,n,i+1),n=i+1);i>n&&e(r,1,n,i)}function se(t,e,r){return q([t],e,r).pop()}function q(t,e,r){let n=[0];for(let i=1;i>>2&1023,u=o[0]>>>12;n.push(+(a>u)+n[n.length-1])}return t.map((i,s)=>{let o=new Map;for(let u of r.sort((c,l)=>c-l)){let c=u&1048575,l=u>>>20;if(n[l]!==s)continue;let g=o.get(l);typeof g=="undefined"&&o.set(l,g=[]),g.push(c)}if(o.size===0)return i;let a=[];for(let[u,c]of o){let l=e[u],g=l[0]>>>12,f=l[l.length-1]>>>12,v=l[l.length-1]>>>2&1023,m=i.slice(g,f+v);for(let x of c.sort((d,y)=>y-d)){let d=(l[x]>>>12)-g,y=(l[x]>>>2&1023)+d;m=[m.slice(0,d),"",m.slice(d,y),"",m.slice(y)].join("")}if(a.push(m)===2)break}return a.join("")})}function oe(t){let e=[];if(typeof t=="undefined")return e;let r=Array.isArray(t)?t:[t];for(let n=0;n{var l;switch(i[l=o+=s]||(i[l]=[]),a){case 0:case 2:i[o].push(u<<12|c-u<<2|a);break;case 1:let g=r[n].slice(u,c);H(g,lunr.tokenizer.separator,(f,v)=>{if(typeof lunr.segmenter!="undefined"){let m=g.slice(f,v);if(/^[MHIK]$/.test(lunr.segmenter.ctype_(m))){let x=lunr.segmenter.segment(m);for(let d=0,y=0;dr){return t.trim().split(/"([^"]+)"/g).map((r,n)=>n&1?r.replace(/^\b|^(?![^\x00-\x7F]|$)|\s+/g," +"):r).join("").replace(/"|(?:^|\s+)[*+\-:^~]+(?=\s+|$)/g,"").split(/\s+/g).reduce((r,n)=>{let i=e(n);return[...r,...Array.isArray(i)?i:[i]]},[]).map(r=>/([~^]$)/.test(r)?`${r}1`:r).map(r=>/(^[+-]|[~^]\d+$)/.test(r)?r:`${r}*`).join(" ")}function ue(t){return ae(t,e=>{let r=[],n=new lunr.QueryLexer(e);n.run();for(let{type:i,str:s,start:o,end:a}of n.lexemes)switch(i){case"FIELD":["title","text","tags"].includes(s)||(e=[e.slice(0,a)," ",e.slice(a+1)].join(""));break;case"TERM":H(s,lunr.tokenizer.separator,(...u)=>{r.push([e.slice(0,o),s.slice(...u),e.slice(a)].join(""))})}return r})}function ce(t){let e=new lunr.Query(["title","text","tags"]);new lunr.QueryParser(t,e).parse();for(let n of e.clauses)n.usePipeline=!0,n.term.startsWith("*")&&(n.wildcard=lunr.Query.wildcard.LEADING,n.term=n.term.slice(1)),n.term.endsWith("*")&&(n.wildcard=lunr.Query.wildcard.TRAILING,n.term=n.term.slice(0,-1));return e.clauses}function le(t,e){var i;let r=new Set(t),n={};for(let s=0;s0;){let o=i[--s];for(let u=1;un[o]-u&&(r.add(t.slice(o,o+u)),i[s++]=o+u);let a=o+n[o];n[a]&&ar=>{if(typeof r[e]=="undefined")return;let n=[r.location,e].join(":");return t.set(n,lunr.tokenizer.table=[]),r[e]}}function Re(t,e){let[r,n]=[new Set(t),new Set(e)];return[...new Set([...r].filter(i=>!n.has(i)))]}var U=class{constructor({config:e,docs:r,options:n}){let i=Oe(this.table=new Map);this.map=ne(r),this.options=n,this.index=lunr(function(){this.metadataWhitelist=["position"],this.b(0),e.lang.length===1&&e.lang[0]!=="en"?this.use(lunr[e.lang[0]]):e.lang.length>1&&this.use(lunr.multiLanguage(...e.lang)),this.tokenizer=oe,lunr.tokenizer.separator=new RegExp(e.separator),lunr.segmenter="TinySegmenter"in lunr?new lunr.TinySegmenter:void 0;let s=Re(["trimmer","stopWordFilter","stemmer"],e.pipeline);for(let o of e.lang.map(a=>a==="en"?lunr:lunr[a]))for(let a of s)this.pipeline.remove(o[a]),this.searchPipeline.remove(o[a]);this.ref("location");for(let[o,a]of Object.entries(e.fields))this.field(o,B(_({},a),{extractor:i(o)}));for(let o of r)this.add(o,{boost:o.boost})})}search(e){if(e=e.replace(new RegExp("\\p{sc=Han}+","gu"),s=>[...he(s,this.index.invertedIndex)].join("* ")),e=ue(e),!e)return{items:[]};let r=ce(e).filter(s=>s.presence!==lunr.Query.presence.PROHIBITED),n=this.index.search(e).reduce((s,{ref:o,score:a,matchData:u})=>{let c=this.map.get(o);if(typeof c!="undefined"){c=_({},c),c.tags&&(c.tags=[...c.tags]);let l=le(r,Object.keys(u.metadata));for(let f of this.index.fields){if(typeof c[f]=="undefined")continue;let v=[];for(let d of Object.values(u.metadata))typeof d[f]!="undefined"&&v.push(...d[f].position);if(!v.length)continue;let m=this.table.get([c.location,f].join(":")),x=Array.isArray(c[f])?q:se;c[f]=x(c[f],m,v)}let g=+!c.parent+Object.values(l).filter(f=>f).length/Object.keys(l).length;s.push(B(_({},c),{score:a*(1+Z(g,2)),terms:l}))}return s},[]).sort((s,o)=>o.score-s.score).reduce((s,o)=>{let a=this.map.get(o.location);if(typeof a!="undefined"){let u=a.parent?a.parent.location:a.location;s.set(u,[...s.get(u)||[],o])}return s},new Map);for(let[s,o]of n)if(!o.find(a=>a.location===s)){let a=this.map.get(s);o.push(B(_({},a),{score:0,terms:{}}))}let i;if(this.options.suggest){let s=this.index.query(o=>{for(let a of r)o.term(a.term,{fields:["title"],presence:lunr.Query.presence.REQUIRED,wildcard:lunr.Query.wildcard.TRAILING})});i=s.length?Object.keys(s[0].matchData.metadata):[]}return _({items:[...n.values()]},typeof i!="undefined"&&{suggest:i})}};var fe;function Ie(t){return W(this,null,function*(){let e="../lunr";if(typeof parent!="undefined"&&"IFrameWorker"in parent){let n=re("script[src]"),[i]=n.src.split("/worker");e=e.replace("..",i)}let r=[];for(let n of t.lang){switch(n){case"ja":r.push(`${e}/tinyseg.js`);break;case"hi":case"th":r.push(`${e}/wordcut.js`);break}n!=="en"&&r.push(`${e}/min/lunr.${n}.min.js`)}t.lang.length>1&&r.push(`${e}/min/lunr.multi.min.js`),r.length&&(yield importScripts(`${e}/min/lunr.stemmer.support.min.js`,...r))})}function Fe(t){return W(this,null,function*(){switch(t.type){case 0:return yield Ie(t.data.config),fe=new U(t.data),{type:1};case 2:let e=t.data;try{return{type:3,data:fe.search(e)}}catch(r){return console.warn(`Invalid query: ${e} \u2013 see https://bit.ly/2s3ChXG`),console.warn(r),{type:3,data:{items:[]}}}default:throw new TypeError("Invalid message type")}})}self.lunr=de.default;addEventListener("message",t=>W(void 0,null,function*(){postMessage(yield Fe(t.data))}));})(); diff --git a/docs/assets/stylesheets/main.c4d31a9e.min.css b/docs/assets/stylesheets/main.c4d31a9e.min.css new file mode 100644 index 000000000..21d3e2621 --- /dev/null +++ b/docs/assets/stylesheets/main.c4d31a9e.min.css @@ -0,0 +1 @@ +@charset "UTF-8";html{-webkit-text-size-adjust:none;-moz-text-size-adjust:none;text-size-adjust:none;box-sizing:border-box}*,:after,:before{box-sizing:inherit}@media (prefers-reduced-motion){*,:after,:before{transition:none!important}}body{margin:0}a,button,input,label{-webkit-tap-highlight-color:transparent}a{color:inherit;text-decoration:none}hr{border:0;box-sizing:initial;display:block;height:.05rem;overflow:visible;padding:0}small{font-size:80%}sub,sup{line-height:1em}img{border-style:none}table{border-collapse:initial;border-spacing:0}td,th{font-weight:400;vertical-align:top}button{background:#0000;border:0;font-family:inherit;font-size:inherit;margin:0;padding:0}input{border:0;outline:none}:root{--md-primary-fg-color:#4051b5;--md-primary-fg-color--light:#5d6cc0;--md-primary-fg-color--dark:#303fa1;--md-primary-bg-color:#fff;--md-primary-bg-color--light:#ffffffb3;--md-accent-fg-color:#526cfe;--md-accent-fg-color--transparent:#526cfe1a;--md-accent-bg-color:#fff;--md-accent-bg-color--light:#ffffffb3}[data-md-color-scheme=default]{color-scheme:light}[data-md-color-scheme=default] img[src$="#gh-dark-mode-only"],[data-md-color-scheme=default] img[src$="#only-dark"]{display:none}:root,[data-md-color-scheme=default]{--md-default-fg-color:#000000de;--md-default-fg-color--light:#0000008a;--md-default-fg-color--lighter:#00000052;--md-default-fg-color--lightest:#00000012;--md-default-bg-color:#fff;--md-default-bg-color--light:#ffffffb3;--md-default-bg-color--lighter:#ffffff4d;--md-default-bg-color--lightest:#ffffff1f;--md-code-fg-color:#36464e;--md-code-bg-color:#f5f5f5;--md-code-bg-color--light:#f5f5f5b3;--md-code-hl-color:#4287ff;--md-code-hl-color--light:#4287ff1a;--md-code-hl-number-color:#d52a2a;--md-code-hl-special-color:#db1457;--md-code-hl-function-color:#a846b9;--md-code-hl-constant-color:#6e59d9;--md-code-hl-keyword-color:#3f6ec6;--md-code-hl-string-color:#1c7d4d;--md-code-hl-name-color:var(--md-code-fg-color);--md-code-hl-operator-color:var(--md-default-fg-color--light);--md-code-hl-punctuation-color:var(--md-default-fg-color--light);--md-code-hl-comment-color:var(--md-default-fg-color--light);--md-code-hl-generic-color:var(--md-default-fg-color--light);--md-code-hl-variable-color:var(--md-default-fg-color--light);--md-typeset-color:var(--md-default-fg-color);--md-typeset-a-color:var(--md-primary-fg-color);--md-typeset-mark-color:#ffff0080;--md-typeset-del-color:#f5503d26;--md-typeset-ins-color:#0bd57026;--md-typeset-kbd-color:#fafafa;--md-typeset-kbd-accent-color:#fff;--md-typeset-kbd-border-color:#b8b8b8;--md-typeset-table-color:#0000001f;--md-typeset-table-color--light:rgba(0,0,0,.035);--md-admonition-fg-color:var(--md-default-fg-color);--md-admonition-bg-color:var(--md-default-bg-color);--md-warning-fg-color:#000000de;--md-warning-bg-color:#ff9;--md-footer-fg-color:#fff;--md-footer-fg-color--light:#ffffffb3;--md-footer-fg-color--lighter:#ffffff73;--md-footer-bg-color:#000000de;--md-footer-bg-color--dark:#00000052;--md-shadow-z1:0 0.2rem 0.5rem #0000000d,0 0 0.05rem #0000001a;--md-shadow-z2:0 0.2rem 0.5rem #0000001a,0 0 0.05rem #00000040;--md-shadow-z3:0 0.2rem 0.5rem #0003,0 0 0.05rem #00000059}.md-icon svg{fill:currentcolor;display:block;height:1.2rem;width:1.2rem}body{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;--md-text-font-family:var(--md-text-font,_),-apple-system,BlinkMacSystemFont,Helvetica,Arial,sans-serif;--md-code-font-family:var(--md-code-font,_),SFMono-Regular,Consolas,Menlo,monospace}aside,body,input{font-feature-settings:"kern","liga";color:var(--md-typeset-color);font-family:var(--md-text-font-family)}code,kbd,pre{font-feature-settings:"kern";font-family:var(--md-code-font-family)}:root{--md-typeset-table-sort-icon:url('data:image/svg+xml;charset=utf-8,');--md-typeset-table-sort-icon--asc:url('data:image/svg+xml;charset=utf-8,');--md-typeset-table-sort-icon--desc:url('data:image/svg+xml;charset=utf-8,')}.md-typeset{-webkit-print-color-adjust:exact;color-adjust:exact;font-size:.8rem;line-height:1.6}@media print{.md-typeset{font-size:.68rem}}.md-typeset blockquote,.md-typeset dl,.md-typeset figure,.md-typeset ol,.md-typeset pre,.md-typeset ul{margin-bottom:1em;margin-top:1em}.md-typeset h1{color:var(--md-default-fg-color--light);font-size:2em;line-height:1.3;margin:0 0 1.25em}.md-typeset h1,.md-typeset h2{font-weight:300;letter-spacing:-.01em}.md-typeset h2{font-size:1.5625em;line-height:1.4;margin:1.6em 0 .64em}.md-typeset h3{font-size:1.25em;font-weight:400;letter-spacing:-.01em;line-height:1.5;margin:1.6em 0 .8em}.md-typeset h2+h3{margin-top:.8em}.md-typeset h4{font-weight:700;letter-spacing:-.01em;margin:1em 0}.md-typeset h5,.md-typeset h6{color:var(--md-default-fg-color--light);font-size:.8em;font-weight:700;letter-spacing:-.01em;margin:1.25em 0}.md-typeset h5{text-transform:uppercase}.md-typeset hr{border-bottom:.05rem solid var(--md-default-fg-color--lightest);display:flow-root;margin:1.5em 0}.md-typeset a{color:var(--md-typeset-a-color);word-break:break-word}.md-typeset a,.md-typeset a:before{transition:color 125ms}.md-typeset a:focus,.md-typeset a:hover{color:var(--md-accent-fg-color)}.md-typeset a:focus code,.md-typeset a:hover code{background-color:var(--md-accent-fg-color--transparent);color:var(--md-accent-fg-color)}.md-typeset a code{color:var(--md-typeset-a-color)}.md-typeset a.focus-visible{outline-color:var(--md-accent-fg-color);outline-offset:.2rem}.md-typeset code,.md-typeset kbd,.md-typeset pre{color:var(--md-code-fg-color);direction:ltr;font-variant-ligatures:none;transition:background-color 125ms}@media print{.md-typeset code,.md-typeset kbd,.md-typeset pre{white-space:pre-wrap}}.md-typeset code{background-color:var(--md-code-bg-color);border-radius:.1rem;-webkit-box-decoration-break:clone;box-decoration-break:clone;font-size:.85em;padding:0 .2941176471em;transition:color 125ms,background-color 125ms;word-break:break-word}.md-typeset code:not(.focus-visible){-webkit-tap-highlight-color:transparent;outline:none}.md-typeset pre{display:flow-root;line-height:1.4;position:relative}.md-typeset pre>code{-webkit-box-decoration-break:slice;box-decoration-break:slice;box-shadow:none;display:block;margin:0;outline-color:var(--md-accent-fg-color);overflow:auto;padding:.7720588235em 1.1764705882em;scrollbar-color:var(--md-default-fg-color--lighter) #0000;scrollbar-width:thin;touch-action:auto;word-break:normal}.md-typeset pre>code:hover{scrollbar-color:var(--md-accent-fg-color) #0000}.md-typeset pre>code::-webkit-scrollbar{height:.2rem;width:.2rem}.md-typeset pre>code::-webkit-scrollbar-thumb{background-color:var(--md-default-fg-color--lighter)}.md-typeset pre>code::-webkit-scrollbar-thumb:hover{background-color:var(--md-accent-fg-color)}.md-typeset kbd{background-color:var(--md-typeset-kbd-color);border-radius:.1rem;box-shadow:0 .1rem 0 .05rem var(--md-typeset-kbd-border-color),0 .1rem 0 var(--md-typeset-kbd-border-color),0 -.1rem .2rem var(--md-typeset-kbd-accent-color) inset;color:var(--md-default-fg-color);display:inline-block;font-size:.75em;padding:0 .6666666667em;vertical-align:text-top;word-break:break-word}.md-typeset mark{background-color:var(--md-typeset-mark-color);-webkit-box-decoration-break:clone;box-decoration-break:clone;color:inherit;word-break:break-word}.md-typeset abbr{border-bottom:.05rem dotted var(--md-default-fg-color--light);cursor:help;text-decoration:none}.md-typeset small{opacity:.75}[dir=ltr] .md-typeset sub,[dir=ltr] .md-typeset sup{margin-left:.078125em}[dir=rtl] .md-typeset sub,[dir=rtl] .md-typeset sup{margin-right:.078125em}[dir=ltr] .md-typeset blockquote{padding-left:.6rem}[dir=rtl] .md-typeset blockquote{padding-right:.6rem}[dir=ltr] .md-typeset blockquote{border-left:.2rem solid var(--md-default-fg-color--lighter)}[dir=rtl] .md-typeset blockquote{border-right:.2rem solid var(--md-default-fg-color--lighter)}.md-typeset blockquote{color:var(--md-default-fg-color--light);margin-left:0;margin-right:0}.md-typeset ul{list-style-type:disc}[dir=ltr] .md-typeset ol,[dir=ltr] .md-typeset ul{margin-left:.625em}[dir=rtl] .md-typeset ol,[dir=rtl] .md-typeset ul{margin-right:.625em}.md-typeset ol,.md-typeset ul{padding:0}.md-typeset ol:not([hidden]),.md-typeset ul:not([hidden]){display:flow-root}.md-typeset ol ol,.md-typeset ul ol{list-style-type:lower-alpha}.md-typeset ol ol ol,.md-typeset ul ol ol{list-style-type:lower-roman}[dir=ltr] .md-typeset ol li,[dir=ltr] .md-typeset ul li{margin-left:1.25em}[dir=rtl] .md-typeset ol li,[dir=rtl] .md-typeset ul li{margin-right:1.25em}.md-typeset ol li,.md-typeset ul li{margin-bottom:.5em}.md-typeset ol li blockquote,.md-typeset ol li p,.md-typeset ul li blockquote,.md-typeset ul li p{margin:.5em 0}.md-typeset ol li:last-child,.md-typeset ul li:last-child{margin-bottom:0}[dir=ltr] .md-typeset ol li ol,[dir=ltr] .md-typeset ol li ul,[dir=ltr] .md-typeset ul li ol,[dir=ltr] .md-typeset ul li ul{margin-left:.625em}[dir=rtl] .md-typeset ol li ol,[dir=rtl] .md-typeset ol li ul,[dir=rtl] .md-typeset ul li ol,[dir=rtl] .md-typeset ul li ul{margin-right:.625em}.md-typeset ol li ol,.md-typeset ol li ul,.md-typeset ul li ol,.md-typeset ul li ul{margin-bottom:.5em;margin-top:.5em}[dir=ltr] .md-typeset dd{margin-left:1.875em}[dir=rtl] .md-typeset dd{margin-right:1.875em}.md-typeset dd{margin-bottom:1.5em;margin-top:1em}.md-typeset img,.md-typeset svg,.md-typeset video{height:auto;max-width:100%}.md-typeset img[align=left]{margin:1em 1em 1em 0}.md-typeset img[align=right]{margin:1em 0 1em 1em}.md-typeset img[align]:only-child{margin-top:0}.md-typeset figure{display:flow-root;margin:1em auto;max-width:100%;text-align:center;width:-webkit-fit-content;width:-moz-fit-content;width:fit-content}.md-typeset figure img{display:block}.md-typeset figcaption{font-style:italic;margin:1em auto;max-width:24rem}.md-typeset iframe{max-width:100%}.md-typeset table:not([class]){background-color:var(--md-default-bg-color);border:.05rem solid var(--md-typeset-table-color);border-radius:.1rem;display:inline-block;font-size:.64rem;max-width:100%;overflow:auto;touch-action:auto}@media print{.md-typeset table:not([class]){display:table}}.md-typeset table:not([class])+*{margin-top:1.5em}.md-typeset table:not([class]) td>:first-child,.md-typeset table:not([class]) th>:first-child{margin-top:0}.md-typeset table:not([class]) td>:last-child,.md-typeset table:not([class]) th>:last-child{margin-bottom:0}.md-typeset table:not([class]) td:not([align]),.md-typeset table:not([class]) th:not([align]){text-align:left}[dir=rtl] .md-typeset table:not([class]) td:not([align]),[dir=rtl] .md-typeset table:not([class]) th:not([align]){text-align:right}.md-typeset table:not([class]) th{font-weight:700;min-width:5rem;padding:.9375em 1.25em;vertical-align:top}.md-typeset table:not([class]) td{border-top:.05rem solid var(--md-typeset-table-color);padding:.9375em 1.25em;vertical-align:top}.md-typeset table:not([class]) tbody tr{transition:background-color 125ms}.md-typeset table:not([class]) tbody tr:hover{background-color:var(--md-typeset-table-color--light);box-shadow:0 .05rem 0 var(--md-default-bg-color) inset}.md-typeset table:not([class]) a{word-break:normal}.md-typeset table th[role=columnheader]{cursor:pointer}[dir=ltr] .md-typeset table th[role=columnheader]:after{margin-left:.5em}[dir=rtl] .md-typeset table th[role=columnheader]:after{margin-right:.5em}.md-typeset table th[role=columnheader]:after{content:"";display:inline-block;height:1.2em;-webkit-mask-image:var(--md-typeset-table-sort-icon);mask-image:var(--md-typeset-table-sort-icon);-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;-webkit-mask-size:contain;mask-size:contain;transition:background-color 125ms;vertical-align:text-bottom;width:1.2em}.md-typeset table th[role=columnheader]:hover:after{background-color:var(--md-default-fg-color--lighter)}.md-typeset table th[role=columnheader][aria-sort=ascending]:after{background-color:var(--md-default-fg-color--light);-webkit-mask-image:var(--md-typeset-table-sort-icon--asc);mask-image:var(--md-typeset-table-sort-icon--asc)}.md-typeset table th[role=columnheader][aria-sort=descending]:after{background-color:var(--md-default-fg-color--light);-webkit-mask-image:var(--md-typeset-table-sort-icon--desc);mask-image:var(--md-typeset-table-sort-icon--desc)}.md-typeset__scrollwrap{margin:1em -.8rem;overflow-x:auto;touch-action:auto}.md-typeset__table{display:inline-block;margin-bottom:.5em;padding:0 .8rem}@media print{.md-typeset__table{display:block}}html .md-typeset__table table{display:table;margin:0;overflow:hidden;width:100%}@media screen and (max-width:44.9375em){.md-content__inner>pre{margin:1em -.8rem}.md-content__inner>pre code{border-radius:0}}.md-typeset .md-author{display:block;flex-shrink:0;height:1.6rem;overflow:hidden;position:relative;transition:color 125ms,transform 125ms;width:1.6rem}.md-typeset .md-author img{border-radius:100%;display:block}.md-typeset .md-author--more{background:var(--md-default-fg-color--lightest);color:var(--md-default-fg-color--lighter);font-size:.6rem;font-weight:700;line-height:1.6rem;text-align:center}.md-typeset .md-author--long{height:2.4rem;width:2.4rem}.md-typeset a.md-author{transform:scale(1)}.md-typeset a.md-author img{filter:grayscale(100%) opacity(75%);transition:filter 125ms}.md-typeset a.md-author:focus,.md-typeset a.md-author:hover{transform:scale(1.1);z-index:1}.md-typeset a.md-author:focus img,.md-typeset a.md-author:hover img{filter:grayscale(0)}.md-banner{background-color:var(--md-footer-bg-color);color:var(--md-footer-fg-color);overflow:auto}@media print{.md-banner{display:none}}.md-banner--warning{background-color:var(--md-warning-bg-color);color:var(--md-warning-fg-color)}.md-banner__inner{font-size:.7rem;margin:.6rem auto;padding:0 .8rem}[dir=ltr] .md-banner__button{float:right}[dir=rtl] .md-banner__button{float:left}.md-banner__button{color:inherit;cursor:pointer;transition:opacity .25s}.no-js .md-banner__button{display:none}.md-banner__button:hover{opacity:.7}html{font-size:125%;height:100%;overflow-x:hidden}@media screen and (min-width:100em){html{font-size:137.5%}}@media screen and (min-width:125em){html{font-size:150%}}body{background-color:var(--md-default-bg-color);display:flex;flex-direction:column;font-size:.5rem;min-height:100%;position:relative;width:100%}@media print{body{display:block}}@media screen and (max-width:59.9375em){body[data-md-scrolllock]{position:fixed}}.md-grid{margin-left:auto;margin-right:auto;max-width:61rem}.md-container{display:flex;flex-direction:column;flex-grow:1}@media print{.md-container{display:block}}.md-main{flex-grow:1}.md-main__inner{display:flex;height:100%;margin-top:1.5rem}.md-ellipsis{overflow:hidden;text-overflow:ellipsis}.md-toggle{display:none}.md-option{height:0;opacity:0;position:absolute;width:0}.md-option:checked+label:not([hidden]){display:block}.md-option.focus-visible+label{outline-color:var(--md-accent-fg-color);outline-style:auto}.md-skip{background-color:var(--md-default-fg-color);border-radius:.1rem;color:var(--md-default-bg-color);font-size:.64rem;margin:.5rem;opacity:0;outline-color:var(--md-accent-fg-color);padding:.3rem .5rem;position:fixed;transform:translateY(.4rem);z-index:-1}.md-skip:focus{opacity:1;transform:translateY(0);transition:transform .25s cubic-bezier(.4,0,.2,1),opacity 175ms 75ms;z-index:10}@page{margin:25mm}:root{--md-clipboard-icon:url('data:image/svg+xml;charset=utf-8,')}.md-clipboard{border-radius:.1rem;color:var(--md-default-fg-color--lightest);cursor:pointer;height:1.5em;outline-color:var(--md-accent-fg-color);outline-offset:.1rem;transition:color .25s;width:1.5em;z-index:1}@media print{.md-clipboard{display:none}}.md-clipboard:not(.focus-visible){-webkit-tap-highlight-color:transparent;outline:none}:hover>.md-clipboard{color:var(--md-default-fg-color--light)}.md-clipboard:focus,.md-clipboard:hover{color:var(--md-accent-fg-color)}.md-clipboard:after{background-color:currentcolor;content:"";display:block;height:1.125em;margin:0 auto;-webkit-mask-image:var(--md-clipboard-icon);mask-image:var(--md-clipboard-icon);-webkit-mask-position:center;mask-position:center;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;-webkit-mask-size:contain;mask-size:contain;width:1.125em}.md-clipboard--inline{cursor:pointer}.md-clipboard--inline code{transition:color .25s,background-color .25s}.md-clipboard--inline:focus code,.md-clipboard--inline:hover code{background-color:var(--md-accent-fg-color--transparent);color:var(--md-accent-fg-color)}:root{--md-code-select-icon:url('data:image/svg+xml;charset=utf-8,');--md-code-copy-icon:url('data:image/svg+xml;charset=utf-8,')}.md-typeset .md-code__content{display:grid}.md-code__nav{background-color:var(--md-code-bg-color--lighter);border-radius:.1rem;display:flex;gap:.2rem;padding:.2rem;position:absolute;right:.25em;top:.25em;transition:background-color .25s;z-index:1}:hover>.md-code__nav{background-color:var(--md-code-bg-color--light)}.md-code__button{color:var(--md-default-fg-color--lightest);cursor:pointer;display:block;height:1.5em;outline-color:var(--md-accent-fg-color);outline-offset:.1rem;transition:color .25s;width:1.5em}:hover>*>.md-code__button{color:var(--md-default-fg-color--light)}.md-code__button.focus-visible,.md-code__button:hover{color:var(--md-accent-fg-color)}.md-code__button--active{color:var(--md-default-fg-color)!important}.md-code__button:after{background-color:currentcolor;content:"";display:block;height:1.125em;margin:0 auto;-webkit-mask-position:center;mask-position:center;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;-webkit-mask-size:contain;mask-size:contain;width:1.125em}.md-code__button[data-md-type=select]:after{-webkit-mask-image:var(--md-code-select-icon);mask-image:var(--md-code-select-icon)}.md-code__button[data-md-type=copy]:after{-webkit-mask-image:var(--md-code-copy-icon);mask-image:var(--md-code-copy-icon)}@keyframes consent{0%{opacity:0;transform:translateY(100%)}to{opacity:1;transform:translateY(0)}}@keyframes overlay{0%{opacity:0}to{opacity:1}}.md-consent__overlay{animation:overlay .25s both;-webkit-backdrop-filter:blur(.1rem);backdrop-filter:blur(.1rem);background-color:#0000008a;height:100%;opacity:1;position:fixed;top:0;width:100%;z-index:5}.md-consent__inner{animation:consent .5s cubic-bezier(.1,.7,.1,1) both;background-color:var(--md-default-bg-color);border:0;border-radius:.1rem;bottom:0;box-shadow:0 0 .2rem #0000001a,0 .2rem .4rem #0003;max-height:100%;overflow:auto;padding:0;position:fixed;width:100%;z-index:5}.md-consent__form{padding:.8rem}.md-consent__settings{display:none;margin:1em 0}input:checked+.md-consent__settings{display:block}.md-consent__controls{margin-bottom:.8rem}.md-typeset .md-consent__controls .md-button{display:inline}@media screen and (max-width:44.9375em){.md-typeset .md-consent__controls .md-button{display:block;margin-top:.4rem;text-align:center;width:100%}}.md-consent label{cursor:pointer}.md-content{flex-grow:1;min-width:0}.md-content__inner{margin:0 .8rem 1.2rem;padding-top:.6rem}@media screen and (min-width:76.25em){[dir=ltr] .md-sidebar--primary:not([hidden])~.md-content>.md-content__inner{margin-left:1.2rem}[dir=ltr] .md-sidebar--secondary:not([hidden])~.md-content>.md-content__inner,[dir=rtl] .md-sidebar--primary:not([hidden])~.md-content>.md-content__inner{margin-right:1.2rem}[dir=rtl] .md-sidebar--secondary:not([hidden])~.md-content>.md-content__inner{margin-left:1.2rem}}.md-content__inner:before{content:"";display:block;height:.4rem}.md-content__inner>:last-child{margin-bottom:0}[dir=ltr] .md-content__button{float:right}[dir=rtl] .md-content__button{float:left}[dir=ltr] .md-content__button{margin-left:.4rem}[dir=rtl] .md-content__button{margin-right:.4rem}.md-content__button{margin:.4rem 0;padding:0}@media print{.md-content__button{display:none}}.md-typeset .md-content__button{color:var(--md-default-fg-color--lighter)}.md-content__button svg{display:inline;vertical-align:top}[dir=rtl] .md-content__button svg{transform:scaleX(-1)}[dir=ltr] .md-dialog{right:.8rem}[dir=rtl] .md-dialog{left:.8rem}.md-dialog{background-color:var(--md-default-fg-color);border-radius:.1rem;bottom:.8rem;box-shadow:var(--md-shadow-z3);min-width:11.1rem;opacity:0;padding:.4rem .6rem;pointer-events:none;position:fixed;transform:translateY(100%);transition:transform 0ms .4s,opacity .4s;z-index:4}@media print{.md-dialog{display:none}}.md-dialog--active{opacity:1;pointer-events:auto;transform:translateY(0);transition:transform .4s cubic-bezier(.075,.85,.175,1),opacity .4s}.md-dialog__inner{color:var(--md-default-bg-color);font-size:.7rem}.md-feedback{margin:2em 0 1em;text-align:center}.md-feedback fieldset{border:none;margin:0;padding:0}.md-feedback__title{font-weight:700;margin:1em auto}.md-feedback__inner{position:relative}.md-feedback__list{align-content:baseline;display:flex;flex-wrap:wrap;justify-content:center;position:relative}.md-feedback__list:hover .md-icon:not(:disabled){color:var(--md-default-fg-color--lighter)}:disabled .md-feedback__list{min-height:1.8rem}.md-feedback__icon{color:var(--md-default-fg-color--light);cursor:pointer;flex-shrink:0;margin:0 .1rem;transition:color 125ms}.md-feedback__icon:not(:disabled).md-icon:hover{color:var(--md-accent-fg-color)}.md-feedback__icon:disabled{color:var(--md-default-fg-color--lightest);pointer-events:none}.md-feedback__note{opacity:0;position:relative;transform:translateY(.4rem);transition:transform .4s cubic-bezier(.1,.7,.1,1),opacity .15s}.md-feedback__note>*{margin:0 auto;max-width:16rem}:disabled .md-feedback__note{opacity:1;transform:translateY(0)}.md-footer{background-color:var(--md-footer-bg-color);color:var(--md-footer-fg-color)}@media print{.md-footer{display:none}}.md-footer__inner{justify-content:space-between;overflow:auto;padding:.2rem}.md-footer__inner:not([hidden]){display:flex}.md-footer__link{align-items:end;display:flex;flex-grow:0.01;margin-bottom:.4rem;margin-top:1rem;max-width:100%;outline-color:var(--md-accent-fg-color);overflow:hidden;transition:opacity .25s}.md-footer__link:focus,.md-footer__link:hover{opacity:.7}[dir=rtl] .md-footer__link svg{transform:scaleX(-1)}@media screen and (max-width:44.9375em){.md-footer__link--prev{flex-shrink:0}.md-footer__link--prev .md-footer__title{display:none}}[dir=ltr] .md-footer__link--next{margin-left:auto}[dir=rtl] .md-footer__link--next{margin-right:auto}.md-footer__link--next{text-align:right}[dir=rtl] .md-footer__link--next{text-align:left}.md-footer__title{flex-grow:1;font-size:.9rem;margin-bottom:.7rem;max-width:calc(100% - 2.4rem);padding:0 1rem;white-space:nowrap}.md-footer__button{margin:.2rem;padding:.4rem}.md-footer__direction{font-size:.64rem;opacity:.7}.md-footer-meta{background-color:var(--md-footer-bg-color--dark)}.md-footer-meta__inner{display:flex;flex-wrap:wrap;justify-content:space-between;padding:.2rem}html .md-footer-meta.md-typeset a{color:var(--md-footer-fg-color--light)}html .md-footer-meta.md-typeset a:focus,html .md-footer-meta.md-typeset a:hover{color:var(--md-footer-fg-color)}.md-copyright{color:var(--md-footer-fg-color--lighter);font-size:.64rem;margin:auto .6rem;padding:.4rem 0;width:100%}@media screen and (min-width:45em){.md-copyright{width:auto}}.md-copyright__highlight{color:var(--md-footer-fg-color--light)}.md-social{display:inline-flex;gap:.2rem;margin:0 .4rem;padding:.2rem 0 .6rem}@media screen and (min-width:45em){.md-social{padding:.6rem 0}}.md-social__link{display:inline-block;height:1.6rem;text-align:center;width:1.6rem}.md-social__link:before{line-height:1.9}.md-social__link svg{fill:currentcolor;max-height:.8rem;vertical-align:-25%}.md-typeset .md-button{border:.1rem solid;border-radius:.1rem;color:var(--md-primary-fg-color);cursor:pointer;display:inline-block;font-weight:700;padding:.625em 2em;transition:color 125ms,background-color 125ms,border-color 125ms}.md-typeset .md-button--primary{background-color:var(--md-primary-fg-color);border-color:var(--md-primary-fg-color);color:var(--md-primary-bg-color)}.md-typeset .md-button:focus,.md-typeset .md-button:hover{background-color:var(--md-accent-fg-color);border-color:var(--md-accent-fg-color);color:var(--md-accent-bg-color)}[dir=ltr] .md-typeset .md-input{border-top-left-radius:.1rem}[dir=ltr] .md-typeset .md-input,[dir=rtl] .md-typeset .md-input{border-top-right-radius:.1rem}[dir=rtl] .md-typeset .md-input{border-top-left-radius:.1rem}.md-typeset .md-input{border-bottom:.1rem solid var(--md-default-fg-color--lighter);box-shadow:var(--md-shadow-z1);font-size:.8rem;height:1.8rem;padding:0 .6rem;transition:border .25s,box-shadow .25s}.md-typeset .md-input:focus,.md-typeset .md-input:hover{border-bottom-color:var(--md-accent-fg-color);box-shadow:var(--md-shadow-z2)}.md-typeset .md-input--stretch{width:100%}.md-header{background-color:var(--md-primary-fg-color);box-shadow:0 0 .2rem #0000,0 .2rem .4rem #0000;color:var(--md-primary-bg-color);display:block;left:0;position:sticky;right:0;top:0;z-index:4}@media print{.md-header{display:none}}.md-header[hidden]{transform:translateY(-100%);transition:transform .25s cubic-bezier(.8,0,.6,1),box-shadow .25s}.md-header--shadow{box-shadow:0 0 .2rem #0000001a,0 .2rem .4rem #0003;transition:transform .25s cubic-bezier(.1,.7,.1,1),box-shadow .25s}.md-header__inner{align-items:center;display:flex;padding:0 .2rem}.md-header__button{color:currentcolor;cursor:pointer;margin:.2rem;outline-color:var(--md-accent-fg-color);padding:.4rem;position:relative;transition:opacity .25s;vertical-align:middle;z-index:1}.md-header__button:hover{opacity:.7}.md-header__button:not([hidden]){display:inline-block}.md-header__button:not(.focus-visible){-webkit-tap-highlight-color:transparent;outline:none}.md-header__button.md-logo{margin:.2rem;padding:.4rem}@media screen and (max-width:76.1875em){.md-header__button.md-logo{display:none}}.md-header__button.md-logo img,.md-header__button.md-logo svg{fill:currentcolor;display:block;height:1.2rem;width:auto}@media screen and (min-width:60em){.md-header__button[for=__search]{display:none}}.no-js .md-header__button[for=__search]{display:none}[dir=rtl] .md-header__button[for=__search] svg{transform:scaleX(-1)}@media screen and (min-width:76.25em){.md-header__button[for=__drawer]{display:none}}.md-header__topic{display:flex;max-width:100%;position:absolute;transition:transform .4s cubic-bezier(.1,.7,.1,1),opacity .15s;white-space:nowrap}.md-header__topic+.md-header__topic{opacity:0;pointer-events:none;transform:translateX(1.25rem);transition:transform .4s cubic-bezier(1,.7,.1,.1),opacity .15s;z-index:-1}[dir=rtl] .md-header__topic+.md-header__topic{transform:translateX(-1.25rem)}.md-header__topic:first-child{font-weight:700}[dir=ltr] .md-header__title{margin-left:1rem}[dir=rtl] .md-header__title{margin-right:1rem}[dir=ltr] .md-header__title{margin-right:.4rem}[dir=rtl] .md-header__title{margin-left:.4rem}.md-header__title{flex-grow:1;font-size:.9rem;height:2.4rem;line-height:2.4rem}.md-header__title--active .md-header__topic{opacity:0;pointer-events:none;transform:translateX(-1.25rem);transition:transform .4s cubic-bezier(1,.7,.1,.1),opacity .15s;z-index:-1}[dir=rtl] .md-header__title--active .md-header__topic{transform:translateX(1.25rem)}.md-header__title--active .md-header__topic+.md-header__topic{opacity:1;pointer-events:auto;transform:translateX(0);transition:transform .4s cubic-bezier(.1,.7,.1,1),opacity .15s;z-index:0}.md-header__title>.md-header__ellipsis{height:100%;position:relative;width:100%}.md-header__option{display:flex;flex-shrink:0;max-width:100%;transition:max-width 0ms .25s,opacity .25s .25s;white-space:nowrap}[data-md-toggle=search]:checked~.md-header .md-header__option{max-width:0;opacity:0;transition:max-width 0ms,opacity 0ms}.md-header__option>input{bottom:0}.md-header__source{display:none}@media screen and (min-width:60em){[dir=ltr] .md-header__source{margin-left:1rem}[dir=rtl] .md-header__source{margin-right:1rem}.md-header__source{display:block;max-width:11.7rem;width:11.7rem}}@media screen and (min-width:76.25em){[dir=ltr] .md-header__source{margin-left:1.4rem}[dir=rtl] .md-header__source{margin-right:1.4rem}}.md-meta{color:var(--md-default-fg-color--light);font-size:.7rem;line-height:1.3}.md-meta__list{display:inline-flex;flex-wrap:wrap;list-style:none;margin:0;padding:0}.md-meta__item:not(:last-child):after{content:"·";margin-left:.2rem;margin-right:.2rem}.md-meta__link{color:var(--md-typeset-a-color)}.md-meta__link:focus,.md-meta__link:hover{color:var(--md-accent-fg-color)}.md-draft{background-color:#ff1744;border-radius:.125em;color:#fff;display:inline-block;font-weight:700;padding-left:.5714285714em;padding-right:.5714285714em}:root{--md-nav-icon--prev:url('data:image/svg+xml;charset=utf-8,');--md-nav-icon--next:url('data:image/svg+xml;charset=utf-8,');--md-toc-icon:url('data:image/svg+xml;charset=utf-8,')}.md-nav{font-size:.7rem;line-height:1.3}.md-nav__title{color:var(--md-default-fg-color--light);display:block;font-weight:700;overflow:hidden;padding:0 .6rem;text-overflow:ellipsis}.md-nav__title .md-nav__button{display:none}.md-nav__title .md-nav__button img{height:100%;width:auto}.md-nav__title .md-nav__button.md-logo img,.md-nav__title .md-nav__button.md-logo svg{fill:currentcolor;display:block;height:2.4rem;max-width:100%;object-fit:contain;width:auto}.md-nav__list{list-style:none;margin:0;padding:0}.md-nav__item{padding:0 .6rem}[dir=ltr] .md-nav__item .md-nav__item{padding-right:0}[dir=rtl] .md-nav__item .md-nav__item{padding-left:0}.md-nav__link{align-items:flex-start;display:flex;margin-top:.625em;scroll-snap-align:start;transition:color 125ms}.md-nav__link--passed,.md-nav__link--passed code{color:var(--md-default-fg-color--light)}.md-nav__item .md-nav__link--active,.md-nav__item .md-nav__link--active code{color:var(--md-typeset-a-color)}.md-nav__link .md-ellipsis{position:relative}.md-nav__link .md-ellipsis code{word-break:normal}.md-nav__link .md-icon:last-child{margin-left:auto}.md-nav__link .md-typeset{font-size:.7rem;line-height:1.3}.md-nav__link svg{fill:currentcolor;flex-shrink:0;height:1.3em}[dir=ltr] .md-nav__link svg+*{margin-left:.4rem}[dir=rtl] .md-nav__link svg+*{margin-right:.4rem}.md-nav__link:not(.md-nav__container):focus,.md-nav__link:not(.md-nav__container):hover{color:var(--md-accent-fg-color);cursor:pointer}.md-nav__link:not(.md-nav__container):focus code,.md-nav__link:not(.md-nav__container):hover code{background-color:var(--md-accent-fg-color--transparent);color:var(--md-accent-fg-color)}.md-nav__link.focus-visible{outline-color:var(--md-accent-fg-color);outline-offset:.2rem}.md-nav--primary .md-nav__link[for=__toc]{display:none}.md-nav--primary .md-nav__link[for=__toc] .md-icon:after{background-color:currentcolor;display:block;height:100%;-webkit-mask-image:var(--md-toc-icon);mask-image:var(--md-toc-icon);width:100%}.md-nav--primary .md-nav__link[for=__toc]~.md-nav{display:none}.md-nav__container>.md-nav__link{margin-top:0}.md-nav__container>.md-nav__link:first-child{flex-grow:1}.md-nav__icon{flex-shrink:0}.md-nav__source{display:none}@media screen and (max-width:76.1875em){.md-nav--primary,.md-nav--primary .md-nav{background-color:var(--md-default-bg-color);display:flex;flex-direction:column;height:100%;left:0;position:absolute;right:0;top:0;z-index:1}.md-nav--primary .md-nav__item,.md-nav--primary .md-nav__title{font-size:.8rem;line-height:1.5}.md-nav--primary .md-nav__title{background-color:var(--md-default-fg-color--lightest);color:var(--md-default-fg-color--light);cursor:pointer;height:5.6rem;line-height:2.4rem;padding:3rem .8rem .2rem;position:relative;white-space:nowrap}[dir=ltr] .md-nav--primary .md-nav__title .md-nav__icon{left:.4rem}[dir=rtl] .md-nav--primary .md-nav__title .md-nav__icon{right:.4rem}.md-nav--primary .md-nav__title .md-nav__icon{display:block;height:1.2rem;margin:.2rem;position:absolute;top:.4rem;width:1.2rem}.md-nav--primary .md-nav__title .md-nav__icon:after{background-color:currentcolor;content:"";display:block;height:100%;-webkit-mask-image:var(--md-nav-icon--prev);mask-image:var(--md-nav-icon--prev);-webkit-mask-position:center;mask-position:center;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;-webkit-mask-size:contain;mask-size:contain;width:100%}.md-nav--primary .md-nav__title~.md-nav__list{background-color:var(--md-default-bg-color);box-shadow:0 .05rem 0 var(--md-default-fg-color--lightest) inset;overflow-y:auto;scroll-snap-type:y mandatory;touch-action:pan-y}.md-nav--primary .md-nav__title~.md-nav__list>:first-child{border-top:0}.md-nav--primary .md-nav__title[for=__drawer]{background-color:var(--md-primary-fg-color);color:var(--md-primary-bg-color);font-weight:700}.md-nav--primary .md-nav__title .md-logo{display:block;left:.2rem;margin:.2rem;padding:.4rem;position:absolute;right:.2rem;top:.2rem}.md-nav--primary .md-nav__list{flex:1}.md-nav--primary .md-nav__item{border-top:.05rem solid var(--md-default-fg-color--lightest);padding:0}.md-nav--primary .md-nav__item--active>.md-nav__link{color:var(--md-typeset-a-color)}.md-nav--primary .md-nav__item--active>.md-nav__link:focus,.md-nav--primary .md-nav__item--active>.md-nav__link:hover{color:var(--md-accent-fg-color)}.md-nav--primary .md-nav__link{margin-top:0;padding:.6rem .8rem}.md-nav--primary .md-nav__link svg{margin-top:.1em}.md-nav--primary .md-nav__link>.md-nav__link{padding:0}[dir=ltr] .md-nav--primary .md-nav__link .md-nav__icon{margin-right:-.2rem}[dir=rtl] .md-nav--primary .md-nav__link .md-nav__icon{margin-left:-.2rem}.md-nav--primary .md-nav__link .md-nav__icon{font-size:1.2rem;height:1.2rem;width:1.2rem}.md-nav--primary .md-nav__link .md-nav__icon:after{background-color:currentcolor;content:"";display:block;height:100%;-webkit-mask-image:var(--md-nav-icon--next);mask-image:var(--md-nav-icon--next);-webkit-mask-position:center;mask-position:center;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;-webkit-mask-size:contain;mask-size:contain;width:100%}[dir=rtl] .md-nav--primary .md-nav__icon:after{transform:scale(-1)}.md-nav--primary .md-nav--secondary .md-nav{background-color:initial;position:static}[dir=ltr] .md-nav--primary .md-nav--secondary .md-nav .md-nav__link{padding-left:1.4rem}[dir=rtl] .md-nav--primary .md-nav--secondary .md-nav .md-nav__link{padding-right:1.4rem}[dir=ltr] .md-nav--primary .md-nav--secondary .md-nav .md-nav .md-nav__link{padding-left:2rem}[dir=rtl] .md-nav--primary .md-nav--secondary .md-nav .md-nav .md-nav__link{padding-right:2rem}[dir=ltr] .md-nav--primary .md-nav--secondary .md-nav .md-nav .md-nav .md-nav__link{padding-left:2.6rem}[dir=rtl] .md-nav--primary .md-nav--secondary .md-nav .md-nav .md-nav .md-nav__link{padding-right:2.6rem}[dir=ltr] .md-nav--primary .md-nav--secondary .md-nav .md-nav .md-nav .md-nav .md-nav__link{padding-left:3.2rem}[dir=rtl] .md-nav--primary .md-nav--secondary .md-nav .md-nav .md-nav .md-nav .md-nav__link{padding-right:3.2rem}.md-nav--secondary{background-color:initial}.md-nav__toggle~.md-nav{display:flex;opacity:0;transform:translateX(100%);transition:transform .25s cubic-bezier(.8,0,.6,1),opacity 125ms 50ms}[dir=rtl] .md-nav__toggle~.md-nav{transform:translateX(-100%)}.md-nav__toggle:checked~.md-nav{opacity:1;transform:translateX(0);transition:transform .25s cubic-bezier(.4,0,.2,1),opacity 125ms 125ms}.md-nav__toggle:checked~.md-nav>.md-nav__list{-webkit-backface-visibility:hidden;backface-visibility:hidden}}@media screen and (max-width:59.9375em){.md-nav--primary .md-nav__link[for=__toc]{display:flex}.md-nav--primary .md-nav__link[for=__toc] .md-icon:after{content:""}.md-nav--primary .md-nav__link[for=__toc]+.md-nav__link{display:none}.md-nav--primary .md-nav__link[for=__toc]~.md-nav{display:flex}.md-nav__source{background-color:var(--md-primary-fg-color--dark);color:var(--md-primary-bg-color);display:block;padding:0 .2rem}}@media screen and (min-width:60em) and (max-width:76.1875em){.md-nav--integrated .md-nav__link[for=__toc]{display:flex}.md-nav--integrated .md-nav__link[for=__toc] .md-icon:after{content:""}.md-nav--integrated .md-nav__link[for=__toc]+.md-nav__link{display:none}.md-nav--integrated .md-nav__link[for=__toc]~.md-nav{display:flex}}@media screen and (min-width:60em){.md-nav--secondary .md-nav__title{background:var(--md-default-bg-color);box-shadow:0 0 .4rem .4rem var(--md-default-bg-color);position:sticky;top:0;z-index:1}.md-nav--secondary .md-nav__title[for=__toc]{scroll-snap-align:start}.md-nav--secondary .md-nav__title .md-nav__icon{display:none}}@media screen and (min-width:76.25em){.md-nav{transition:max-height .25s cubic-bezier(.86,0,.07,1)}.md-nav--primary .md-nav__title{background:var(--md-default-bg-color);box-shadow:0 0 .4rem .4rem var(--md-default-bg-color);position:sticky;top:0;z-index:1}.md-nav--primary .md-nav__title[for=__drawer]{scroll-snap-align:start}.md-nav--primary .md-nav__title .md-nav__icon,.md-nav__toggle~.md-nav{display:none}.md-nav__toggle:checked~.md-nav,.md-nav__toggle:indeterminate~.md-nav{display:block}.md-nav__item--nested>.md-nav>.md-nav__title{display:none}.md-nav__item--section{display:block;margin:1.25em 0}.md-nav__item--section:last-child{margin-bottom:0}.md-nav__item--section>.md-nav__link{font-weight:700}.md-nav__item--section>.md-nav__link[for]{color:var(--md-default-fg-color--light)}.md-nav__item--section>.md-nav__link:not(.md-nav__container){pointer-events:none}.md-nav__item--section>.md-nav__link .md-nav__icon{display:none}.md-nav__item--section>.md-nav{display:block}.md-nav__item--section>.md-nav>.md-nav__list>.md-nav__item{padding:0}.md-nav__icon{border-radius:100%;height:.9rem;transition:background-color .25s;width:.9rem}.md-nav__icon:hover{background-color:var(--md-accent-fg-color--transparent)}.md-nav__icon:after{background-color:currentcolor;border-radius:100%;content:"";display:inline-block;height:100%;-webkit-mask-image:var(--md-nav-icon--next);mask-image:var(--md-nav-icon--next);-webkit-mask-position:center;mask-position:center;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;-webkit-mask-size:contain;mask-size:contain;transition:transform .25s;vertical-align:-.1rem;width:100%}[dir=rtl] .md-nav__icon:after{transform:rotate(180deg)}.md-nav__item--nested .md-nav__toggle:checked~.md-nav__link .md-nav__icon:after,.md-nav__item--nested .md-nav__toggle:indeterminate~.md-nav__link .md-nav__icon:after{transform:rotate(90deg)}.md-nav--lifted>.md-nav__list>.md-nav__item,.md-nav--lifted>.md-nav__list>.md-nav__item--nested,.md-nav--lifted>.md-nav__title{display:none}.md-nav--lifted>.md-nav__list>.md-nav__item--active{display:block;padding:0}.md-nav--lifted>.md-nav__list>.md-nav__item--active>.md-nav__link{background:var(--md-default-bg-color);box-shadow:0 0 .4rem .4rem var(--md-default-bg-color);font-weight:700;margin-top:0;padding:0 .6rem;position:sticky;top:0;z-index:1}.md-nav--lifted>.md-nav__list>.md-nav__item--active>.md-nav__link:not(.md-nav__container){pointer-events:none}.md-nav--lifted>.md-nav__list>.md-nav__item--active>.md-nav__link .md-nav__icon{display:none}.md-nav--lifted>.md-nav__list>.md-nav__item>[for]{color:var(--md-default-fg-color--light)}.md-nav--lifted .md-nav[data-md-level="1"]{display:block}[dir=ltr] .md-nav--lifted .md-nav[data-md-level="1"]>.md-nav__list>.md-nav__item{padding-right:.6rem}[dir=rtl] .md-nav--lifted .md-nav[data-md-level="1"]>.md-nav__list>.md-nav__item{padding-left:.6rem}.md-nav--integrated>.md-nav__list>.md-nav__item--active:not(.md-nav__item--nested){padding:0 .6rem}.md-nav--integrated>.md-nav__list>.md-nav__item--active:not(.md-nav__item--nested)>.md-nav__link{padding:0}[dir=ltr] .md-nav--integrated>.md-nav__list>.md-nav__item--active .md-nav--secondary{border-left:.05rem solid var(--md-primary-fg-color)}[dir=rtl] .md-nav--integrated>.md-nav__list>.md-nav__item--active .md-nav--secondary{border-right:.05rem solid var(--md-primary-fg-color)}.md-nav--integrated>.md-nav__list>.md-nav__item--active .md-nav--secondary{display:block;margin-bottom:1.25em}.md-nav--integrated>.md-nav__list>.md-nav__item--active .md-nav--secondary>.md-nav__title{display:none}}.md-pagination{font-size:.8rem;font-weight:700;gap:.4rem}.md-pagination,.md-pagination>*{align-items:center;display:flex;justify-content:center}.md-pagination>*{border-radius:.2rem;height:1.8rem;min-width:1.8rem;text-align:center}.md-pagination__current{background-color:var(--md-default-fg-color--lightest);color:var(--md-default-fg-color--light)}.md-pagination__link{transition:color 125ms,background-color 125ms}.md-pagination__link:focus,.md-pagination__link:hover{background-color:var(--md-accent-fg-color--transparent);color:var(--md-accent-fg-color)}.md-pagination__link:focus svg,.md-pagination__link:hover svg{color:var(--md-accent-fg-color)}.md-pagination__link.focus-visible{outline-color:var(--md-accent-fg-color);outline-offset:.2rem}.md-pagination__link svg{fill:currentcolor;color:var(--md-default-fg-color--lighter);display:block;max-height:100%;width:1.2rem}:root{--md-path-icon:url('data:image/svg+xml;charset=utf-8,')}.md-path{display:block;font-size:.7rem;margin:0 .8rem;overflow:auto;padding-top:1.2rem}@media screen and (min-width:76.25em){.md-path{margin:0 1.2rem}}.md-path__list{align-items:center;display:flex;gap:.2rem;list-style:none;margin:0;padding:0}.md-path__item:not(:first-child){display:inline-flex;gap:.2rem;white-space:nowrap}.md-path__item:not(:first-child):before{background-color:var(--md-default-fg-color--lighter);content:"";display:inline;height:.8rem;-webkit-mask-image:var(--md-path-icon);mask-image:var(--md-path-icon);width:.8rem}.md-path__link{align-items:center;color:var(--md-default-fg-color--light);display:flex}.md-path__link:focus,.md-path__link:hover{color:var(--md-accent-fg-color)}.md-post__back{border-bottom:.05rem solid var(--md-default-fg-color--lightest);margin-bottom:1.2rem;padding-bottom:1.2rem}@media screen and (max-width:76.1875em){.md-post__back{display:none}}[dir=rtl] .md-post__back svg{transform:scaleX(-1)}.md-post__authors{display:flex;flex-direction:column;gap:.6rem;margin:0 .6rem}.md-post .md-post__meta a{transition:color 125ms}.md-post .md-post__meta a:focus,.md-post .md-post__meta a:hover{color:var(--md-accent-fg-color)}.md-post--excerpt{margin-bottom:3.2rem}.md-post--excerpt .md-post__header{align-items:center;display:flex;gap:.6rem;min-height:1.6rem}.md-post--excerpt .md-post__authors{align-items:center;display:inline-flex;flex-direction:row;gap:.2rem;margin:0;min-height:2.4rem}[dir=ltr] .md-post--excerpt .md-post__meta .md-meta__list{margin-right:.4rem}[dir=rtl] .md-post--excerpt .md-post__meta .md-meta__list{margin-left:.4rem}.md-post--excerpt .md-post__content>:first-child{--md-scroll-margin:6rem;margin-top:0}.md-post>.md-nav--secondary,.md-post>.md-nav:first-child>.md-nav__list{margin:1em 0}.md-profile{align-items:center;display:flex;font-size:.7rem;gap:.6rem;line-height:1.4;width:100%}.md-profile__description{flex-grow:1}.md-content--post{display:flex}@media screen and (max-width:76.1875em){.md-content--post{flex-flow:column-reverse}}.md-content--post>.md-content__inner{min-width:0}@media screen and (min-width:76.25em){[dir=ltr] .md-content--post>.md-content__inner{margin-left:1.2rem}[dir=rtl] .md-content--post>.md-content__inner{margin-right:1.2rem}}@media screen and (max-width:76.1875em){.md-sidebar.md-sidebar--post{padding:0}}:root{--md-search-result-icon:url('data:image/svg+xml;charset=utf-8,')}.md-search{position:relative}@media screen and (min-width:60em){.md-search{padding:.2rem 0}}.no-js .md-search{display:none}.md-search__overlay{opacity:0;z-index:1}@media screen and (max-width:59.9375em){[dir=ltr] .md-search__overlay{left:-2.2rem}[dir=rtl] .md-search__overlay{right:-2.2rem}.md-search__overlay{background-color:var(--md-default-bg-color);border-radius:1rem;height:2rem;overflow:hidden;pointer-events:none;position:absolute;top:-1rem;transform-origin:center;transition:transform .3s .1s,opacity .2s .2s;width:2rem}[data-md-toggle=search]:checked~.md-header .md-search__overlay{opacity:1;transition:transform .4s,opacity .1s}}@media screen and (min-width:60em){[dir=ltr] .md-search__overlay{left:0}[dir=rtl] .md-search__overlay{right:0}.md-search__overlay{background-color:#0000008a;cursor:pointer;height:0;position:fixed;top:0;transition:width 0ms .25s,height 0ms .25s,opacity .25s;width:0}[data-md-toggle=search]:checked~.md-header .md-search__overlay{height:200vh;opacity:1;transition:width 0ms,height 0ms,opacity .25s;width:100%}}@media screen and (max-width:29.9375em){[data-md-toggle=search]:checked~.md-header .md-search__overlay{transform:scale(45)}}@media screen and (min-width:30em) and (max-width:44.9375em){[data-md-toggle=search]:checked~.md-header .md-search__overlay{transform:scale(60)}}@media screen and (min-width:45em) and (max-width:59.9375em){[data-md-toggle=search]:checked~.md-header .md-search__overlay{transform:scale(75)}}.md-search__inner{-webkit-backface-visibility:hidden;backface-visibility:hidden}@media screen and (max-width:59.9375em){[dir=ltr] .md-search__inner{left:0}[dir=rtl] .md-search__inner{right:0}.md-search__inner{height:0;opacity:0;overflow:hidden;position:fixed;top:0;transform:translateX(5%);transition:width 0ms .3s,height 0ms .3s,transform .15s cubic-bezier(.4,0,.2,1) .15s,opacity .15s .15s;width:0;z-index:2}[dir=rtl] .md-search__inner{transform:translateX(-5%)}[data-md-toggle=search]:checked~.md-header .md-search__inner{height:100%;opacity:1;transform:translateX(0);transition:width 0ms 0ms,height 0ms 0ms,transform .15s cubic-bezier(.1,.7,.1,1) .15s,opacity .15s .15s;width:100%}}@media screen and (min-width:60em){[dir=ltr] .md-search__inner{float:right}[dir=rtl] .md-search__inner{float:left}.md-search__inner{padding:.1rem 0;position:relative;transition:width .25s cubic-bezier(.1,.7,.1,1);width:11.7rem}}@media screen and (min-width:60em) and (max-width:76.1875em){[data-md-toggle=search]:checked~.md-header .md-search__inner{width:23.4rem}}@media screen and (min-width:76.25em){[data-md-toggle=search]:checked~.md-header .md-search__inner{width:34.4rem}}.md-search__form{background-color:var(--md-default-bg-color);box-shadow:0 0 .6rem #0000;height:2.4rem;position:relative;transition:color .25s,background-color .25s;z-index:2}@media screen and (min-width:60em){.md-search__form{background-color:#00000042;border-radius:.1rem;height:1.8rem}.md-search__form:hover{background-color:#ffffff1f}}[data-md-toggle=search]:checked~.md-header .md-search__form{background-color:var(--md-default-bg-color);border-radius:.1rem .1rem 0 0;box-shadow:0 0 .6rem #00000012;color:var(--md-default-fg-color)}[dir=ltr] .md-search__input{padding-left:3.6rem;padding-right:2.2rem}[dir=rtl] .md-search__input{padding-left:2.2rem;padding-right:3.6rem}.md-search__input{background:#0000;font-size:.9rem;height:100%;position:relative;text-overflow:ellipsis;width:100%;z-index:2}.md-search__input::placeholder{transition:color .25s}.md-search__input::placeholder,.md-search__input~.md-search__icon{color:var(--md-default-fg-color--light)}.md-search__input::-ms-clear{display:none}@media screen and (max-width:59.9375em){.md-search__input{font-size:.9rem;height:2.4rem;width:100%}}@media screen and (min-width:60em){[dir=ltr] .md-search__input{padding-left:2.2rem}[dir=rtl] .md-search__input{padding-right:2.2rem}.md-search__input{color:inherit;font-size:.8rem}.md-search__input::placeholder{color:var(--md-primary-bg-color--light)}.md-search__input+.md-search__icon{color:var(--md-primary-bg-color)}[data-md-toggle=search]:checked~.md-header .md-search__input{text-overflow:clip}[data-md-toggle=search]:checked~.md-header .md-search__input+.md-search__icon{color:var(--md-default-fg-color--light)}[data-md-toggle=search]:checked~.md-header .md-search__input::placeholder{color:#0000}}.md-search__icon{cursor:pointer;display:inline-block;height:1.2rem;transition:color .25s,opacity .25s;width:1.2rem}.md-search__icon:hover{opacity:.7}[dir=ltr] .md-search__icon[for=__search]{left:.5rem}[dir=rtl] .md-search__icon[for=__search]{right:.5rem}.md-search__icon[for=__search]{position:absolute;top:.3rem;z-index:2}[dir=rtl] .md-search__icon[for=__search] svg{transform:scaleX(-1)}@media screen and (max-width:59.9375em){[dir=ltr] .md-search__icon[for=__search]{left:.8rem}[dir=rtl] .md-search__icon[for=__search]{right:.8rem}.md-search__icon[for=__search]{top:.6rem}.md-search__icon[for=__search] svg:first-child{display:none}}@media screen and (min-width:60em){.md-search__icon[for=__search]{pointer-events:none}.md-search__icon[for=__search] svg:last-child{display:none}}[dir=ltr] .md-search__options{right:.5rem}[dir=rtl] .md-search__options{left:.5rem}.md-search__options{pointer-events:none;position:absolute;top:.3rem;z-index:2}@media screen and (max-width:59.9375em){[dir=ltr] .md-search__options{right:.8rem}[dir=rtl] .md-search__options{left:.8rem}.md-search__options{top:.6rem}}[dir=ltr] .md-search__options>.md-icon{margin-left:.2rem}[dir=rtl] .md-search__options>.md-icon{margin-right:.2rem}.md-search__options>.md-icon{color:var(--md-default-fg-color--light);opacity:0;transform:scale(.75);transition:transform .15s cubic-bezier(.1,.7,.1,1),opacity .15s}.md-search__options>.md-icon:not(.focus-visible){-webkit-tap-highlight-color:transparent;outline:none}[data-md-toggle=search]:checked~.md-header .md-search__input:valid~.md-search__options>.md-icon{opacity:1;pointer-events:auto;transform:scale(1)}[data-md-toggle=search]:checked~.md-header .md-search__input:valid~.md-search__options>.md-icon:hover{opacity:.7}[dir=ltr] .md-search__suggest{padding-left:3.6rem;padding-right:2.2rem}[dir=rtl] .md-search__suggest{padding-left:2.2rem;padding-right:3.6rem}.md-search__suggest{align-items:center;color:var(--md-default-fg-color--lighter);display:flex;font-size:.9rem;height:100%;opacity:0;position:absolute;top:0;transition:opacity 50ms;white-space:nowrap;width:100%}@media screen and (min-width:60em){[dir=ltr] .md-search__suggest{padding-left:2.2rem}[dir=rtl] .md-search__suggest{padding-right:2.2rem}.md-search__suggest{font-size:.8rem}}[data-md-toggle=search]:checked~.md-header .md-search__suggest{opacity:1;transition:opacity .3s .1s}[dir=ltr] .md-search__output{border-bottom-left-radius:.1rem}[dir=ltr] .md-search__output,[dir=rtl] .md-search__output{border-bottom-right-radius:.1rem}[dir=rtl] .md-search__output{border-bottom-left-radius:.1rem}.md-search__output{overflow:hidden;position:absolute;width:100%;z-index:1}@media screen and (max-width:59.9375em){.md-search__output{bottom:0;top:2.4rem}}@media screen and (min-width:60em){.md-search__output{opacity:0;top:1.9rem;transition:opacity .4s}[data-md-toggle=search]:checked~.md-header .md-search__output{box-shadow:var(--md-shadow-z3);opacity:1}}.md-search__scrollwrap{-webkit-backface-visibility:hidden;backface-visibility:hidden;background-color:var(--md-default-bg-color);height:100%;overflow-y:auto;touch-action:pan-y}@media (-webkit-max-device-pixel-ratio:1),(max-resolution:1dppx){.md-search__scrollwrap{transform:translateZ(0)}}@media screen and (min-width:60em) and (max-width:76.1875em){.md-search__scrollwrap{width:23.4rem}}@media screen and (min-width:76.25em){.md-search__scrollwrap{width:34.4rem}}@media screen and (min-width:60em){.md-search__scrollwrap{max-height:0;scrollbar-color:var(--md-default-fg-color--lighter) #0000;scrollbar-width:thin}[data-md-toggle=search]:checked~.md-header .md-search__scrollwrap{max-height:75vh}.md-search__scrollwrap:hover{scrollbar-color:var(--md-accent-fg-color) #0000}.md-search__scrollwrap::-webkit-scrollbar{height:.2rem;width:.2rem}.md-search__scrollwrap::-webkit-scrollbar-thumb{background-color:var(--md-default-fg-color--lighter)}.md-search__scrollwrap::-webkit-scrollbar-thumb:hover{background-color:var(--md-accent-fg-color)}}.md-search-result{color:var(--md-default-fg-color);word-break:break-word}.md-search-result__meta{background-color:var(--md-default-fg-color--lightest);color:var(--md-default-fg-color--light);font-size:.64rem;line-height:1.8rem;padding:0 .8rem;scroll-snap-align:start}@media screen and (min-width:60em){[dir=ltr] .md-search-result__meta{padding-left:2.2rem}[dir=rtl] .md-search-result__meta{padding-right:2.2rem}}.md-search-result__list{list-style:none;margin:0;padding:0;-webkit-user-select:none;user-select:none}.md-search-result__item{box-shadow:0 -.05rem var(--md-default-fg-color--lightest)}.md-search-result__item:first-child{box-shadow:none}.md-search-result__link{display:block;outline:none;scroll-snap-align:start;transition:background-color .25s}.md-search-result__link:focus,.md-search-result__link:hover{background-color:var(--md-accent-fg-color--transparent)}.md-search-result__link:last-child p:last-child{margin-bottom:.6rem}.md-search-result__more>summary{cursor:pointer;display:block;outline:none;position:sticky;scroll-snap-align:start;top:0;z-index:1}.md-search-result__more>summary::marker{display:none}.md-search-result__more>summary::-webkit-details-marker{display:none}.md-search-result__more>summary>div{color:var(--md-typeset-a-color);font-size:.64rem;padding:.75em .8rem;transition:color .25s,background-color .25s}@media screen and (min-width:60em){[dir=ltr] .md-search-result__more>summary>div{padding-left:2.2rem}[dir=rtl] .md-search-result__more>summary>div{padding-right:2.2rem}}.md-search-result__more>summary:focus>div,.md-search-result__more>summary:hover>div{background-color:var(--md-accent-fg-color--transparent);color:var(--md-accent-fg-color)}.md-search-result__more[open]>summary{background-color:var(--md-default-bg-color)}.md-search-result__article{overflow:hidden;padding:0 .8rem;position:relative}@media screen and (min-width:60em){[dir=ltr] .md-search-result__article{padding-left:2.2rem}[dir=rtl] .md-search-result__article{padding-right:2.2rem}}[dir=ltr] .md-search-result__icon{left:0}[dir=rtl] .md-search-result__icon{right:0}.md-search-result__icon{color:var(--md-default-fg-color--light);height:1.2rem;margin:.5rem;position:absolute;width:1.2rem}@media screen and (max-width:59.9375em){.md-search-result__icon{display:none}}.md-search-result__icon:after{background-color:currentcolor;content:"";display:inline-block;height:100%;-webkit-mask-image:var(--md-search-result-icon);mask-image:var(--md-search-result-icon);-webkit-mask-position:center;mask-position:center;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;-webkit-mask-size:contain;mask-size:contain;width:100%}[dir=rtl] .md-search-result__icon:after{transform:scaleX(-1)}.md-search-result .md-typeset{color:var(--md-default-fg-color--light);font-size:.64rem;line-height:1.6}.md-search-result .md-typeset h1{color:var(--md-default-fg-color);font-size:.8rem;font-weight:400;line-height:1.4;margin:.55rem 0}.md-search-result .md-typeset h1 mark{text-decoration:none}.md-search-result .md-typeset h2{color:var(--md-default-fg-color);font-size:.64rem;font-weight:700;line-height:1.6;margin:.5em 0}.md-search-result .md-typeset h2 mark{text-decoration:none}.md-search-result__terms{color:var(--md-default-fg-color);display:block;font-size:.64rem;font-style:italic;margin:.5em 0}.md-search-result mark{background-color:initial;color:var(--md-accent-fg-color);text-decoration:underline}.md-select{position:relative;z-index:1}.md-select__inner{background-color:var(--md-default-bg-color);border-radius:.1rem;box-shadow:var(--md-shadow-z2);color:var(--md-default-fg-color);left:50%;margin-top:.2rem;max-height:0;opacity:0;position:absolute;top:calc(100% - .2rem);transform:translate3d(-50%,.3rem,0);transition:transform .25s 375ms,opacity .25s .25s,max-height 0ms .5s}.md-select:focus-within .md-select__inner,.md-select:hover .md-select__inner{max-height:10rem;opacity:1;transform:translate3d(-50%,0,0);transition:transform .25s cubic-bezier(.1,.7,.1,1),opacity .25s,max-height 0ms}.md-select__inner:after{border-bottom:.2rem solid #0000;border-bottom-color:var(--md-default-bg-color);border-left:.2rem solid #0000;border-right:.2rem solid #0000;border-top:0;content:"";height:0;left:50%;margin-left:-.2rem;margin-top:-.2rem;position:absolute;top:0;width:0}.md-select__list{border-radius:.1rem;font-size:.8rem;list-style-type:none;margin:0;max-height:inherit;overflow:auto;padding:0}.md-select__item{line-height:1.8rem}[dir=ltr] .md-select__link{padding-left:.6rem;padding-right:1.2rem}[dir=rtl] .md-select__link{padding-left:1.2rem;padding-right:.6rem}.md-select__link{cursor:pointer;display:block;outline:none;scroll-snap-align:start;transition:background-color .25s,color .25s;width:100%}.md-select__link:focus,.md-select__link:hover{color:var(--md-accent-fg-color)}.md-select__link:focus{background-color:var(--md-default-fg-color--lightest)}.md-sidebar{align-self:flex-start;flex-shrink:0;padding:1.2rem 0;position:sticky;top:2.4rem;width:12.1rem}@media print{.md-sidebar{display:none}}@media screen and (max-width:76.1875em){[dir=ltr] .md-sidebar--primary{left:-12.1rem}[dir=rtl] .md-sidebar--primary{right:-12.1rem}.md-sidebar--primary{background-color:var(--md-default-bg-color);display:block;height:100%;position:fixed;top:0;transform:translateX(0);transition:transform .25s cubic-bezier(.4,0,.2,1),box-shadow .25s;width:12.1rem;z-index:5}[data-md-toggle=drawer]:checked~.md-container .md-sidebar--primary{box-shadow:var(--md-shadow-z3);transform:translateX(12.1rem)}[dir=rtl] [data-md-toggle=drawer]:checked~.md-container .md-sidebar--primary{transform:translateX(-12.1rem)}.md-sidebar--primary .md-sidebar__scrollwrap{bottom:0;left:0;margin:0;overflow:hidden;position:absolute;right:0;scroll-snap-type:none;top:0}}@media screen and (min-width:76.25em){.md-sidebar{height:0}.no-js .md-sidebar{height:auto}.md-header--lifted~.md-container .md-sidebar{top:4.8rem}}.md-sidebar--secondary{display:none;order:2}@media screen and (min-width:60em){.md-sidebar--secondary{height:0}.no-js .md-sidebar--secondary{height:auto}.md-sidebar--secondary:not([hidden]){display:block}.md-sidebar--secondary .md-sidebar__scrollwrap{touch-action:pan-y}}.md-sidebar__scrollwrap{scrollbar-gutter:stable;-webkit-backface-visibility:hidden;backface-visibility:hidden;margin:0 .2rem;overflow-y:auto;scrollbar-color:var(--md-default-fg-color--lighter) #0000;scrollbar-width:thin}.md-sidebar__scrollwrap::-webkit-scrollbar{height:.2rem;width:.2rem}.md-sidebar__scrollwrap:focus-within,.md-sidebar__scrollwrap:hover{scrollbar-color:var(--md-accent-fg-color) #0000}.md-sidebar__scrollwrap:focus-within::-webkit-scrollbar-thumb,.md-sidebar__scrollwrap:hover::-webkit-scrollbar-thumb{background-color:var(--md-default-fg-color--lighter)}.md-sidebar__scrollwrap:focus-within::-webkit-scrollbar-thumb:hover,.md-sidebar__scrollwrap:hover::-webkit-scrollbar-thumb:hover{background-color:var(--md-accent-fg-color)}@supports selector(::-webkit-scrollbar){.md-sidebar__scrollwrap{scrollbar-gutter:auto}[dir=ltr] .md-sidebar__inner{padding-right:calc(100% - 11.5rem)}[dir=rtl] .md-sidebar__inner{padding-left:calc(100% - 11.5rem)}}@media screen and (max-width:76.1875em){.md-overlay{background-color:#0000008a;height:0;opacity:0;position:fixed;top:0;transition:width 0ms .25s,height 0ms .25s,opacity .25s;width:0;z-index:5}[data-md-toggle=drawer]:checked~.md-overlay{height:100%;opacity:1;transition:width 0ms,height 0ms,opacity .25s;width:100%}}@keyframes facts{0%{height:0}to{height:.65rem}}@keyframes fact{0%{opacity:0;transform:translateY(100%)}50%{opacity:0}to{opacity:1;transform:translateY(0)}}:root{--md-source-forks-icon:url('data:image/svg+xml;charset=utf-8,');--md-source-repositories-icon:url('data:image/svg+xml;charset=utf-8,');--md-source-stars-icon:url('data:image/svg+xml;charset=utf-8,');--md-source-version-icon:url('data:image/svg+xml;charset=utf-8,')}.md-source{-webkit-backface-visibility:hidden;backface-visibility:hidden;display:block;font-size:.65rem;line-height:1.2;outline-color:var(--md-accent-fg-color);transition:opacity .25s;white-space:nowrap}.md-source:hover{opacity:.7}.md-source__icon{display:inline-block;height:2.4rem;vertical-align:middle;width:2rem}[dir=ltr] .md-source__icon svg{margin-left:.6rem}[dir=rtl] .md-source__icon svg{margin-right:.6rem}.md-source__icon svg{margin-top:.6rem}[dir=ltr] .md-source__icon+.md-source__repository{padding-left:2rem}[dir=rtl] .md-source__icon+.md-source__repository{padding-right:2rem}[dir=ltr] .md-source__icon+.md-source__repository{margin-left:-2rem}[dir=rtl] .md-source__icon+.md-source__repository{margin-right:-2rem}[dir=ltr] .md-source__repository{margin-left:.6rem}[dir=rtl] .md-source__repository{margin-right:.6rem}.md-source__repository{display:inline-block;max-width:calc(100% - 1.2rem);overflow:hidden;text-overflow:ellipsis;vertical-align:middle}.md-source__facts{display:flex;font-size:.55rem;gap:.4rem;list-style-type:none;margin:.1rem 0 0;opacity:.75;overflow:hidden;padding:0;width:100%}.md-source__repository--active .md-source__facts{animation:facts .25s ease-in}.md-source__fact{overflow:hidden;text-overflow:ellipsis}.md-source__repository--active .md-source__fact{animation:fact .4s ease-out}[dir=ltr] .md-source__fact:before{margin-right:.1rem}[dir=rtl] .md-source__fact:before{margin-left:.1rem}.md-source__fact:before{background-color:currentcolor;content:"";display:inline-block;height:.6rem;-webkit-mask-position:center;mask-position:center;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;-webkit-mask-size:contain;mask-size:contain;vertical-align:text-top;width:.6rem}.md-source__fact:nth-child(1n+2){flex-shrink:0}.md-source__fact--version:before{-webkit-mask-image:var(--md-source-version-icon);mask-image:var(--md-source-version-icon)}.md-source__fact--stars:before{-webkit-mask-image:var(--md-source-stars-icon);mask-image:var(--md-source-stars-icon)}.md-source__fact--forks:before{-webkit-mask-image:var(--md-source-forks-icon);mask-image:var(--md-source-forks-icon)}.md-source__fact--repositories:before{-webkit-mask-image:var(--md-source-repositories-icon);mask-image:var(--md-source-repositories-icon)}.md-source-file{margin:1em 0}[dir=ltr] .md-source-file__fact{margin-right:.6rem}[dir=rtl] .md-source-file__fact{margin-left:.6rem}.md-source-file__fact{align-items:center;color:var(--md-default-fg-color--light);display:inline-flex;font-size:.68rem;gap:.3rem}.md-source-file__fact .md-icon{flex-shrink:0;margin-bottom:.05rem}[dir=ltr] .md-source-file__fact .md-author{float:left}[dir=rtl] .md-source-file__fact .md-author{float:right}.md-source-file__fact .md-author{margin-right:.2rem}.md-source-file__fact svg{width:.9rem}:root{--md-status:url('data:image/svg+xml;charset=utf-8,');--md-status--new:url('data:image/svg+xml;charset=utf-8,');--md-status--deprecated:url('data:image/svg+xml;charset=utf-8,');--md-status--encrypted:url('data:image/svg+xml;charset=utf-8,')}.md-status{margin-left:.2rem}.md-status:after{background-color:var(--md-default-fg-color--light);content:"";display:inline-block;height:1.125em;-webkit-mask-image:var(--md-status);mask-image:var(--md-status);-webkit-mask-position:center;mask-position:center;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;-webkit-mask-size:contain;mask-size:contain;vertical-align:text-bottom;width:1.125em}.md-status:hover:after{background-color:currentcolor}.md-status--new:after{-webkit-mask-image:var(--md-status--new);mask-image:var(--md-status--new)}.md-status--deprecated:after{-webkit-mask-image:var(--md-status--deprecated);mask-image:var(--md-status--deprecated)}.md-status--encrypted:after{-webkit-mask-image:var(--md-status--encrypted);mask-image:var(--md-status--encrypted)}.md-tabs{background-color:var(--md-primary-fg-color);color:var(--md-primary-bg-color);display:block;line-height:1.3;overflow:auto;width:100%;z-index:3}@media print{.md-tabs{display:none}}@media screen and (max-width:76.1875em){.md-tabs{display:none}}.md-tabs[hidden]{pointer-events:none}[dir=ltr] .md-tabs__list{margin-left:.2rem}[dir=rtl] .md-tabs__list{margin-right:.2rem}.md-tabs__list{contain:content;display:flex;list-style:none;margin:0;overflow:auto;padding:0;scrollbar-width:none;white-space:nowrap}.md-tabs__list::-webkit-scrollbar{display:none}.md-tabs__item{height:2.4rem;padding-left:.6rem;padding-right:.6rem}.md-tabs__item--active .md-tabs__link{color:inherit;opacity:1}.md-tabs__link{-webkit-backface-visibility:hidden;backface-visibility:hidden;display:flex;font-size:.7rem;margin-top:.8rem;opacity:.7;outline-color:var(--md-accent-fg-color);outline-offset:.2rem;transition:transform .4s cubic-bezier(.1,.7,.1,1),opacity .25s}.md-tabs__link:focus,.md-tabs__link:hover{color:inherit;opacity:1}[dir=ltr] .md-tabs__link svg{margin-right:.4rem}[dir=rtl] .md-tabs__link svg{margin-left:.4rem}.md-tabs__link svg{fill:currentcolor;height:1.3em}.md-tabs__item:nth-child(2) .md-tabs__link{transition-delay:20ms}.md-tabs__item:nth-child(3) .md-tabs__link{transition-delay:40ms}.md-tabs__item:nth-child(4) .md-tabs__link{transition-delay:60ms}.md-tabs__item:nth-child(5) .md-tabs__link{transition-delay:80ms}.md-tabs__item:nth-child(6) .md-tabs__link{transition-delay:.1s}.md-tabs__item:nth-child(7) .md-tabs__link{transition-delay:.12s}.md-tabs__item:nth-child(8) .md-tabs__link{transition-delay:.14s}.md-tabs__item:nth-child(9) .md-tabs__link{transition-delay:.16s}.md-tabs__item:nth-child(10) .md-tabs__link{transition-delay:.18s}.md-tabs__item:nth-child(11) .md-tabs__link{transition-delay:.2s}.md-tabs__item:nth-child(12) .md-tabs__link{transition-delay:.22s}.md-tabs__item:nth-child(13) .md-tabs__link{transition-delay:.24s}.md-tabs__item:nth-child(14) .md-tabs__link{transition-delay:.26s}.md-tabs__item:nth-child(15) .md-tabs__link{transition-delay:.28s}.md-tabs__item:nth-child(16) .md-tabs__link{transition-delay:.3s}.md-tabs[hidden] .md-tabs__link{opacity:0;transform:translateY(50%);transition:transform 0ms .1s,opacity .1s}:root{--md-tag-icon:url('data:image/svg+xml;charset=utf-8,')}.md-typeset .md-tags{margin-bottom:.75em;margin-top:-.125em}[dir=ltr] .md-typeset .md-tag{margin-right:.5em}[dir=rtl] .md-typeset .md-tag{margin-left:.5em}.md-typeset .md-tag{background:var(--md-default-fg-color--lightest);border-radius:2.4rem;display:inline-block;font-size:.64rem;font-weight:700;letter-spacing:normal;line-height:1.6;margin-bottom:.5em;padding:.3125em .9375em}.md-typeset .md-tag[href]{-webkit-tap-highlight-color:transparent;color:inherit;outline:none;transition:color 125ms,background-color 125ms}.md-typeset .md-tag[href]:focus,.md-typeset .md-tag[href]:hover{background-color:var(--md-accent-fg-color);color:var(--md-accent-bg-color)}[id]>.md-typeset .md-tag{vertical-align:text-top}.md-typeset .md-tag-icon:before{background-color:var(--md-default-fg-color--lighter);content:"";display:inline-block;height:1.2em;margin-right:.4em;-webkit-mask-image:var(--md-tag-icon);mask-image:var(--md-tag-icon);-webkit-mask-position:center;mask-position:center;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;-webkit-mask-size:contain;mask-size:contain;transition:background-color 125ms;vertical-align:text-bottom;width:1.2em}.md-typeset .md-tag-icon[href]:focus:before,.md-typeset .md-tag-icon[href]:hover:before{background-color:var(--md-accent-bg-color)}@keyframes pulse{0%{transform:scale(.95)}75%{transform:scale(1)}to{transform:scale(.95)}}:root{--md-annotation-bg-icon:url('data:image/svg+xml;charset=utf-8,');--md-annotation-icon:url('data:image/svg+xml;charset=utf-8,');--md-tooltip-width:20rem}.md-tooltip{-webkit-backface-visibility:hidden;backface-visibility:hidden;background-color:var(--md-default-bg-color);border-radius:.1rem;box-shadow:var(--md-shadow-z2);color:var(--md-default-fg-color);font-family:var(--md-text-font-family);left:clamp(var(--md-tooltip-0,0rem) + .8rem,var(--md-tooltip-x),100vw + var(--md-tooltip-0,0rem) + .8rem - var(--md-tooltip-width) - 2 * .8rem);max-width:calc(100vw - 1.6rem);opacity:0;position:absolute;top:var(--md-tooltip-y);transform:translateY(-.4rem);transition:transform 0ms .25s,opacity .25s,z-index .25s;width:var(--md-tooltip-width);z-index:0}.md-tooltip--active{opacity:1;transform:translateY(0);transition:transform .25s cubic-bezier(.1,.7,.1,1),opacity .25s,z-index 0ms;z-index:2}.md-tooltip--inline{font-weight:700;-webkit-user-select:none;user-select:none;width:auto}.md-tooltip--inline:not(.md-tooltip--active){transform:translateY(.2rem) scale(.9)}.md-tooltip--inline .md-tooltip__inner{font-size:.5rem;padding:.2rem .4rem}[hidden]+.md-tooltip--inline{display:none}.focus-visible>.md-tooltip,.md-tooltip:target{outline:var(--md-accent-fg-color) auto}.md-tooltip__inner{font-size:.64rem;padding:.8rem}.md-tooltip__inner.md-typeset>:first-child{margin-top:0}.md-tooltip__inner.md-typeset>:last-child{margin-bottom:0}.md-annotation{font-weight:400;outline:none;vertical-align:text-bottom;white-space:normal}[dir=rtl] .md-annotation{direction:rtl}code .md-annotation{font-family:var(--md-code-font-family);font-size:inherit}.md-annotation:not([hidden]){display:inline-block;line-height:1.25}.md-annotation__index{border-radius:.01px;cursor:pointer;display:inline-block;margin-left:.4ch;margin-right:.4ch;outline:none;overflow:hidden;position:relative;-webkit-user-select:none;user-select:none;vertical-align:text-top;z-index:0}.md-annotation .md-annotation__index{transition:z-index .25s}@media screen{.md-annotation__index{width:2.2ch}[data-md-visible]>.md-annotation__index{animation:pulse 2s infinite}.md-annotation__index:before{background:var(--md-default-bg-color);-webkit-mask-image:var(--md-annotation-bg-icon);mask-image:var(--md-annotation-bg-icon)}.md-annotation__index:after,.md-annotation__index:before{content:"";height:2.2ch;-webkit-mask-position:center;mask-position:center;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;-webkit-mask-size:contain;mask-size:contain;position:absolute;top:-.1ch;width:2.2ch;z-index:-1}.md-annotation__index:after{background-color:var(--md-default-fg-color--lighter);-webkit-mask-image:var(--md-annotation-icon);mask-image:var(--md-annotation-icon);transform:scale(1.0001);transition:background-color .25s,transform .25s}.md-tooltip--active+.md-annotation__index:after{transform:rotate(45deg)}.md-tooltip--active+.md-annotation__index:after,:hover>.md-annotation__index:after{background-color:var(--md-accent-fg-color)}}.md-tooltip--active+.md-annotation__index{animation-play-state:paused;transition-duration:0ms;z-index:2}.md-annotation__index [data-md-annotation-id]{display:inline-block}@media print{.md-annotation__index [data-md-annotation-id]{background:var(--md-default-fg-color--lighter);border-radius:2ch;color:var(--md-default-bg-color);font-weight:700;padding:0 .6ch;white-space:nowrap}.md-annotation__index [data-md-annotation-id]:after{content:attr(data-md-annotation-id)}}.md-typeset .md-annotation-list{counter-reset:xxx;list-style:none}.md-typeset .md-annotation-list li{position:relative}[dir=ltr] .md-typeset .md-annotation-list li:before{left:-2.125em}[dir=rtl] .md-typeset .md-annotation-list li:before{right:-2.125em}.md-typeset .md-annotation-list li:before{background:var(--md-default-fg-color--lighter);border-radius:2ch;color:var(--md-default-bg-color);content:counter(xxx);counter-increment:xxx;font-size:.8875em;font-weight:700;height:2ch;line-height:1.25;min-width:2ch;padding:0 .6ch;position:absolute;text-align:center;top:.25em}[dir=ltr] .md-top{margin-left:50%}[dir=rtl] .md-top{margin-right:50%}.md-top{background-color:var(--md-default-bg-color);border-radius:1.6rem;box-shadow:var(--md-shadow-z2);color:var(--md-default-fg-color--light);cursor:pointer;display:block;font-size:.7rem;outline:none;padding:.4rem .8rem;position:fixed;top:3.2rem;transform:translate(-50%);transition:color 125ms,background-color 125ms,transform 125ms cubic-bezier(.4,0,.2,1),opacity 125ms;z-index:2}@media print{.md-top{display:none}}[dir=rtl] .md-top{transform:translate(50%)}.md-top[hidden]{opacity:0;pointer-events:none;transform:translate(-50%,.2rem);transition-duration:0ms}[dir=rtl] .md-top[hidden]{transform:translate(50%,.2rem)}.md-top:focus,.md-top:hover{background-color:var(--md-accent-fg-color);color:var(--md-accent-bg-color)}.md-top svg{display:inline-block;vertical-align:-.5em}@keyframes hoverfix{0%{pointer-events:none}}:root{--md-version-icon:url('data:image/svg+xml;charset=utf-8,')}.md-version{flex-shrink:0;font-size:.8rem;height:2.4rem}[dir=ltr] .md-version__current{margin-left:1.4rem;margin-right:.4rem}[dir=rtl] .md-version__current{margin-left:.4rem;margin-right:1.4rem}.md-version__current{color:inherit;cursor:pointer;outline:none;position:relative;top:.05rem}[dir=ltr] .md-version__current:after{margin-left:.4rem}[dir=rtl] .md-version__current:after{margin-right:.4rem}.md-version__current:after{background-color:currentcolor;content:"";display:inline-block;height:.6rem;-webkit-mask-image:var(--md-version-icon);mask-image:var(--md-version-icon);-webkit-mask-position:center;mask-position:center;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;-webkit-mask-size:contain;mask-size:contain;width:.4rem}.md-version__list{background-color:var(--md-default-bg-color);border-radius:.1rem;box-shadow:var(--md-shadow-z2);color:var(--md-default-fg-color);list-style-type:none;margin:.2rem .8rem;max-height:0;opacity:0;overflow:auto;padding:0;position:absolute;scroll-snap-type:y mandatory;top:.15rem;transition:max-height 0ms .5s,opacity .25s .25s;z-index:3}.md-version:focus-within .md-version__list,.md-version:hover .md-version__list{max-height:10rem;opacity:1;transition:max-height 0ms,opacity .25s}@media (hover:none),(pointer:coarse){.md-version:hover .md-version__list{animation:hoverfix .25s forwards}.md-version:focus-within .md-version__list{animation:none}}.md-version__item{line-height:1.8rem}[dir=ltr] .md-version__link{padding-left:.6rem;padding-right:1.2rem}[dir=rtl] .md-version__link{padding-left:1.2rem;padding-right:.6rem}.md-version__link{cursor:pointer;display:block;outline:none;scroll-snap-align:start;transition:color .25s,background-color .25s;white-space:nowrap;width:100%}.md-version__link:focus,.md-version__link:hover{color:var(--md-accent-fg-color)}.md-version__link:focus{background-color:var(--md-default-fg-color--lightest)}:root{--md-admonition-icon--note:url('data:image/svg+xml;charset=utf-8,');--md-admonition-icon--abstract:url('data:image/svg+xml;charset=utf-8,');--md-admonition-icon--info:url('data:image/svg+xml;charset=utf-8,');--md-admonition-icon--tip:url('data:image/svg+xml;charset=utf-8,');--md-admonition-icon--success:url('data:image/svg+xml;charset=utf-8,');--md-admonition-icon--question:url('data:image/svg+xml;charset=utf-8,');--md-admonition-icon--warning:url('data:image/svg+xml;charset=utf-8,');--md-admonition-icon--failure:url('data:image/svg+xml;charset=utf-8,');--md-admonition-icon--danger:url('data:image/svg+xml;charset=utf-8,');--md-admonition-icon--bug:url('data:image/svg+xml;charset=utf-8,');--md-admonition-icon--example:url('data:image/svg+xml;charset=utf-8,');--md-admonition-icon--quote:url('data:image/svg+xml;charset=utf-8,')}.md-typeset .admonition,.md-typeset details{background-color:var(--md-admonition-bg-color);border:.05rem solid #448aff;border-radius:.2rem;box-shadow:var(--md-shadow-z1);color:var(--md-admonition-fg-color);display:flow-root;font-size:.64rem;margin:1.5625em 0;padding:0 .6rem;page-break-inside:avoid;transition:box-shadow 125ms}@media print{.md-typeset .admonition,.md-typeset details{box-shadow:none}}.md-typeset .admonition:focus-within,.md-typeset details:focus-within{box-shadow:0 0 0 .2rem #448aff1a}.md-typeset .admonition>*,.md-typeset details>*{box-sizing:border-box}.md-typeset .admonition .admonition,.md-typeset .admonition details,.md-typeset details .admonition,.md-typeset details details{margin-bottom:1em;margin-top:1em}.md-typeset .admonition .md-typeset__scrollwrap,.md-typeset details .md-typeset__scrollwrap{margin:1em -.6rem}.md-typeset .admonition .md-typeset__table,.md-typeset details .md-typeset__table{padding:0 .6rem}.md-typeset .admonition>.tabbed-set:only-child,.md-typeset details>.tabbed-set:only-child{margin-top:0}html .md-typeset .admonition>:last-child,html .md-typeset details>:last-child{margin-bottom:.6rem}[dir=ltr] .md-typeset .admonition-title,[dir=ltr] .md-typeset summary{padding-left:2rem;padding-right:.6rem}[dir=rtl] .md-typeset .admonition-title,[dir=rtl] .md-typeset summary{padding-left:.6rem;padding-right:2rem}[dir=ltr] .md-typeset .admonition-title,[dir=ltr] .md-typeset summary{border-left-width:.2rem}[dir=rtl] .md-typeset .admonition-title,[dir=rtl] .md-typeset summary{border-right-width:.2rem}[dir=ltr] .md-typeset .admonition-title,[dir=ltr] .md-typeset summary{border-top-left-radius:.1rem}[dir=ltr] .md-typeset .admonition-title,[dir=ltr] .md-typeset summary,[dir=rtl] .md-typeset .admonition-title,[dir=rtl] .md-typeset summary{border-top-right-radius:.1rem}[dir=rtl] .md-typeset .admonition-title,[dir=rtl] .md-typeset summary{border-top-left-radius:.1rem}.md-typeset .admonition-title,.md-typeset summary{background-color:#448aff1a;border:none;font-weight:700;margin:0 -.6rem;padding-bottom:.4rem;padding-top:.4rem;position:relative}html .md-typeset .admonition-title:last-child,html .md-typeset summary:last-child{margin-bottom:0}[dir=ltr] .md-typeset .admonition-title:before,[dir=ltr] .md-typeset summary:before{left:.6rem}[dir=rtl] .md-typeset .admonition-title:before,[dir=rtl] .md-typeset summary:before{right:.6rem}.md-typeset .admonition-title:before,.md-typeset summary:before{background-color:#448aff;content:"";height:1rem;-webkit-mask-image:var(--md-admonition-icon--note);mask-image:var(--md-admonition-icon--note);-webkit-mask-position:center;mask-position:center;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;-webkit-mask-size:contain;mask-size:contain;position:absolute;top:.625em;width:1rem}.md-typeset .admonition-title code,.md-typeset summary code{box-shadow:0 0 0 .05rem var(--md-default-fg-color--lightest)}.md-typeset .admonition.note,.md-typeset details.note{border-color:#448aff}.md-typeset .admonition.note:focus-within,.md-typeset details.note:focus-within{box-shadow:0 0 0 .2rem #448aff1a}.md-typeset .note>.admonition-title,.md-typeset .note>summary{background-color:#448aff1a}.md-typeset .note>.admonition-title:before,.md-typeset .note>summary:before{background-color:#448aff;-webkit-mask-image:var(--md-admonition-icon--note);mask-image:var(--md-admonition-icon--note)}.md-typeset .note>.admonition-title:after,.md-typeset .note>summary:after{color:#448aff}.md-typeset .admonition.abstract,.md-typeset details.abstract{border-color:#00b0ff}.md-typeset .admonition.abstract:focus-within,.md-typeset details.abstract:focus-within{box-shadow:0 0 0 .2rem #00b0ff1a}.md-typeset .abstract>.admonition-title,.md-typeset .abstract>summary{background-color:#00b0ff1a}.md-typeset .abstract>.admonition-title:before,.md-typeset .abstract>summary:before{background-color:#00b0ff;-webkit-mask-image:var(--md-admonition-icon--abstract);mask-image:var(--md-admonition-icon--abstract)}.md-typeset .abstract>.admonition-title:after,.md-typeset .abstract>summary:after{color:#00b0ff}.md-typeset .admonition.info,.md-typeset details.info{border-color:#00b8d4}.md-typeset .admonition.info:focus-within,.md-typeset details.info:focus-within{box-shadow:0 0 0 .2rem #00b8d41a}.md-typeset .info>.admonition-title,.md-typeset .info>summary{background-color:#00b8d41a}.md-typeset .info>.admonition-title:before,.md-typeset .info>summary:before{background-color:#00b8d4;-webkit-mask-image:var(--md-admonition-icon--info);mask-image:var(--md-admonition-icon--info)}.md-typeset .info>.admonition-title:after,.md-typeset .info>summary:after{color:#00b8d4}.md-typeset .admonition.tip,.md-typeset details.tip{border-color:#00bfa5}.md-typeset .admonition.tip:focus-within,.md-typeset details.tip:focus-within{box-shadow:0 0 0 .2rem #00bfa51a}.md-typeset .tip>.admonition-title,.md-typeset .tip>summary{background-color:#00bfa51a}.md-typeset .tip>.admonition-title:before,.md-typeset .tip>summary:before{background-color:#00bfa5;-webkit-mask-image:var(--md-admonition-icon--tip);mask-image:var(--md-admonition-icon--tip)}.md-typeset .tip>.admonition-title:after,.md-typeset .tip>summary:after{color:#00bfa5}.md-typeset .admonition.success,.md-typeset details.success{border-color:#00c853}.md-typeset .admonition.success:focus-within,.md-typeset details.success:focus-within{box-shadow:0 0 0 .2rem #00c8531a}.md-typeset .success>.admonition-title,.md-typeset .success>summary{background-color:#00c8531a}.md-typeset .success>.admonition-title:before,.md-typeset .success>summary:before{background-color:#00c853;-webkit-mask-image:var(--md-admonition-icon--success);mask-image:var(--md-admonition-icon--success)}.md-typeset .success>.admonition-title:after,.md-typeset .success>summary:after{color:#00c853}.md-typeset .admonition.question,.md-typeset details.question{border-color:#64dd17}.md-typeset .admonition.question:focus-within,.md-typeset details.question:focus-within{box-shadow:0 0 0 .2rem #64dd171a}.md-typeset .question>.admonition-title,.md-typeset .question>summary{background-color:#64dd171a}.md-typeset .question>.admonition-title:before,.md-typeset .question>summary:before{background-color:#64dd17;-webkit-mask-image:var(--md-admonition-icon--question);mask-image:var(--md-admonition-icon--question)}.md-typeset .question>.admonition-title:after,.md-typeset .question>summary:after{color:#64dd17}.md-typeset .admonition.warning,.md-typeset details.warning{border-color:#ff9100}.md-typeset .admonition.warning:focus-within,.md-typeset details.warning:focus-within{box-shadow:0 0 0 .2rem #ff91001a}.md-typeset .warning>.admonition-title,.md-typeset .warning>summary{background-color:#ff91001a}.md-typeset .warning>.admonition-title:before,.md-typeset .warning>summary:before{background-color:#ff9100;-webkit-mask-image:var(--md-admonition-icon--warning);mask-image:var(--md-admonition-icon--warning)}.md-typeset .warning>.admonition-title:after,.md-typeset .warning>summary:after{color:#ff9100}.md-typeset .admonition.failure,.md-typeset details.failure{border-color:#ff5252}.md-typeset .admonition.failure:focus-within,.md-typeset details.failure:focus-within{box-shadow:0 0 0 .2rem #ff52521a}.md-typeset .failure>.admonition-title,.md-typeset .failure>summary{background-color:#ff52521a}.md-typeset .failure>.admonition-title:before,.md-typeset .failure>summary:before{background-color:#ff5252;-webkit-mask-image:var(--md-admonition-icon--failure);mask-image:var(--md-admonition-icon--failure)}.md-typeset .failure>.admonition-title:after,.md-typeset .failure>summary:after{color:#ff5252}.md-typeset .admonition.danger,.md-typeset details.danger{border-color:#ff1744}.md-typeset .admonition.danger:focus-within,.md-typeset details.danger:focus-within{box-shadow:0 0 0 .2rem #ff17441a}.md-typeset .danger>.admonition-title,.md-typeset .danger>summary{background-color:#ff17441a}.md-typeset .danger>.admonition-title:before,.md-typeset .danger>summary:before{background-color:#ff1744;-webkit-mask-image:var(--md-admonition-icon--danger);mask-image:var(--md-admonition-icon--danger)}.md-typeset .danger>.admonition-title:after,.md-typeset .danger>summary:after{color:#ff1744}.md-typeset .admonition.bug,.md-typeset details.bug{border-color:#f50057}.md-typeset .admonition.bug:focus-within,.md-typeset details.bug:focus-within{box-shadow:0 0 0 .2rem #f500571a}.md-typeset .bug>.admonition-title,.md-typeset .bug>summary{background-color:#f500571a}.md-typeset .bug>.admonition-title:before,.md-typeset .bug>summary:before{background-color:#f50057;-webkit-mask-image:var(--md-admonition-icon--bug);mask-image:var(--md-admonition-icon--bug)}.md-typeset .bug>.admonition-title:after,.md-typeset .bug>summary:after{color:#f50057}.md-typeset .admonition.example,.md-typeset details.example{border-color:#7c4dff}.md-typeset .admonition.example:focus-within,.md-typeset details.example:focus-within{box-shadow:0 0 0 .2rem #7c4dff1a}.md-typeset .example>.admonition-title,.md-typeset .example>summary{background-color:#7c4dff1a}.md-typeset .example>.admonition-title:before,.md-typeset .example>summary:before{background-color:#7c4dff;-webkit-mask-image:var(--md-admonition-icon--example);mask-image:var(--md-admonition-icon--example)}.md-typeset .example>.admonition-title:after,.md-typeset .example>summary:after{color:#7c4dff}.md-typeset .admonition.quote,.md-typeset details.quote{border-color:#9e9e9e}.md-typeset .admonition.quote:focus-within,.md-typeset details.quote:focus-within{box-shadow:0 0 0 .2rem #9e9e9e1a}.md-typeset .quote>.admonition-title,.md-typeset .quote>summary{background-color:#9e9e9e1a}.md-typeset .quote>.admonition-title:before,.md-typeset .quote>summary:before{background-color:#9e9e9e;-webkit-mask-image:var(--md-admonition-icon--quote);mask-image:var(--md-admonition-icon--quote)}.md-typeset .quote>.admonition-title:after,.md-typeset .quote>summary:after{color:#9e9e9e}:root{--md-footnotes-icon:url('data:image/svg+xml;charset=utf-8,')}.md-typeset .footnote{color:var(--md-default-fg-color--light);font-size:.64rem}[dir=ltr] .md-typeset .footnote>ol{margin-left:0}[dir=rtl] .md-typeset .footnote>ol{margin-right:0}.md-typeset .footnote>ol>li{transition:color 125ms}.md-typeset .footnote>ol>li:target{color:var(--md-default-fg-color)}.md-typeset .footnote>ol>li:focus-within .footnote-backref{opacity:1;transform:translateX(0);transition:none}.md-typeset .footnote>ol>li:hover .footnote-backref,.md-typeset .footnote>ol>li:target .footnote-backref{opacity:1;transform:translateX(0)}.md-typeset .footnote>ol>li>:first-child{margin-top:0}.md-typeset .footnote-ref{font-size:.75em;font-weight:700}html .md-typeset .footnote-ref{outline-offset:.1rem}.md-typeset [id^="fnref:"]:target>.footnote-ref{outline:auto}.md-typeset .footnote-backref{color:var(--md-typeset-a-color);display:inline-block;font-size:0;opacity:0;transform:translateX(.25rem);transition:color .25s,transform .25s .25s,opacity 125ms .25s;vertical-align:text-bottom}@media print{.md-typeset .footnote-backref{color:var(--md-typeset-a-color);opacity:1;transform:translateX(0)}}[dir=rtl] .md-typeset .footnote-backref{transform:translateX(-.25rem)}.md-typeset .footnote-backref:hover{color:var(--md-accent-fg-color)}.md-typeset .footnote-backref:before{background-color:currentcolor;content:"";display:inline-block;height:.8rem;-webkit-mask-image:var(--md-footnotes-icon);mask-image:var(--md-footnotes-icon);-webkit-mask-position:center;mask-position:center;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;-webkit-mask-size:contain;mask-size:contain;width:.8rem}[dir=rtl] .md-typeset .footnote-backref:before svg{transform:scaleX(-1)}[dir=ltr] .md-typeset .headerlink{margin-left:.5rem}[dir=rtl] .md-typeset .headerlink{margin-right:.5rem}.md-typeset .headerlink{color:var(--md-default-fg-color--lighter);display:inline-block;opacity:0;transition:color .25s,opacity 125ms}@media print{.md-typeset .headerlink{display:none}}.md-typeset .headerlink:focus,.md-typeset :hover>.headerlink,.md-typeset :target>.headerlink{opacity:1;transition:color .25s,opacity 125ms}.md-typeset .headerlink:focus,.md-typeset .headerlink:hover,.md-typeset :target>.headerlink{color:var(--md-accent-fg-color)}.md-typeset :target{--md-scroll-margin:3.6rem;--md-scroll-offset:0rem;scroll-margin-top:calc(var(--md-scroll-margin) - var(--md-scroll-offset))}@media screen and (min-width:76.25em){.md-header--lifted~.md-container .md-typeset :target{--md-scroll-margin:6rem}}.md-typeset h1:target,.md-typeset h2:target,.md-typeset h3:target{--md-scroll-offset:0.2rem}.md-typeset h4:target{--md-scroll-offset:0.15rem}.md-typeset div.arithmatex{overflow:auto}@media screen and (max-width:44.9375em){.md-typeset div.arithmatex{margin:0 -.8rem}}.md-typeset div.arithmatex>*{margin-left:auto!important;margin-right:auto!important;padding:0 .8rem;touch-action:auto;width:-webkit-min-content;width:min-content}.md-typeset div.arithmatex>* mjx-container{margin:0!important}.md-typeset del.critic{background-color:var(--md-typeset-del-color)}.md-typeset del.critic,.md-typeset ins.critic{-webkit-box-decoration-break:clone;box-decoration-break:clone}.md-typeset ins.critic{background-color:var(--md-typeset-ins-color)}.md-typeset .critic.comment{-webkit-box-decoration-break:clone;box-decoration-break:clone;color:var(--md-code-hl-comment-color)}.md-typeset .critic.comment:before{content:"/* "}.md-typeset .critic.comment:after{content:" */"}.md-typeset .critic.block{box-shadow:none;display:block;margin:1em 0;overflow:auto;padding-left:.8rem;padding-right:.8rem}.md-typeset .critic.block>:first-child{margin-top:.5em}.md-typeset .critic.block>:last-child{margin-bottom:.5em}:root{--md-details-icon:url('data:image/svg+xml;charset=utf-8,')}.md-typeset details{display:flow-root;overflow:visible;padding-top:0}.md-typeset details[open]>summary:after{transform:rotate(90deg)}.md-typeset details:not([open]){box-shadow:none;padding-bottom:0}.md-typeset details:not([open])>summary{border-radius:.1rem}[dir=ltr] .md-typeset summary{padding-right:1.8rem}[dir=rtl] .md-typeset summary{padding-left:1.8rem}[dir=ltr] .md-typeset summary{border-top-left-radius:.1rem}[dir=ltr] .md-typeset summary,[dir=rtl] .md-typeset summary{border-top-right-radius:.1rem}[dir=rtl] .md-typeset summary{border-top-left-radius:.1rem}.md-typeset summary{cursor:pointer;display:block;min-height:1rem}.md-typeset summary.focus-visible{outline-color:var(--md-accent-fg-color);outline-offset:.2rem}.md-typeset summary:not(.focus-visible){-webkit-tap-highlight-color:transparent;outline:none}[dir=ltr] .md-typeset summary:after{right:.4rem}[dir=rtl] .md-typeset summary:after{left:.4rem}.md-typeset summary:after{background-color:currentcolor;content:"";height:1rem;-webkit-mask-image:var(--md-details-icon);mask-image:var(--md-details-icon);-webkit-mask-position:center;mask-position:center;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;-webkit-mask-size:contain;mask-size:contain;position:absolute;top:.625em;transform:rotate(0deg);transition:transform .25s;width:1rem}[dir=rtl] .md-typeset summary:after{transform:rotate(180deg)}.md-typeset summary::marker{display:none}.md-typeset summary::-webkit-details-marker{display:none}.md-typeset .emojione,.md-typeset .gemoji,.md-typeset .twemoji{--md-icon-size:1.125em;display:inline-flex;height:var(--md-icon-size);vertical-align:text-top}.md-typeset .emojione svg,.md-typeset .gemoji svg,.md-typeset .twemoji svg{fill:currentcolor;max-height:100%;width:var(--md-icon-size)}.md-typeset .lg,.md-typeset .xl,.md-typeset .xxl,.md-typeset .xxxl{vertical-align:text-bottom}.md-typeset .middle{vertical-align:middle}.md-typeset .lg{--md-icon-size:1.5em}.md-typeset .xl{--md-icon-size:2.25em}.md-typeset .xxl{--md-icon-size:3em}.md-typeset .xxxl{--md-icon-size:4em}.highlight .o,.highlight .ow{color:var(--md-code-hl-operator-color)}.highlight .p{color:var(--md-code-hl-punctuation-color)}.highlight .cpf,.highlight .l,.highlight .s,.highlight .s1,.highlight .s2,.highlight .sb,.highlight .sc,.highlight .si,.highlight .ss{color:var(--md-code-hl-string-color)}.highlight .cp,.highlight .se,.highlight .sh,.highlight .sr,.highlight .sx{color:var(--md-code-hl-special-color)}.highlight .il,.highlight .m,.highlight .mb,.highlight .mf,.highlight .mh,.highlight .mi,.highlight .mo{color:var(--md-code-hl-number-color)}.highlight .k,.highlight .kd,.highlight .kn,.highlight .kp,.highlight .kr,.highlight .kt{color:var(--md-code-hl-keyword-color)}.highlight .kc,.highlight .n{color:var(--md-code-hl-name-color)}.highlight .bp,.highlight .nb,.highlight .no{color:var(--md-code-hl-constant-color)}.highlight .nc,.highlight .ne,.highlight .nf,.highlight .nn{color:var(--md-code-hl-function-color)}.highlight .nd,.highlight .ni,.highlight .nl,.highlight .nt{color:var(--md-code-hl-keyword-color)}.highlight .c,.highlight .c1,.highlight .ch,.highlight .cm,.highlight .cs,.highlight .sd{color:var(--md-code-hl-comment-color)}.highlight .na,.highlight .nv,.highlight .vc,.highlight .vg,.highlight .vi{color:var(--md-code-hl-variable-color)}.highlight .ge,.highlight .gh,.highlight .go,.highlight .gp,.highlight .gr,.highlight .gs,.highlight .gt,.highlight .gu{color:var(--md-code-hl-generic-color)}.highlight .gd,.highlight .gi{border-radius:.1rem;margin:0 -.125em;padding:0 .125em}.highlight .gd{background-color:var(--md-typeset-del-color)}.highlight .gi{background-color:var(--md-typeset-ins-color)}.highlight .hll{background-color:var(--md-code-hl-color--light);box-shadow:2px 0 0 0 var(--md-code-hl-color) inset;display:block;margin:0 -1.1764705882em;padding:0 1.1764705882em}.highlight span.filename{background-color:var(--md-code-bg-color);border-bottom:.05rem solid var(--md-default-fg-color--lightest);border-top-left-radius:.1rem;border-top-right-radius:.1rem;display:flow-root;font-size:.85em;font-weight:700;margin-top:1em;padding:.6617647059em 1.1764705882em;position:relative}.highlight span.filename+pre{margin-top:0}.highlight span.filename+pre>code{border-top-left-radius:0;border-top-right-radius:0}.highlight [data-linenos]:before{background-color:var(--md-code-bg-color);box-shadow:-.05rem 0 var(--md-default-fg-color--lightest) inset;color:var(--md-default-fg-color--light);content:attr(data-linenos);float:left;left:-1.1764705882em;margin-left:-1.1764705882em;margin-right:1.1764705882em;padding-left:1.1764705882em;position:sticky;-webkit-user-select:none;user-select:none;z-index:3}.highlight code a[id]{position:absolute;visibility:hidden}.highlight code[data-md-copying]{display:block}.highlight code[data-md-copying] .hll{display:contents}.highlight code[data-md-copying] .md-annotation{display:none}.highlighttable{display:flow-root}.highlighttable tbody,.highlighttable td{display:block;padding:0}.highlighttable tr{display:flex}.highlighttable pre{margin:0}.highlighttable th.filename{flex-grow:1;padding:0;text-align:left}.highlighttable th.filename span.filename{margin-top:0}.highlighttable .linenos{background-color:var(--md-code-bg-color);border-bottom-left-radius:.1rem;border-top-left-radius:.1rem;font-size:.85em;padding:.7720588235em 0 .7720588235em 1.1764705882em;-webkit-user-select:none;user-select:none}.highlighttable .linenodiv{box-shadow:-.05rem 0 var(--md-default-fg-color--lightest) inset}.highlighttable .linenodiv pre{color:var(--md-default-fg-color--light);text-align:right}.highlighttable .linenodiv span[class]{padding-right:.5882352941em}.highlighttable .code{flex:1;min-width:0}.linenodiv a{color:inherit}.md-typeset .highlighttable{direction:ltr;margin:1em 0}.md-typeset .highlighttable>tbody>tr>.code>div>pre>code{border-bottom-left-radius:0;border-top-left-radius:0}.md-typeset .highlight+.result{border:.05rem solid var(--md-code-bg-color);border-bottom-left-radius:.1rem;border-bottom-right-radius:.1rem;border-top-width:.1rem;margin-top:-1.125em;overflow:visible;padding:0 1em}.md-typeset .highlight+.result:after{clear:both;content:"";display:block}@media screen and (max-width:44.9375em){.md-content__inner>.highlight{margin:1em -.8rem}.md-content__inner>.highlight>.filename,.md-content__inner>.highlight>.highlighttable>tbody>tr>.code>div>pre>code,.md-content__inner>.highlight>.highlighttable>tbody>tr>.filename span.filename,.md-content__inner>.highlight>.highlighttable>tbody>tr>.linenos,.md-content__inner>.highlight>pre>code{border-radius:0}.md-content__inner>.highlight+.result{border-left-width:0;border-radius:0;border-right-width:0;margin-left:-.8rem;margin-right:-.8rem}}.md-typeset .keys kbd:after,.md-typeset .keys kbd:before{-moz-osx-font-smoothing:initial;-webkit-font-smoothing:initial;color:inherit;margin:0;position:relative}.md-typeset .keys span{color:var(--md-default-fg-color--light);padding:0 .2em}.md-typeset .keys .key-alt:before,.md-typeset .keys .key-left-alt:before,.md-typeset .keys .key-right-alt:before{content:"⎇";padding-right:.4em}.md-typeset .keys .key-command:before,.md-typeset .keys .key-left-command:before,.md-typeset .keys .key-right-command:before{content:"⌘";padding-right:.4em}.md-typeset .keys .key-control:before,.md-typeset .keys .key-left-control:before,.md-typeset .keys .key-right-control:before{content:"⌃";padding-right:.4em}.md-typeset .keys .key-left-meta:before,.md-typeset .keys .key-meta:before,.md-typeset .keys .key-right-meta:before{content:"◆";padding-right:.4em}.md-typeset .keys .key-left-option:before,.md-typeset .keys .key-option:before,.md-typeset .keys .key-right-option:before{content:"⌥";padding-right:.4em}.md-typeset .keys .key-left-shift:before,.md-typeset .keys .key-right-shift:before,.md-typeset .keys .key-shift:before{content:"⇧";padding-right:.4em}.md-typeset .keys .key-left-super:before,.md-typeset .keys .key-right-super:before,.md-typeset .keys .key-super:before{content:"❖";padding-right:.4em}.md-typeset .keys .key-left-windows:before,.md-typeset .keys .key-right-windows:before,.md-typeset .keys .key-windows:before{content:"⊞";padding-right:.4em}.md-typeset .keys .key-arrow-down:before{content:"↓";padding-right:.4em}.md-typeset .keys .key-arrow-left:before{content:"←";padding-right:.4em}.md-typeset .keys .key-arrow-right:before{content:"→";padding-right:.4em}.md-typeset .keys .key-arrow-up:before{content:"↑";padding-right:.4em}.md-typeset .keys .key-backspace:before{content:"⌫";padding-right:.4em}.md-typeset .keys .key-backtab:before{content:"⇤";padding-right:.4em}.md-typeset .keys .key-caps-lock:before{content:"⇪";padding-right:.4em}.md-typeset .keys .key-clear:before{content:"⌧";padding-right:.4em}.md-typeset .keys .key-context-menu:before{content:"☰";padding-right:.4em}.md-typeset .keys .key-delete:before{content:"⌦";padding-right:.4em}.md-typeset .keys .key-eject:before{content:"⏏";padding-right:.4em}.md-typeset .keys .key-end:before{content:"⤓";padding-right:.4em}.md-typeset .keys .key-escape:before{content:"⎋";padding-right:.4em}.md-typeset .keys .key-home:before{content:"⤒";padding-right:.4em}.md-typeset .keys .key-insert:before{content:"⎀";padding-right:.4em}.md-typeset .keys .key-page-down:before{content:"⇟";padding-right:.4em}.md-typeset .keys .key-page-up:before{content:"⇞";padding-right:.4em}.md-typeset .keys .key-print-screen:before{content:"⎙";padding-right:.4em}.md-typeset .keys .key-tab:after{content:"⇥";padding-left:.4em}.md-typeset .keys .key-num-enter:after{content:"⌤";padding-left:.4em}.md-typeset .keys .key-enter:after{content:"⏎";padding-left:.4em}:root{--md-tabbed-icon--prev:url('data:image/svg+xml;charset=utf-8,');--md-tabbed-icon--next:url('data:image/svg+xml;charset=utf-8,')}.md-typeset .tabbed-set{border-radius:.1rem;display:flex;flex-flow:column wrap;margin:1em 0;position:relative}.md-typeset .tabbed-set>input{height:0;opacity:0;position:absolute;width:0}.md-typeset .tabbed-set>input:target{--md-scroll-offset:0.625em}.md-typeset .tabbed-labels{-ms-overflow-style:none;box-shadow:0 -.05rem var(--md-default-fg-color--lightest) inset;display:flex;max-width:100%;overflow:auto;scrollbar-width:none}@media print{.md-typeset .tabbed-labels{display:contents}}@media screen{.js .md-typeset .tabbed-labels{position:relative}.js .md-typeset .tabbed-labels:before{background:var(--md-accent-fg-color);bottom:0;content:"";display:block;height:2px;left:0;position:absolute;transform:translateX(var(--md-indicator-x));transition:width 225ms,transform .25s;transition-timing-function:cubic-bezier(.4,0,.2,1);width:var(--md-indicator-width)}}.md-typeset .tabbed-labels::-webkit-scrollbar{display:none}.md-typeset .tabbed-labels>label{border-bottom:.1rem solid #0000;border-radius:.1rem .1rem 0 0;color:var(--md-default-fg-color--light);cursor:pointer;flex-shrink:0;font-size:.64rem;font-weight:700;padding:.78125em 1.25em .625em;scroll-margin-inline-start:1rem;transition:background-color .25s,color .25s;white-space:nowrap;width:auto}@media print{.md-typeset .tabbed-labels>label:first-child{order:1}.md-typeset .tabbed-labels>label:nth-child(2){order:2}.md-typeset .tabbed-labels>label:nth-child(3){order:3}.md-typeset .tabbed-labels>label:nth-child(4){order:4}.md-typeset .tabbed-labels>label:nth-child(5){order:5}.md-typeset .tabbed-labels>label:nth-child(6){order:6}.md-typeset .tabbed-labels>label:nth-child(7){order:7}.md-typeset .tabbed-labels>label:nth-child(8){order:8}.md-typeset .tabbed-labels>label:nth-child(9){order:9}.md-typeset .tabbed-labels>label:nth-child(10){order:10}.md-typeset .tabbed-labels>label:nth-child(11){order:11}.md-typeset .tabbed-labels>label:nth-child(12){order:12}.md-typeset .tabbed-labels>label:nth-child(13){order:13}.md-typeset .tabbed-labels>label:nth-child(14){order:14}.md-typeset .tabbed-labels>label:nth-child(15){order:15}.md-typeset .tabbed-labels>label:nth-child(16){order:16}.md-typeset .tabbed-labels>label:nth-child(17){order:17}.md-typeset .tabbed-labels>label:nth-child(18){order:18}.md-typeset .tabbed-labels>label:nth-child(19){order:19}.md-typeset .tabbed-labels>label:nth-child(20){order:20}}.md-typeset .tabbed-labels>label:hover{color:var(--md-accent-fg-color)}.md-typeset .tabbed-labels>label>[href]:first-child{color:inherit}.md-typeset .tabbed-labels--linked>label{padding:0}.md-typeset .tabbed-labels--linked>label>a{display:block;padding:.78125em 1.25em .625em}.md-typeset .tabbed-content{width:100%}@media print{.md-typeset .tabbed-content{display:contents}}.md-typeset .tabbed-block{display:none}@media print{.md-typeset .tabbed-block{display:block}.md-typeset .tabbed-block:first-child{order:1}.md-typeset .tabbed-block:nth-child(2){order:2}.md-typeset .tabbed-block:nth-child(3){order:3}.md-typeset .tabbed-block:nth-child(4){order:4}.md-typeset .tabbed-block:nth-child(5){order:5}.md-typeset .tabbed-block:nth-child(6){order:6}.md-typeset .tabbed-block:nth-child(7){order:7}.md-typeset .tabbed-block:nth-child(8){order:8}.md-typeset .tabbed-block:nth-child(9){order:9}.md-typeset .tabbed-block:nth-child(10){order:10}.md-typeset .tabbed-block:nth-child(11){order:11}.md-typeset .tabbed-block:nth-child(12){order:12}.md-typeset .tabbed-block:nth-child(13){order:13}.md-typeset .tabbed-block:nth-child(14){order:14}.md-typeset .tabbed-block:nth-child(15){order:15}.md-typeset .tabbed-block:nth-child(16){order:16}.md-typeset .tabbed-block:nth-child(17){order:17}.md-typeset .tabbed-block:nth-child(18){order:18}.md-typeset .tabbed-block:nth-child(19){order:19}.md-typeset .tabbed-block:nth-child(20){order:20}}.md-typeset .tabbed-block>.highlight:first-child>pre,.md-typeset .tabbed-block>pre:first-child{margin:0}.md-typeset .tabbed-block>.highlight:first-child>pre>code,.md-typeset .tabbed-block>pre:first-child>code{border-top-left-radius:0;border-top-right-radius:0}.md-typeset .tabbed-block>.highlight:first-child>.filename{border-top-left-radius:0;border-top-right-radius:0;margin:0}.md-typeset .tabbed-block>.highlight:first-child>.highlighttable{margin:0}.md-typeset .tabbed-block>.highlight:first-child>.highlighttable>tbody>tr>.filename span.filename,.md-typeset .tabbed-block>.highlight:first-child>.highlighttable>tbody>tr>.linenos{border-top-left-radius:0;border-top-right-radius:0;margin:0}.md-typeset .tabbed-block>.highlight:first-child>.highlighttable>tbody>tr>.code>div>pre>code{border-top-left-radius:0;border-top-right-radius:0}.md-typeset .tabbed-block>.highlight:first-child+.result{margin-top:-.125em}.md-typeset .tabbed-block>.tabbed-set{margin:0}.md-typeset .tabbed-button{align-self:center;border-radius:100%;color:var(--md-default-fg-color--light);cursor:pointer;display:block;height:.9rem;margin-top:.1rem;pointer-events:auto;transition:background-color .25s;width:.9rem}.md-typeset .tabbed-button:hover{background-color:var(--md-accent-fg-color--transparent);color:var(--md-accent-fg-color)}.md-typeset .tabbed-button:after{background-color:currentcolor;content:"";display:block;height:100%;-webkit-mask-image:var(--md-tabbed-icon--prev);mask-image:var(--md-tabbed-icon--prev);-webkit-mask-position:center;mask-position:center;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;-webkit-mask-size:contain;mask-size:contain;transition:background-color .25s,transform .25s;width:100%}.md-typeset .tabbed-control{background:linear-gradient(to right,var(--md-default-bg-color) 60%,#0000);display:flex;height:1.9rem;justify-content:start;pointer-events:none;position:absolute;transition:opacity 125ms;width:1.2rem}[dir=rtl] .md-typeset .tabbed-control{transform:rotate(180deg)}.md-typeset .tabbed-control[hidden]{opacity:0}.md-typeset .tabbed-control--next{background:linear-gradient(to left,var(--md-default-bg-color) 60%,#0000);justify-content:end;right:0}.md-typeset .tabbed-control--next .tabbed-button:after{-webkit-mask-image:var(--md-tabbed-icon--next);mask-image:var(--md-tabbed-icon--next)}@media screen and (max-width:44.9375em){[dir=ltr] .md-content__inner>.tabbed-set .tabbed-labels{padding-left:.8rem}[dir=rtl] .md-content__inner>.tabbed-set .tabbed-labels{padding-right:.8rem}.md-content__inner>.tabbed-set .tabbed-labels{margin:0 -.8rem;max-width:100vw;scroll-padding-inline-start:.8rem}[dir=ltr] .md-content__inner>.tabbed-set .tabbed-labels:after{padding-right:.8rem}[dir=rtl] .md-content__inner>.tabbed-set .tabbed-labels:after{padding-left:.8rem}.md-content__inner>.tabbed-set .tabbed-labels:after{content:""}[dir=ltr] .md-content__inner>.tabbed-set .tabbed-labels~.tabbed-control--prev{padding-left:.8rem}[dir=rtl] .md-content__inner>.tabbed-set .tabbed-labels~.tabbed-control--prev{padding-right:.8rem}[dir=ltr] .md-content__inner>.tabbed-set .tabbed-labels~.tabbed-control--prev{margin-left:-.8rem}[dir=rtl] .md-content__inner>.tabbed-set .tabbed-labels~.tabbed-control--prev{margin-right:-.8rem}.md-content__inner>.tabbed-set .tabbed-labels~.tabbed-control--prev{width:2rem}[dir=ltr] .md-content__inner>.tabbed-set .tabbed-labels~.tabbed-control--next{padding-right:.8rem}[dir=rtl] .md-content__inner>.tabbed-set .tabbed-labels~.tabbed-control--next{padding-left:.8rem}[dir=ltr] .md-content__inner>.tabbed-set .tabbed-labels~.tabbed-control--next{margin-right:-.8rem}[dir=rtl] .md-content__inner>.tabbed-set .tabbed-labels~.tabbed-control--next{margin-left:-.8rem}.md-content__inner>.tabbed-set .tabbed-labels~.tabbed-control--next{width:2rem}}@media screen{.md-typeset .tabbed-set>input:first-child:checked~.tabbed-labels>:first-child,.md-typeset .tabbed-set>input:nth-child(10):checked~.tabbed-labels>:nth-child(10),.md-typeset .tabbed-set>input:nth-child(11):checked~.tabbed-labels>:nth-child(11),.md-typeset .tabbed-set>input:nth-child(12):checked~.tabbed-labels>:nth-child(12),.md-typeset .tabbed-set>input:nth-child(13):checked~.tabbed-labels>:nth-child(13),.md-typeset .tabbed-set>input:nth-child(14):checked~.tabbed-labels>:nth-child(14),.md-typeset .tabbed-set>input:nth-child(15):checked~.tabbed-labels>:nth-child(15),.md-typeset .tabbed-set>input:nth-child(16):checked~.tabbed-labels>:nth-child(16),.md-typeset .tabbed-set>input:nth-child(17):checked~.tabbed-labels>:nth-child(17),.md-typeset .tabbed-set>input:nth-child(18):checked~.tabbed-labels>:nth-child(18),.md-typeset .tabbed-set>input:nth-child(19):checked~.tabbed-labels>:nth-child(19),.md-typeset .tabbed-set>input:nth-child(2):checked~.tabbed-labels>:nth-child(2),.md-typeset .tabbed-set>input:nth-child(20):checked~.tabbed-labels>:nth-child(20),.md-typeset .tabbed-set>input:nth-child(3):checked~.tabbed-labels>:nth-child(3),.md-typeset .tabbed-set>input:nth-child(4):checked~.tabbed-labels>:nth-child(4),.md-typeset .tabbed-set>input:nth-child(5):checked~.tabbed-labels>:nth-child(5),.md-typeset .tabbed-set>input:nth-child(6):checked~.tabbed-labels>:nth-child(6),.md-typeset .tabbed-set>input:nth-child(7):checked~.tabbed-labels>:nth-child(7),.md-typeset .tabbed-set>input:nth-child(8):checked~.tabbed-labels>:nth-child(8),.md-typeset .tabbed-set>input:nth-child(9):checked~.tabbed-labels>:nth-child(9){color:var(--md-accent-fg-color)}.md-typeset .no-js .tabbed-set>input:first-child:checked~.tabbed-labels>:first-child,.md-typeset .no-js .tabbed-set>input:nth-child(10):checked~.tabbed-labels>:nth-child(10),.md-typeset .no-js .tabbed-set>input:nth-child(11):checked~.tabbed-labels>:nth-child(11),.md-typeset .no-js .tabbed-set>input:nth-child(12):checked~.tabbed-labels>:nth-child(12),.md-typeset .no-js .tabbed-set>input:nth-child(13):checked~.tabbed-labels>:nth-child(13),.md-typeset .no-js .tabbed-set>input:nth-child(14):checked~.tabbed-labels>:nth-child(14),.md-typeset .no-js .tabbed-set>input:nth-child(15):checked~.tabbed-labels>:nth-child(15),.md-typeset .no-js .tabbed-set>input:nth-child(16):checked~.tabbed-labels>:nth-child(16),.md-typeset .no-js .tabbed-set>input:nth-child(17):checked~.tabbed-labels>:nth-child(17),.md-typeset .no-js .tabbed-set>input:nth-child(18):checked~.tabbed-labels>:nth-child(18),.md-typeset .no-js .tabbed-set>input:nth-child(19):checked~.tabbed-labels>:nth-child(19),.md-typeset .no-js .tabbed-set>input:nth-child(2):checked~.tabbed-labels>:nth-child(2),.md-typeset .no-js .tabbed-set>input:nth-child(20):checked~.tabbed-labels>:nth-child(20),.md-typeset .no-js .tabbed-set>input:nth-child(3):checked~.tabbed-labels>:nth-child(3),.md-typeset .no-js .tabbed-set>input:nth-child(4):checked~.tabbed-labels>:nth-child(4),.md-typeset .no-js .tabbed-set>input:nth-child(5):checked~.tabbed-labels>:nth-child(5),.md-typeset .no-js .tabbed-set>input:nth-child(6):checked~.tabbed-labels>:nth-child(6),.md-typeset .no-js .tabbed-set>input:nth-child(7):checked~.tabbed-labels>:nth-child(7),.md-typeset .no-js .tabbed-set>input:nth-child(8):checked~.tabbed-labels>:nth-child(8),.md-typeset .no-js .tabbed-set>input:nth-child(9):checked~.tabbed-labels>:nth-child(9),.no-js .md-typeset .tabbed-set>input:first-child:checked~.tabbed-labels>:first-child,.no-js .md-typeset .tabbed-set>input:nth-child(10):checked~.tabbed-labels>:nth-child(10),.no-js .md-typeset .tabbed-set>input:nth-child(11):checked~.tabbed-labels>:nth-child(11),.no-js .md-typeset .tabbed-set>input:nth-child(12):checked~.tabbed-labels>:nth-child(12),.no-js .md-typeset .tabbed-set>input:nth-child(13):checked~.tabbed-labels>:nth-child(13),.no-js .md-typeset .tabbed-set>input:nth-child(14):checked~.tabbed-labels>:nth-child(14),.no-js .md-typeset .tabbed-set>input:nth-child(15):checked~.tabbed-labels>:nth-child(15),.no-js .md-typeset .tabbed-set>input:nth-child(16):checked~.tabbed-labels>:nth-child(16),.no-js .md-typeset .tabbed-set>input:nth-child(17):checked~.tabbed-labels>:nth-child(17),.no-js .md-typeset .tabbed-set>input:nth-child(18):checked~.tabbed-labels>:nth-child(18),.no-js .md-typeset .tabbed-set>input:nth-child(19):checked~.tabbed-labels>:nth-child(19),.no-js .md-typeset .tabbed-set>input:nth-child(2):checked~.tabbed-labels>:nth-child(2),.no-js .md-typeset .tabbed-set>input:nth-child(20):checked~.tabbed-labels>:nth-child(20),.no-js .md-typeset .tabbed-set>input:nth-child(3):checked~.tabbed-labels>:nth-child(3),.no-js .md-typeset .tabbed-set>input:nth-child(4):checked~.tabbed-labels>:nth-child(4),.no-js .md-typeset .tabbed-set>input:nth-child(5):checked~.tabbed-labels>:nth-child(5),.no-js .md-typeset .tabbed-set>input:nth-child(6):checked~.tabbed-labels>:nth-child(6),.no-js .md-typeset .tabbed-set>input:nth-child(7):checked~.tabbed-labels>:nth-child(7),.no-js .md-typeset .tabbed-set>input:nth-child(8):checked~.tabbed-labels>:nth-child(8),.no-js .md-typeset .tabbed-set>input:nth-child(9):checked~.tabbed-labels>:nth-child(9){border-color:var(--md-accent-fg-color)}}.md-typeset .tabbed-set>input:first-child.focus-visible~.tabbed-labels>:first-child,.md-typeset .tabbed-set>input:nth-child(10).focus-visible~.tabbed-labels>:nth-child(10),.md-typeset .tabbed-set>input:nth-child(11).focus-visible~.tabbed-labels>:nth-child(11),.md-typeset .tabbed-set>input:nth-child(12).focus-visible~.tabbed-labels>:nth-child(12),.md-typeset .tabbed-set>input:nth-child(13).focus-visible~.tabbed-labels>:nth-child(13),.md-typeset .tabbed-set>input:nth-child(14).focus-visible~.tabbed-labels>:nth-child(14),.md-typeset .tabbed-set>input:nth-child(15).focus-visible~.tabbed-labels>:nth-child(15),.md-typeset .tabbed-set>input:nth-child(16).focus-visible~.tabbed-labels>:nth-child(16),.md-typeset .tabbed-set>input:nth-child(17).focus-visible~.tabbed-labels>:nth-child(17),.md-typeset .tabbed-set>input:nth-child(18).focus-visible~.tabbed-labels>:nth-child(18),.md-typeset .tabbed-set>input:nth-child(19).focus-visible~.tabbed-labels>:nth-child(19),.md-typeset .tabbed-set>input:nth-child(2).focus-visible~.tabbed-labels>:nth-child(2),.md-typeset .tabbed-set>input:nth-child(20).focus-visible~.tabbed-labels>:nth-child(20),.md-typeset .tabbed-set>input:nth-child(3).focus-visible~.tabbed-labels>:nth-child(3),.md-typeset .tabbed-set>input:nth-child(4).focus-visible~.tabbed-labels>:nth-child(4),.md-typeset .tabbed-set>input:nth-child(5).focus-visible~.tabbed-labels>:nth-child(5),.md-typeset .tabbed-set>input:nth-child(6).focus-visible~.tabbed-labels>:nth-child(6),.md-typeset .tabbed-set>input:nth-child(7).focus-visible~.tabbed-labels>:nth-child(7),.md-typeset .tabbed-set>input:nth-child(8).focus-visible~.tabbed-labels>:nth-child(8),.md-typeset .tabbed-set>input:nth-child(9).focus-visible~.tabbed-labels>:nth-child(9){background-color:var(--md-accent-fg-color--transparent)}.md-typeset .tabbed-set>input:first-child:checked~.tabbed-content>:first-child,.md-typeset .tabbed-set>input:nth-child(10):checked~.tabbed-content>:nth-child(10),.md-typeset .tabbed-set>input:nth-child(11):checked~.tabbed-content>:nth-child(11),.md-typeset .tabbed-set>input:nth-child(12):checked~.tabbed-content>:nth-child(12),.md-typeset .tabbed-set>input:nth-child(13):checked~.tabbed-content>:nth-child(13),.md-typeset .tabbed-set>input:nth-child(14):checked~.tabbed-content>:nth-child(14),.md-typeset .tabbed-set>input:nth-child(15):checked~.tabbed-content>:nth-child(15),.md-typeset .tabbed-set>input:nth-child(16):checked~.tabbed-content>:nth-child(16),.md-typeset .tabbed-set>input:nth-child(17):checked~.tabbed-content>:nth-child(17),.md-typeset .tabbed-set>input:nth-child(18):checked~.tabbed-content>:nth-child(18),.md-typeset .tabbed-set>input:nth-child(19):checked~.tabbed-content>:nth-child(19),.md-typeset .tabbed-set>input:nth-child(2):checked~.tabbed-content>:nth-child(2),.md-typeset .tabbed-set>input:nth-child(20):checked~.tabbed-content>:nth-child(20),.md-typeset .tabbed-set>input:nth-child(3):checked~.tabbed-content>:nth-child(3),.md-typeset .tabbed-set>input:nth-child(4):checked~.tabbed-content>:nth-child(4),.md-typeset .tabbed-set>input:nth-child(5):checked~.tabbed-content>:nth-child(5),.md-typeset .tabbed-set>input:nth-child(6):checked~.tabbed-content>:nth-child(6),.md-typeset .tabbed-set>input:nth-child(7):checked~.tabbed-content>:nth-child(7),.md-typeset .tabbed-set>input:nth-child(8):checked~.tabbed-content>:nth-child(8),.md-typeset .tabbed-set>input:nth-child(9):checked~.tabbed-content>:nth-child(9){display:block}:root{--md-tasklist-icon:url('data:image/svg+xml;charset=utf-8,');--md-tasklist-icon--checked:url('data:image/svg+xml;charset=utf-8,')}.md-typeset .task-list-item{list-style-type:none;position:relative}[dir=ltr] .md-typeset .task-list-item [type=checkbox]{left:-2em}[dir=rtl] .md-typeset .task-list-item [type=checkbox]{right:-2em}.md-typeset .task-list-item [type=checkbox]{position:absolute;top:.45em}.md-typeset .task-list-control [type=checkbox]{opacity:0;z-index:-1}[dir=ltr] .md-typeset .task-list-indicator:before{left:-1.5em}[dir=rtl] .md-typeset .task-list-indicator:before{right:-1.5em}.md-typeset .task-list-indicator:before{background-color:var(--md-default-fg-color--lightest);content:"";height:1.25em;-webkit-mask-image:var(--md-tasklist-icon);mask-image:var(--md-tasklist-icon);-webkit-mask-position:center;mask-position:center;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;-webkit-mask-size:contain;mask-size:contain;position:absolute;top:.15em;width:1.25em}.md-typeset [type=checkbox]:checked+.task-list-indicator:before{background-color:#00e676;-webkit-mask-image:var(--md-tasklist-icon--checked);mask-image:var(--md-tasklist-icon--checked)}:root>*{--md-mermaid-font-family:var(--md-text-font-family),sans-serif;--md-mermaid-edge-color:var(--md-code-fg-color);--md-mermaid-node-bg-color:var(--md-accent-fg-color--transparent);--md-mermaid-node-fg-color:var(--md-accent-fg-color);--md-mermaid-label-bg-color:var(--md-default-bg-color);--md-mermaid-label-fg-color:var(--md-code-fg-color);--md-mermaid-sequence-actor-bg-color:var(--md-mermaid-label-bg-color);--md-mermaid-sequence-actor-fg-color:var(--md-mermaid-label-fg-color);--md-mermaid-sequence-actor-border-color:var(--md-mermaid-node-fg-color);--md-mermaid-sequence-actor-line-color:var(--md-default-fg-color--lighter);--md-mermaid-sequence-actorman-bg-color:var(--md-mermaid-label-bg-color);--md-mermaid-sequence-actorman-line-color:var(--md-mermaid-node-fg-color);--md-mermaid-sequence-box-bg-color:var(--md-mermaid-node-bg-color);--md-mermaid-sequence-box-fg-color:var(--md-mermaid-edge-color);--md-mermaid-sequence-label-bg-color:var(--md-mermaid-node-bg-color);--md-mermaid-sequence-label-fg-color:var(--md-mermaid-node-fg-color);--md-mermaid-sequence-loop-bg-color:var(--md-mermaid-node-bg-color);--md-mermaid-sequence-loop-fg-color:var(--md-mermaid-edge-color);--md-mermaid-sequence-loop-border-color:var(--md-mermaid-node-fg-color);--md-mermaid-sequence-message-fg-color:var(--md-mermaid-edge-color);--md-mermaid-sequence-message-line-color:var(--md-mermaid-edge-color);--md-mermaid-sequence-note-bg-color:var(--md-mermaid-label-bg-color);--md-mermaid-sequence-note-fg-color:var(--md-mermaid-edge-color);--md-mermaid-sequence-note-border-color:var(--md-mermaid-label-fg-color);--md-mermaid-sequence-number-bg-color:var(--md-mermaid-node-fg-color);--md-mermaid-sequence-number-fg-color:var(--md-accent-bg-color)}.mermaid{line-height:normal;margin:1em 0}.md-typeset .grid{grid-gap:.4rem;display:grid;grid-template-columns:repeat(auto-fit,minmax(16rem,1fr));margin:1em 0}.md-typeset .grid.cards>ol,.md-typeset .grid.cards>ul{display:contents}.md-typeset .grid.cards>ol>li,.md-typeset .grid.cards>ul>li,.md-typeset .grid>.card{border:.05rem solid var(--md-default-fg-color--lightest);border-radius:.1rem;display:block;margin:0;padding:.8rem;transition:border .25s,box-shadow .25s}.md-typeset .grid.cards>ol>li:focus-within,.md-typeset .grid.cards>ol>li:hover,.md-typeset .grid.cards>ul>li:focus-within,.md-typeset .grid.cards>ul>li:hover,.md-typeset .grid>.card:focus-within,.md-typeset .grid>.card:hover{border-color:#0000;box-shadow:var(--md-shadow-z2)}.md-typeset .grid.cards>ol>li>hr,.md-typeset .grid.cards>ul>li>hr,.md-typeset .grid>.card>hr{margin-bottom:1em;margin-top:1em}.md-typeset .grid.cards>ol>li>:first-child,.md-typeset .grid.cards>ul>li>:first-child,.md-typeset .grid>.card>:first-child{margin-top:0}.md-typeset .grid.cards>ol>li>:last-child,.md-typeset .grid.cards>ul>li>:last-child,.md-typeset .grid>.card>:last-child{margin-bottom:0}.md-typeset .grid>*,.md-typeset .grid>.admonition,.md-typeset .grid>.highlight>*,.md-typeset .grid>.highlighttable,.md-typeset .grid>.md-typeset details,.md-typeset .grid>details,.md-typeset .grid>pre{margin-bottom:0;margin-top:0}.md-typeset .grid>.highlight>pre:only-child,.md-typeset .grid>.highlight>pre>code,.md-typeset .grid>.highlighttable,.md-typeset .grid>.highlighttable>tbody,.md-typeset .grid>.highlighttable>tbody>tr,.md-typeset .grid>.highlighttable>tbody>tr>.code,.md-typeset .grid>.highlighttable>tbody>tr>.code>.highlight,.md-typeset .grid>.highlighttable>tbody>tr>.code>.highlight>pre,.md-typeset .grid>.highlighttable>tbody>tr>.code>.highlight>pre>code{height:100%}.md-typeset .grid>.tabbed-set{margin-bottom:0;margin-top:0}@media screen and (min-width:45em){[dir=ltr] .md-typeset .inline{float:left}[dir=rtl] .md-typeset .inline{float:right}[dir=ltr] .md-typeset .inline{margin-right:.8rem}[dir=rtl] .md-typeset .inline{margin-left:.8rem}.md-typeset .inline{margin-bottom:.8rem;margin-top:0;width:11.7rem}[dir=ltr] .md-typeset .inline.end{float:right}[dir=rtl] .md-typeset .inline.end{float:left}[dir=ltr] .md-typeset .inline.end{margin-left:.8rem;margin-right:0}[dir=rtl] .md-typeset .inline.end{margin-left:0;margin-right:.8rem}} \ No newline at end of file diff --git a/docs/assets/stylesheets/palette.da3f46a0.min.css b/docs/assets/stylesheets/palette.da3f46a0.min.css new file mode 100644 index 000000000..0c978e487 --- /dev/null +++ b/docs/assets/stylesheets/palette.da3f46a0.min.css @@ -0,0 +1 @@ +@media screen{[data-md-color-scheme=slate]{--md-hue:232;--md-default-fg-color:hsla(var(--md-hue),75%,95%,1);--md-default-fg-color--light:hsla(var(--md-hue),75%,90%,0.62);--md-default-fg-color--lighter:hsla(var(--md-hue),75%,90%,0.32);--md-default-fg-color--lightest:hsla(var(--md-hue),75%,90%,0.12);--md-default-bg-color:hsla(var(--md-hue),15%,21%,1);--md-default-bg-color--light:hsla(var(--md-hue),15%,21%,0.54);--md-default-bg-color--lighter:hsla(var(--md-hue),15%,21%,0.26);--md-default-bg-color--lightest:hsla(var(--md-hue),15%,21%,0.07);--md-code-fg-color:hsla(var(--md-hue),18%,86%,1);--md-code-bg-color:hsla(var(--md-hue),15%,15%,1);--md-code-bg-color--light:hsla(var(--md-hue),15%,15%,0.9);--md-code-bg-color--lighter:hsla(var(--md-hue),15%,15%,0.54);--md-code-hl-color:#2977ff;--md-code-hl-color--light:#2977ff1a;--md-code-hl-number-color:#e6695b;--md-code-hl-special-color:#f06090;--md-code-hl-function-color:#c973d9;--md-code-hl-constant-color:#9383e2;--md-code-hl-keyword-color:#6791e0;--md-code-hl-string-color:#2fb170;--md-code-hl-name-color:var(--md-code-fg-color);--md-code-hl-operator-color:var(--md-default-fg-color--light);--md-code-hl-punctuation-color:var(--md-default-fg-color--light);--md-code-hl-comment-color:var(--md-default-fg-color--light);--md-code-hl-generic-color:var(--md-default-fg-color--light);--md-code-hl-variable-color:var(--md-default-fg-color--light);--md-typeset-color:var(--md-default-fg-color);--md-typeset-a-color:var(--md-primary-fg-color);--md-typeset-mark-color:#4287ff4d;--md-typeset-kbd-color:hsla(var(--md-hue),15%,94%,0.12);--md-typeset-kbd-accent-color:hsla(var(--md-hue),15%,94%,0.2);--md-typeset-kbd-border-color:hsla(var(--md-hue),15%,14%,1);--md-typeset-table-color:hsla(var(--md-hue),75%,95%,0.12);--md-typeset-table-color--light:hsla(var(--md-hue),75%,95%,0.035);--md-admonition-fg-color:var(--md-default-fg-color);--md-admonition-bg-color:var(--md-default-bg-color);--md-footer-bg-color:hsla(var(--md-hue),15%,12%,0.87);--md-footer-bg-color--dark:hsla(var(--md-hue),15%,10%,1);--md-shadow-z1:0 0.2rem 0.5rem #0003,0 0 0.05rem #0000001a;--md-shadow-z2:0 0.2rem 0.5rem #0000004d,0 0 0.05rem #00000040;--md-shadow-z3:0 0.2rem 0.5rem #0006,0 0 0.05rem #00000059;color-scheme:dark}[data-md-color-scheme=slate] img[src$="#gh-light-mode-only"],[data-md-color-scheme=slate] img[src$="#only-light"]{display:none}[data-md-color-scheme=slate][data-md-color-primary=pink]{--md-typeset-a-color:#ed5487}[data-md-color-scheme=slate][data-md-color-primary=purple]{--md-typeset-a-color:#bd78c9}[data-md-color-scheme=slate][data-md-color-primary=deep-purple]{--md-typeset-a-color:#a682e3}[data-md-color-scheme=slate][data-md-color-primary=indigo]{--md-typeset-a-color:#739ae2}[data-md-color-scheme=slate][data-md-color-primary=teal]{--md-typeset-a-color:#00ccb8}[data-md-color-scheme=slate][data-md-color-primary=green]{--md-typeset-a-color:#71c174}[data-md-color-scheme=slate][data-md-color-primary=deep-orange]{--md-typeset-a-color:#ff9575}[data-md-color-scheme=slate][data-md-color-primary=brown]{--md-typeset-a-color:#c7846b}[data-md-color-scheme=slate][data-md-color-primary=black],[data-md-color-scheme=slate][data-md-color-primary=blue-grey],[data-md-color-scheme=slate][data-md-color-primary=grey],[data-md-color-scheme=slate][data-md-color-primary=white]{--md-typeset-a-color:#6c91d5}[data-md-color-switching] *,[data-md-color-switching] :after,[data-md-color-switching] :before{transition-duration:0ms!important}}[data-md-color-accent=red]{--md-accent-fg-color:#ff1947;--md-accent-fg-color--transparent:#ff19471a;--md-accent-bg-color:#fff;--md-accent-bg-color--light:#ffffffb3}[data-md-color-accent=pink]{--md-accent-fg-color:#f50056;--md-accent-fg-color--transparent:#f500561a;--md-accent-bg-color:#fff;--md-accent-bg-color--light:#ffffffb3}[data-md-color-accent=purple]{--md-accent-fg-color:#df41fb;--md-accent-fg-color--transparent:#df41fb1a;--md-accent-bg-color:#fff;--md-accent-bg-color--light:#ffffffb3}[data-md-color-accent=deep-purple]{--md-accent-fg-color:#7c4dff;--md-accent-fg-color--transparent:#7c4dff1a;--md-accent-bg-color:#fff;--md-accent-bg-color--light:#ffffffb3}[data-md-color-accent=indigo]{--md-accent-fg-color:#526cfe;--md-accent-fg-color--transparent:#526cfe1a;--md-accent-bg-color:#fff;--md-accent-bg-color--light:#ffffffb3}[data-md-color-accent=blue]{--md-accent-fg-color:#4287ff;--md-accent-fg-color--transparent:#4287ff1a;--md-accent-bg-color:#fff;--md-accent-bg-color--light:#ffffffb3}[data-md-color-accent=light-blue]{--md-accent-fg-color:#0091eb;--md-accent-fg-color--transparent:#0091eb1a;--md-accent-bg-color:#fff;--md-accent-bg-color--light:#ffffffb3}[data-md-color-accent=cyan]{--md-accent-fg-color:#00bad6;--md-accent-fg-color--transparent:#00bad61a;--md-accent-bg-color:#fff;--md-accent-bg-color--light:#ffffffb3}[data-md-color-accent=teal]{--md-accent-fg-color:#00bda4;--md-accent-fg-color--transparent:#00bda41a;--md-accent-bg-color:#fff;--md-accent-bg-color--light:#ffffffb3}[data-md-color-accent=green]{--md-accent-fg-color:#00c753;--md-accent-fg-color--transparent:#00c7531a;--md-accent-bg-color:#fff;--md-accent-bg-color--light:#ffffffb3}[data-md-color-accent=light-green]{--md-accent-fg-color:#63de17;--md-accent-fg-color--transparent:#63de171a;--md-accent-bg-color:#fff;--md-accent-bg-color--light:#ffffffb3}[data-md-color-accent=lime]{--md-accent-fg-color:#b0eb00;--md-accent-fg-color--transparent:#b0eb001a;--md-accent-bg-color:#000000de;--md-accent-bg-color--light:#0000008a}[data-md-color-accent=yellow]{--md-accent-fg-color:#ffd500;--md-accent-fg-color--transparent:#ffd5001a;--md-accent-bg-color:#000000de;--md-accent-bg-color--light:#0000008a}[data-md-color-accent=amber]{--md-accent-fg-color:#fa0;--md-accent-fg-color--transparent:#ffaa001a;--md-accent-bg-color:#000000de;--md-accent-bg-color--light:#0000008a}[data-md-color-accent=orange]{--md-accent-fg-color:#ff9100;--md-accent-fg-color--transparent:#ff91001a;--md-accent-bg-color:#000000de;--md-accent-bg-color--light:#0000008a}[data-md-color-accent=deep-orange]{--md-accent-fg-color:#ff6e42;--md-accent-fg-color--transparent:#ff6e421a;--md-accent-bg-color:#fff;--md-accent-bg-color--light:#ffffffb3}[data-md-color-primary=red]{--md-primary-fg-color:#ef5552;--md-primary-fg-color--light:#e57171;--md-primary-fg-color--dark:#e53734;--md-primary-bg-color:#fff;--md-primary-bg-color--light:#ffffffb3}[data-md-color-primary=pink]{--md-primary-fg-color:#e92063;--md-primary-fg-color--light:#ec417a;--md-primary-fg-color--dark:#c3185d;--md-primary-bg-color:#fff;--md-primary-bg-color--light:#ffffffb3}[data-md-color-primary=purple]{--md-primary-fg-color:#ab47bd;--md-primary-fg-color--light:#bb69c9;--md-primary-fg-color--dark:#8c24a8;--md-primary-bg-color:#fff;--md-primary-bg-color--light:#ffffffb3}[data-md-color-primary=deep-purple]{--md-primary-fg-color:#7e56c2;--md-primary-fg-color--light:#9574cd;--md-primary-fg-color--dark:#673ab6;--md-primary-bg-color:#fff;--md-primary-bg-color--light:#ffffffb3}[data-md-color-primary=indigo]{--md-primary-fg-color:#4051b5;--md-primary-fg-color--light:#5d6cc0;--md-primary-fg-color--dark:#303fa1;--md-primary-bg-color:#fff;--md-primary-bg-color--light:#ffffffb3}[data-md-color-primary=blue]{--md-primary-fg-color:#2094f3;--md-primary-fg-color--light:#42a5f5;--md-primary-fg-color--dark:#1975d2;--md-primary-bg-color:#fff;--md-primary-bg-color--light:#ffffffb3}[data-md-color-primary=light-blue]{--md-primary-fg-color:#02a6f2;--md-primary-fg-color--light:#28b5f6;--md-primary-fg-color--dark:#0287cf;--md-primary-bg-color:#fff;--md-primary-bg-color--light:#ffffffb3}[data-md-color-primary=cyan]{--md-primary-fg-color:#00bdd6;--md-primary-fg-color--light:#25c5da;--md-primary-fg-color--dark:#0097a8;--md-primary-bg-color:#fff;--md-primary-bg-color--light:#ffffffb3}[data-md-color-primary=teal]{--md-primary-fg-color:#009485;--md-primary-fg-color--light:#26a699;--md-primary-fg-color--dark:#007a6c;--md-primary-bg-color:#fff;--md-primary-bg-color--light:#ffffffb3}[data-md-color-primary=green]{--md-primary-fg-color:#4cae4f;--md-primary-fg-color--light:#68bb6c;--md-primary-fg-color--dark:#398e3d;--md-primary-bg-color:#fff;--md-primary-bg-color--light:#ffffffb3}[data-md-color-primary=light-green]{--md-primary-fg-color:#8bc34b;--md-primary-fg-color--light:#9ccc66;--md-primary-fg-color--dark:#689f38;--md-primary-bg-color:#fff;--md-primary-bg-color--light:#ffffffb3}[data-md-color-primary=lime]{--md-primary-fg-color:#cbdc38;--md-primary-fg-color--light:#d3e156;--md-primary-fg-color--dark:#b0b52c;--md-primary-bg-color:#000000de;--md-primary-bg-color--light:#0000008a}[data-md-color-primary=yellow]{--md-primary-fg-color:#ffec3d;--md-primary-fg-color--light:#ffee57;--md-primary-fg-color--dark:#fbc02d;--md-primary-bg-color:#000000de;--md-primary-bg-color--light:#0000008a}[data-md-color-primary=amber]{--md-primary-fg-color:#ffc105;--md-primary-fg-color--light:#ffc929;--md-primary-fg-color--dark:#ffa200;--md-primary-bg-color:#000000de;--md-primary-bg-color--light:#0000008a}[data-md-color-primary=orange]{--md-primary-fg-color:#ffa724;--md-primary-fg-color--light:#ffa724;--md-primary-fg-color--dark:#fa8900;--md-primary-bg-color:#000000de;--md-primary-bg-color--light:#0000008a}[data-md-color-primary=deep-orange]{--md-primary-fg-color:#ff6e42;--md-primary-fg-color--light:#ff8a66;--md-primary-fg-color--dark:#f4511f;--md-primary-bg-color:#fff;--md-primary-bg-color--light:#ffffffb3}[data-md-color-primary=brown]{--md-primary-fg-color:#795649;--md-primary-fg-color--light:#8d6e62;--md-primary-fg-color--dark:#5d4037;--md-primary-bg-color:#fff;--md-primary-bg-color--light:#ffffffb3}[data-md-color-primary=grey]{--md-primary-fg-color:#757575;--md-primary-fg-color--light:#9e9e9e;--md-primary-fg-color--dark:#616161;--md-primary-bg-color:#fff;--md-primary-bg-color--light:#ffffffb3;--md-typeset-a-color:#4051b5}[data-md-color-primary=blue-grey]{--md-primary-fg-color:#546d78;--md-primary-fg-color--light:#607c8a;--md-primary-fg-color--dark:#455a63;--md-primary-bg-color:#fff;--md-primary-bg-color--light:#ffffffb3;--md-typeset-a-color:#4051b5}[data-md-color-primary=light-green]:not([data-md-color-scheme=slate]){--md-typeset-a-color:#72ad2e}[data-md-color-primary=lime]:not([data-md-color-scheme=slate]){--md-typeset-a-color:#8b990a}[data-md-color-primary=yellow]:not([data-md-color-scheme=slate]){--md-typeset-a-color:#b8a500}[data-md-color-primary=amber]:not([data-md-color-scheme=slate]){--md-typeset-a-color:#d19d00}[data-md-color-primary=orange]:not([data-md-color-scheme=slate]){--md-typeset-a-color:#e68a00}[data-md-color-primary=white]{--md-primary-fg-color:#fff;--md-primary-fg-color--light:#ffffffb3;--md-primary-fg-color--dark:#00000012;--md-primary-bg-color:#000000de;--md-primary-bg-color--light:#0000008a;--md-typeset-a-color:#4051b5}[data-md-color-primary=white] .md-button{color:var(--md-typeset-a-color)}[data-md-color-primary=white] .md-button--primary{background-color:var(--md-typeset-a-color);border-color:var(--md-typeset-a-color);color:#fff}@media screen and (min-width:60em){[data-md-color-primary=white] .md-search__form{background-color:#00000012}[data-md-color-primary=white] .md-search__form:hover{background-color:#00000052}[data-md-color-primary=white] .md-search__input+.md-search__icon{color:#000000de}}@media screen and (min-width:76.25em){[data-md-color-primary=white] .md-tabs{border-bottom:.05rem solid #00000012}}[data-md-color-primary=black]{--md-primary-fg-color:#000;--md-primary-fg-color--light:#0000008a;--md-primary-fg-color--dark:#000;--md-primary-bg-color:#fff;--md-primary-bg-color--light:#ffffffb3;--md-typeset-a-color:#4051b5}[data-md-color-primary=black] .md-button{color:var(--md-typeset-a-color)}[data-md-color-primary=black] .md-button--primary{background-color:var(--md-typeset-a-color);border-color:var(--md-typeset-a-color);color:#fff}[data-md-color-primary=black] .md-header{background-color:#000}@media screen and (max-width:59.9375em){[data-md-color-primary=black] .md-nav__source{background-color:#000000de}}@media screen and (min-width:60em){[data-md-color-primary=black] .md-search__form{background-color:#ffffff1f}[data-md-color-primary=black] .md-search__form:hover{background-color:#ffffff4d}}@media screen and (max-width:76.1875em){html [data-md-color-primary=black] .md-nav--primary .md-nav__title[for=__drawer]{background-color:#000}}@media screen and (min-width:76.25em){[data-md-color-primary=black] .md-tabs{background-color:#000}} \ No newline at end of file diff --git a/docs/commands/index.html b/docs/commands/index.html new file mode 100644 index 000000000..52c54019d --- /dev/null +++ b/docs/commands/index.html @@ -0,0 +1,2310 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + Commands - wp-browser docs + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + +
+ + +
+ +
+ + + + + + +
+
+ + + +
+
+
+ + + + + +
+
+
+ + + + + + + +
+ +
+ + + + + + + +

Commands

+ +

Codeception commands provided by the library

+

The library provides some custom commands that can be added to the project Codeception configuration file ( +either codeception.yml or codeception.dist.yml).

+

run and codeception:run

+

WordPress extensive use of global variables, constants and side effectes makes it difficult to run multiple test suites +in the same process without running into conflicts due to leaking state and side effects. +For this reason the project replaces Codeception run command with one that will run each suite in a separate process. +You can invoke the original Codeception command using the codeception:run command. +Just like the original, the run command accepts all the arguments and options of the original Codeception +command.

+

Run all the suites, each one in a separate process:

+
vendor/bin/codecept run
+
+

Run only the Integration suite:

+
vendor/bin/codecept run Integration
+
+

Run a specific test file:

+
vendor/bin/codecept run Integration tests/Integration/MyTest.php
+
+

Run a specific test method:

+
vendor/bin/codecept run Integration tests/Integration/MyTest.php:testMyMethod
+
+

Read the Codeception documentation for more information about the run command.

+

dev:start

+

If not already running, start the services required to run the tests. +The started services are read from the Codeception configuration file (either codeception.yml +or codeception.dist.yml), from the extensions section, under the config key.

+

Given the following configuration:

+
extensions:
+  enabled:
+    - lucatume\WPBrowser\Extension\ChromeDriverController
+    - lucatume\WPBrowser\Extension\BuiltInServerController
+    - lucatume\WPBrowser\Extension\DockerComposeController
+  config:
+    lucatume\WPBrowser\Extension\ChromeDriverController:
+      port: '%CHROMEDRIVER_PORT%'
+    lucatume\WPBrowser\Extension\BuiltInServerController:
+      docRoot: '%WORDPRESS_ROOT_DIR%'
+      workers: 5
+      port: '%BUILT_IN_SERVER_PORT%'
+    lucatume\WPBrowser\Extension\DockerComposeController:
+      compose-file: 'tests/docker-compose.yml'
+      env-file: 'tests/.env'
+
+

Running the command will start ChromeDriver, the built-in PHP server and Docker Compose.

+

dev:stop

+

If running, stop the services required to run the tests. +The stopped services are read from the Codeception configuration file (either codeception.yml +or codeception.dist.yml), from the extensions section, under the config key.

+

Given the following configuration:

+
extensions:
+  enabled:
+    - lucatume\WPBrowser\Extension\ChromeDriverController
+    - lucatume\WPBrowser\Extension\BuiltInServerController
+    - lucatume\WPBrowser\Extension\DockerComposeController
+  config:
+    lucatume\WPBrowser\Extension\ChromeDriverController:
+      port: '%CHROMEDRIVER_PORT%'
+    lucatume\WPBrowser\Extension\BuiltInServerController:
+      docRoot: '%WORDPRESS_ROOT_DIR%'
+      workers: 5
+      port: '%BUILT_IN_SERVER_PORT%'
+    lucatume\WPBrowser\Extension\DockerComposeController:
+      compose-file: 'tests/docker-compose.yml'
+      env-file: 'tests/.env'
+
+

Running the command will stop ChromeDriver, the built-in PHP server and Docker Compose.

+

dev:restart

+

This command is just a shortcut to run dev:stop and dev:start in sequence.

+

dev:info

+

Provides information about the local testing stack managed by +the DockerComposeController, BuiltInServerController +and ChromeDriverController extensions.

+

wp:db:import

+

You can use WP CLI to interact with your WordPress installation, but WP CLI does not support SQLite databases in +the context of the wp db import command. +This command fills that gap by providing a database dump file import command that will support MySQL and SQLite +databases.

+

wp:db:export

+

You can use WP CLI to interact with your WordPress installation, but WP CLI does not support SQLite databases in +the context of the wp db export command. +This command fills that gap by providing a database dump file export command that will support MySQL and SQLite +databases.

+

chromedriver:update

+

If you're using Chromedriver as a binary installed in the Composer vendor directory (vendor/bin by default), you can +use this command to update it. +This command will download the latest version of Chromedriver compatible with the Chrome version installed on your +machine in the Composer vendor directory.

+

generate:wpunit

+

Generate a test case extending the lucatume\WPBrowser\TestCase\WPTestCase class. +The class incorporates the WordPress test case from the wordpress-develop repository and adds some utility +methods to make testing easier in the context of Codeception.

+

The lucatume\WPBrowser\TestCase\WPTestCase class is the one that should be used when writing tests for WordPress +code when using the WPLoader module.

+

Together with the WPLoader module, the WPTestCase class provides a number of functionalities to clean up the +database +after each test method and to reset the global state of WordPress.

+

Every test method runs in a transaction

+

Database queries running in the context of test methods of a test case extending the WPTestCase class will run in a +transaction that is rolled back after the test method is run. This means that any database change happening in the +context of a test method will not appear in the database while the test is running and after the test is run.

+ + + + + + + +
+
+ + + +
+ + + +
+ + + +
+
+
+
+ + + + + + + + + \ No newline at end of file diff --git a/docs/custom-configuration/index.html b/docs/custom-configuration/index.html new file mode 100644 index 000000000..9d24b231b --- /dev/null +++ b/docs/custom-configuration/index.html @@ -0,0 +1,2268 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Custom configuration - wp-browser docs + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + +
+ + +
+ +
+ + + + + + +
+
+ + + +
+
+
+ + + + + +
+
+
+ + + + + + + +
+ +
+ + + + + + + +

Custom configuration

+ +

Custom testing configuration

+

Any non default configuration is considered a custom configuration.
+If your project requires a tailored set up, this is the configuration for you.

+

Using a custom configuration to run tests

+

If you decide to skip the default configuration, or are working +on a project that cannot use the default configuration +you will be able to set up wp-browser to suit your needs using a custom configuration.

+

Choose "no", to not use the default configuration, when running the vendor/bin/codecept init wpbrowser command.

+

The command will set up the file structure to be able to run integration and end-to-end tests and will +leverage Codeception dynamic configuration using parameters to control the testing stack using the tests/.env +file.

+

Walkthrough of the tests/.env file

+
    +
  • WORDPRESS_ROOT_DIR - the path to the root WordPress installation directory. This is the directory that contains + WordPress files, like wp-load.php. This path can be absolute or relative to the root project directory; + e.g. vendor/wordpress (relative) or /var/www/wordpress (absolute) will work.
  • +
  • WORDPRESS_URL - the URL of the WordPress installation. This is the URL that will be used by the browser to access + the WordPress + installation in the context of end-to-end tests; e.g. http://localhost:8080 or https://wordpress.local.
  • +
  • WORDPRESS_DOMAIN - the domain of the WordPress installation; this value should follow the WORDPRESS_URL value. + E.g. if WORDPRESS_URL is http://localhost:8080 the WORDPRESS_DOMAIN value should be localhost:8080; + if WORDPRESS_URL is https://wordpress.local the WORDPRESS_DOMAIN value should be wordpress.local.
  • +
  • WORDPRESS_DB_URL - the user, password, host, and name of the database used by the tests. If the database is a MySQL + database, the value should be in the form mysql://user:password@host:port/database_name. + If the database is a SQLite database, the value should be in the form sqlite://path/to/database/file.
  • +
  • WORDPRESS_TABLE_PREFIX - the database table prefix used by the WordPress installation, the one served + at WORDPRESS_URL. + This value is usually wp_ but can be different if the WordPress installation has been configured to use a different + prefix.
  • +
  • TEST_TABLE_PREFIX - the database table prefix used by the WPLoader module to + install WordPress and run the tests. This value is usually test_ and should be different from + the WORDPRESS_TABLE_PREFIX value.
  • +
  • WORDPRESS_ADMIN_USER - the username of the WordPress administrator user. E.g. admin.
  • +
  • WORDPRESS_ADMIN_PASSWORD - the password of the WordPress administrator user. E.g. secret!password.
  • +
  • CHROMEDRIVER_HOST - the host of the Chromedriver server. This value is usually localhost if you're running + Chromedriver on the same machine as the tests. If you're running your tests using a container stack, it will be the + name of the container running Chromedriver, e.g. chromedriver.
  • +
  • CHROMEDRIVER_PORT - the port of the Chromedriver server. This value is usually 9515 if you're running Chromedriver + on the same machine as the tests. If you're running your tests using a container stack, it will be the port exposed by + the container running Chromedriver, e.g. 4444. Note the default configuration will set + this value to a random port during set up to avoid conflicts with other services running on the same machine.
  • +
+

Handling custom file structures

+

If your site uses a customized file structure to manage WordPress, you will need to further +configure the WPLoader module to correctly look for the site content. +Read more about setting up WPLoader to correctly load plugins and themes from custom locations here.

+ + + + + + + +
+
+ + + +
+ + + +
+ + + +
+
+
+
+ + + + + + + + + \ No newline at end of file diff --git a/docs/default-configuration/index.html b/docs/default-configuration/index.html new file mode 100644 index 000000000..3d921cbe8 --- /dev/null +++ b/docs/default-configuration/index.html @@ -0,0 +1,2374 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Default configuration - wp-browser docs + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + +
+ + +
+ +
+ + + + + + +
+
+ + + +
+
+
+ + + + + +
+
+
+ + + + + + + +
+ +
+ + + + + + + +

Default configuration

+ +

Default testing configuration

+

The recommended configuration for most projects. +It allows you to get into WordPress integration and end-to-end testing quickly and easily.

+

Requirements

+

The default configuration will set up Codeception and wp-browser to use SQLite as the database engine, PHP built-in +server to serve the test site on localhost and your local version of Chrome, driven by Chromedriver, to run end-to-end +tests.

+

As such, the default configuration has the following requirements:

+
    +
  • the sqlite3 PHP extension; you can check if if's installed by running php -m | grep sqlite3 in your terminal
  • +
  • the pdo_sqlite PHP extension; you can check if if's installed by running php -m | grep pdo_sqlite in your terminal
  • +
  • PHP built-in server can work with only one thread, but it will be faster using multiple threads; multiple threads are + not supported on Windows, but they are supported on WSL.
  • +
  • the Chrome browser installed on your machine
  • +
+

Overview - plugin and theme project

+

If you're configuring wp-browser for a plugin or theme project, the default configuration will install WordPress in +the tests/_wordpress directory and configure the installation to run using SQLite as a database engine. +The SQLite Database Integration plugin) will be placed in the installation must-use plugins directory.

+

If your plugin or theme project requires additional plugins or theme to work, you can place them in +the tests/_worpdress/wp-content/plugins and tests/_wordpress/wp-content/themes directories respectively.

+

When adding, or removing, plugin and themes, remember to +update the WPLoader module configuration to load the correct plugins and themes in +your integration tests.

+

On the same note, update the database dump used by the WPDb module to reflect the +changes in the dump loaded in the end-to-end tests. +The easiest way to update the database fixture is to load the current database dump +using the wp:db:import command, manually setting up the site interacting with it and then +exporting the database dump using the wp:db:export command.

+

You can find out about the URL of the site served by the PHP built-in web server by +running the dev:info command.

+

Overview - site project

+

If you're configuring wp-browser for a site project, the default configuration will use a combination of PHP built-in +web server and the SQLite Database Integration plugin to run the tests and serve your site.

+

The router file used by the PHP built-in web server will force the site, when served on localhost, to use SQLite as +database engine leaving your existing local MySQL database untouched.

+

Your existing WordPress installation will be picked up as it is, with all the plugins and themes found in the contents +directory.

+

Existing plugins and themes are not added to WPLoader module configuration by +wp-browser, you have to do that manually.

+

Similarly, the database dump used by the WPDb module is, by default, an empty WordPress +installation where no plugins and themes are active. +You have to update the database dump used by the module to reflect the state of your site. +You can do that by loading the current database dump using the wp:db:import command, +manually setting up the site interacting with it and then +exporting the database dump using the wp:db:export command.

+

You can find out about the URL of the site served by the PHP built-in web server by +running the dev:info command.

+

When not to use the default configuration

+

The default configuration is the recommended one for most projects, but some projects might require you to use a custom +configuration to make the most out of wp-browser.

+

Database drop-in

+

The default configuration will use the SQLite Database Integration plugin to use SQLite as the database engine. +This requires placing a db.php drop-in file in the WordPress content directory.

+

If your project already requires a db.php drop-in file, you will have to use a custom configuration.

+

Multisite with sub-domains

+

While Chrome will handle sub-domains correctly, even on localhost, WordPress will not. +If you're testing a multisite installation with sub-domains, you will have to use a custom configuration.

+

Custom site structure

+

If your site uses a customized file structure to manage WordPress, you will need to configure wp-browser using a custom +configuration. +This is usually true for some site projects, and will most likely not be an issue for plugin and theme projects.

+

Using a custom configuration is not that difficult +though: read more about using a custom configuration here.

+ + + + + + + +
+
+ + + +
+ + + +
+ + + +
+
+
+
+ + + + + + + + + \ No newline at end of file diff --git a/docs/extensions/index.html b/docs/extensions/index.html new file mode 100644 index 000000000..03edadb7f --- /dev/null +++ b/docs/extensions/index.html @@ -0,0 +1,2251 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + Extensions - wp-browser docs + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + +
+ + +
+ +
+ + + + + + +
+
+ + + +
+
+
+ + + + + +
+
+
+ + + + + + + +
+ +
+ + + + + + + +

Extensions

+ +

Codeception Extensions provided by the library

+

The library provides some custom Codeception extensions that can be added to the project Codeception configuration file, +in the extensions section.

+

BuiltInServerController

+

This extension will start and stop the PHP built-in web server before and after the tests run.

+

The extension can be configured with the following parameters:

+
    +
  • required
      +
    • docRoot - the document root to use for the PHP Built-in server; it can be either an absolute path or a path + relative to the Codeception root directory.
    • +
    +
  • +
  • optional
      +
    • suites - an array of Codeception suites to run the server for; if not set the server will be started for all the + suites.
    • +
    • port - the port to use for the PHP Built-in server, if not set the server will use port 2389.
    • +
    • workers - the number of workers to use for the PHP Built-in server, if not set the server will use 5 workers. + This is the equivalent of the PHP_CLI_SERVER_WORKERS environment variable.
    • +
    +
  • +
+
+

Note: if you run PHP built-in server on Windows, the workers parameter will be ignored and the server will always +run with a single worker. This limit is not present in WSL.

+
+

Example configuration starting the server for all suites:

+
extensions:
+  enabled:
+    - lucatume\WPBrowser\Extension\BuiltInServerController
+  config:
+    lucatume\WPBrowser\Extension\BuiltInServerController:
+      docRoot: /var/www/html
+      workers: 5
+
+

The extension can access environment variables defined in the tests configuration file:

+
extensions:
+  enabled:
+    - lucatume\WPBrowser\Extension\BuiltInServerController
+  config:
+    lucatume\WPBrowser\Extension\BuiltInServerController:
+      suites:
+        - EndToEnd
+        - WebApp
+      docRoot: '%WORDPRESS_ROOT_DIR%'
+      port: '%BUILT_IN_SERVER_PORT%'
+      workers: '%BUILT_IN_SERVER_WORKERS%'
+
+

This is a service extension that will be started and stopped by the dev:start +and dev:stop commands.

+

ChromeDriverController

+

This extension will start and stop the ChromeDriver before and after the tests are run.

+

The extension can be configured with the following parameters:

+
    +
  • optional
      +
    • suites - an array of Codeception suites to run the server for; if not set the server will be started for all the + suites.
    • +
    • port - the port to use for the ChromeDriver, if not set the server will use port 9515.
    • +
    • binary - the path to the ChromeDriver binary, if not set the server will use the chromedriver binary in the + Composer bin directory.
    • +
    +
  • +
+

Example configuration starting the server for all suites:

+
extensions:
+  enabled:
+    - lucatume\WPBrowser\Extension\ChromeDriverController
+  config:
+    lucatume\WPBrowser\Extension\ChromeDriverController:
+      port: 4444
+      binary: /usr/local/bin/chromedriver
+
+

The extension can access environment variables defined in the tests configuration file:

+
extensions:
+  enabled:
+    - lucatume\WPBrowser\Extension\ChromeDriverController
+  config:
+    suites:
+      - EndToEnd
+      - WebApp
+    lucatume\WPBrowser\Extension\ChromeDriverController:
+      port: '%CHROMEDRIVER_PORT%'
+      binary: '%CHROMEDRIVER_BINARY%'
+
+

You can use the chromedriver:update command to download the latest version of +ChromeDriver +compatible with your Chrome browser version and place it in the Composer bin directory.

+

This is a service extension that will be started and stopped by the dev:start +and dev:stop commands.

+

DockerComposeController

+

This extension will start and stop a docker compose stack before and after the tests are run.

+

The extension can be configured with the following parameters:

+
    +
  • required
      +
    • compose-file - the path to the docker compose file to use; it can be either an absolute path or a path + relative to the Codeception root directory.
    • +
    +
  • +
  • optional
      +
    • env-file- the path to the environment file to use; it can be either an absolute path or a path.
    • +
    +
  • +
+

Example configuration starting the server for all suites:

+
extensions:
+  enabled:
+    - lucatume\WPBrowser\Extension\DockerComposeController
+  config:
+    lucatume\WPBrowser\Extension\DockerComposeController:
+      compose-file: /var/www/html/docker-compose.yml
+      env-file: /var/www/html/.env
+
+

The extension can access environment variables defined in the tests configuration file:

+
extensions:
+  enabled:
+    - lucatume\WPBrowser\Extension\DockerComposeController
+  config:
+    suites:
+      - EndToEnd
+      - WebApp
+    lucatume\WPBrowser\Extension\DockerComposeController:
+      compose-file: '%DOCKER_COMPOSE_FILE%'
+      env-file: '%DOCKER_COMPOSE_ENV_FILE%'
+
+

This is a service extension that will be started and stopped by the dev:start +and wp:dev-stop commands.

+ + + + + + + +
+
+ + + +
+ + + +
+ + + +
+
+
+
+ + + + + + + + + \ No newline at end of file diff --git a/docs/index.html b/docs/index.html new file mode 100644 index 000000000..8a68b527e --- /dev/null +++ b/docs/index.html @@ -0,0 +1,2240 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + wp-browser docs + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + +
+ + +
+ +
+ + + + + + +
+
+ + + +
+
+
+ + + + + +
+
+
+ + + +
+
+
+ + + +
+
+
+ + + +
+ +
+ + + + + + + +

Getting started

+ +
+

This is the documentation for version 4 of the project, the current version. +Documentation for the previous version of the project, version 3, can be found here.

+
+

The wp-browser library provides a set of Codeception modules and middleware to enable the testing of WordPress sites, plugins and themes.

+

Installation

+

Add wp-browser to your project as a development dependency using Composer

+
cd my-wordrpess-project
+composer require --dev lucatume/wp-browser
+
+

Initialize wp-browser to quickly configured to suite your project and setup:

+
vendor/bin/codecept init wpbrowser
+
+

The command will set up your project to run integration and end-to-end tests using:

+
    +
  • SQLite as the database engine, leveraging the SQLite Database Integration plugin
  • +
  • PHP built-in web server to serve the WordPress site on localhost (e.g. http://localhost:8080)
  • +
  • Chromedriver to drive the local version of Chrome installed on your machine
  • +
+

If you're working on a plugin or theme project, the default configuration will add some extra steps:

+
    +
  • install the latest version of WordPress in the tests/_wordpress directory
  • +
  • create a tests/_plugins directory: any file or directory in this directory will be symlinked into the WordPress + installation in tests/_wordpress/wp-content/plugins
  • +
  • create a tests/_themes directory: any file or directory in this directory will be symlinked into the WordPress + installation in tests/_wordpress/wp-content/themes
  • +
+

For most projects this configuration will be enough to get started with testing.

+

You can run your tests immediately using the vendor/bin/codecept run command.

+

Read more about the commands provided by the library here.

+

Using a custom configuration

+

If you decide to skip the default configuration, you will be able to set up wp-browser to suit your needs and local +setup by editing the tests/.env file. +The inline documentation in the file will guide you through the configuration process.

+

Read more about using a custom configuration here.

+

Getting support for wp-browser configuration and usage

+

The best place to get support for wp-browser is the project documentation.
+Since this project builds on top of PHPUnit and Codeception, you can also refer to their documentation.

+

If you can't find the answer to your question here you can ask on +the "Issues" section of the wp-browser repository taking care to provide as much information as possible.

+

Finally, you can contact me directly to set up a call to discuss your +project needs and how wp-browser can help you.

+ + + + + + + +
+
+ + + +
+ + + +
+ + + +
+
+
+
+ + + + + + + + + \ No newline at end of file diff --git a/docs/modules/WPBrowser/index.html b/docs/modules/WPBrowser/index.html new file mode 100644 index 000000000..8dc18ed27 --- /dev/null +++ b/docs/modules/WPBrowser/index.html @@ -0,0 +1,2338 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + WPBrowser - wp-browser docs + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + +
+ + +
+ +
+ + + + + + +
+
+ + + +
+
+
+ + + + + +
+
+
+ + + +
+
+
+ + + +
+
+
+ + + +
+ +
+ + + + + + + +

WPBrowser

+ +

WPBrowser module

+

Browse and test the site HTML with a fast browser without Javascript support.

+

This module trades the WPWebDriver module Javascript support for speed and stability. It is a good +choice for testing sites that don't use Javascript or to make assertions that do not require Javascript support like:

+
    +
  • testing HTTP return codes
  • +
  • testing HTML structure
  • +
  • testing JSON and XML responses from APIs
  • +
+

This module is used together with the WPDb module and the WPFilesystem module to +control the site state, the database, and the site file structure.

+

This module is an extension of the Codeception PHPBrowser module, you can reference to the Codeception module +documentation for more information on the module configuration and usage.

+

This module should be with Cest and Cept test cases.

+

Configuration

+
    +
  • url - required; the start URL of your WordPress project.
  • +
  • adminUsername - required; the site administrator username to use in actions like loginAsAdmin.
  • +
  • adminPassword - required; the site administrator password to use in actions like loginAsAdmin.
  • +
  • adminPath - the path to the WordPress admin directory; defaults to /wp-admin.
  • +
+

More Guzzle request options are available like:

+

headers - default headers are set before each test.
+cookies - default cookies are set before each test.
+auth - default authentication to be set before each test.

+

... and more.

+

The following is an example of the module configuration to run tests on thehttp://localhost:8080 site:

+
modules:
+  enabled:
+    lucatume\WPBrowser\Module\WPBrowser:
+      url: 'http://localhost:8080'
+      adminUsername: 'admin'
+      adminPassword: 'password'
+      adminPath: '/wp-admin'
+      headers:
+        X_WPBROWSER_REQUEST: 1
+        X_TEST_REQUEST: 1
+        X_APM_REQUEST: 1
+
+

The following configuration uses dynamic configuration parameters to set the module configuration:

+
modules:
+  enabled:
+    lucatume\WPBrowser\Module\WPBrowser:
+      url: '%WORDPRESS_URL%'
+      adminUsername: '%WORDPRESS_ADMIN_USER%'
+      adminPassword: '%WORDPRESS_ADMIN_PASSWORD%'
+      adminPath: '/wp-admin'
+      headers:
+        X_WPBROWSER_REQUEST: 1
+        X_TEST_REQUEST: 1
+        X_APM_REQUEST: 1
+
+

Methods

+

The module provides the following methods:

+
    +
  • activatePlugin(array|string $pluginSlug) : void
  • +
  • amEditingPostWithId(int $id) : void
  • +
  • amHttpAuthenticated($username, $password) : void
  • +
  • amOnAdminAjaxPage(array|string|null [$queryVars]) : void
  • +
  • amOnAdminPage(string $page) : void
  • +
  • amOnCronPage(array|string|null [$queryVars]) : void
  • +
  • amOnPage(string $page) : void
  • +
  • amOnPagesPage() : void
  • +
  • amOnPluginsPage() : void
  • +
  • amOnSubdomain($subdomain) : void
  • +
  • amOnUrl($url) : void
  • +
  • attachFile($field, string $filename) : void
  • +
  • checkOption($option) : void
  • +
  • click($link, [$context]) : void
  • +
  • deactivatePlugin(array|string $pluginSlug) : void
  • +
  • deleteHeader(string $name) : void
  • +
  • dontSee(string $text, [$selector]) : void
  • +
  • dontSeeCheckboxIsChecked($checkbox) : void
  • +
  • dontSeeCookie($cookie, [$params]) : void
  • +
  • dontSeeCurrentUrlEquals(string $uri) : void
  • +
  • dontSeeCurrentUrlMatches(string $uri) : void
  • +
  • dontSeeElement($selector, array [$attributes]) : void
  • +
  • dontSeeInCurrentUrl(string $uri) : void
  • +
  • dontSeeInField($field, $value) : void
  • +
  • dontSeeInFormFields($formSelector, array $params) : void
  • +
  • dontSeeInSource(string $raw) : void
  • +
  • dontSeeInTitle($title) : void
  • +
  • dontSeeLink(string $text, string [$url]) : void
  • +
  • dontSeeOptionIsSelected($selector, $optionText) : void
  • +
  • dontSeePluginInstalled(string $pluginSlug) : void
  • +
  • dontSeeResponseCodeIs(int $code) : void
  • +
  • executeInGuzzle(Closure $function) : void
  • +
  • fillField($field, $value) : void
  • +
  • followRedirect() : void
  • +
  • grabAttributeFrom($cssOrXpath, string $attribute) : mixed
  • +
  • grabCookie(string $cookie, array [$params]) : mixed
  • +
  • grabCookiesWithPattern(string $cookiePattern) : ?array
  • +
  • grabFromCurrentUrl(?string [$uri]) : mixed
  • +
  • grabMultiple($cssOrXpath, ?string [$attribute]) : array
  • +
  • grabPageSource() : string
  • +
  • grabTextFrom($cssOrXPathOrRegex) : mixed
  • +
  • grabValueFrom($field) : mixed
  • +
  • grabWordPressTestCookie(?string [$name]) : ?Symfony\Component\BrowserKit\Cookie
  • +
  • haveHttpHeader(string $name, string $value) : void
  • +
  • haveServerParameter(string $name, string $value) : void
  • +
  • logOut(string|bool [$redirectTo]) : void
  • +
  • loginAs(string $username, string $password) : void
  • +
  • loginAsAdmin() : void
  • +
  • makeHtmlSnapshot(?string [$name]) : void
  • +
  • moveBack(int [$numberOfSteps]) : void
  • +
  • resetCookie($cookie, [$params]) : void
  • +
  • see(string $text, [$selector]) : void
  • +
  • seeCheckboxIsChecked($checkbox) : void
  • +
  • seeCookie($cookie, [$params]) : void
  • +
  • seeCurrentUrlEquals(string $uri) : void
  • +
  • seeCurrentUrlMatches(string $uri) : void
  • +
  • seeElement($selector, array [$attributes]) : void
  • +
  • seeErrorMessage(array|string [$classes]) : void
  • +
  • seeInCurrentUrl(string $uri) : void
  • +
  • seeInField($field, $value) : void
  • +
  • seeInFormFields($formSelector, array $params) : void
  • +
  • seeInSource(string $raw) : void
  • +
  • seeInTitle($title) : void
  • +
  • seeLink(string $text, ?string [$url]) : void
  • +
  • seeMessage(array|string [$classes]) : void
  • +
  • seeNumberOfElements($selector, $expected) : void
  • +
  • seeOptionIsSelected($selector, $optionText) : void
  • +
  • seePageNotFound() : void
  • +
  • seePluginActivated(string $pluginSlug) : void
  • +
  • seePluginDeactivated(string $pluginSlug) : void
  • +
  • seePluginInstalled(string $pluginSlug) : void
  • +
  • seeResponseCodeIs(int $code) : void
  • +
  • seeResponseCodeIsBetween(int $from, int $to) : void
  • +
  • seeResponseCodeIsClientError() : void
  • +
  • seeResponseCodeIsRedirection() : void
  • +
  • seeResponseCodeIsServerError() : void
  • +
  • seeResponseCodeIsSuccessful() : void
  • +
  • seeWpDiePage() : void
  • +
  • selectOption($select, $option) : void
  • +
  • sendAjaxGetRequest(string $uri, array [$params]) : void
  • +
  • sendAjaxPostRequest(string $uri, array [$params]) : void
  • +
  • sendAjaxRequest(string $method, string $uri, array [$params]) : void
  • +
  • setCookie($name, $val, [$params]) : void
  • +
  • setHeader(string $name, string $value) : void
  • +
  • setMaxRedirects(int $maxRedirects) : void
  • +
  • setServerParameters(array $params) : void
  • +
  • startFollowingRedirects() : void
  • +
  • stopFollowingRedirects() : void
  • +
  • submitForm($selector, array $params, ?string [$button]) : void
  • +
  • switchToIframe(string $name) : void
  • +
  • uncheckOption($option) : void
  • +
+

Read more in Codeception documentation.

+ + + + + + + +
+
+ + + +
+ + + +
+ + + +
+
+
+
+ + + + + + + + + \ No newline at end of file diff --git a/docs/modules/WPCLI/index.html b/docs/modules/WPCLI/index.html new file mode 100644 index 000000000..92bb39f75 --- /dev/null +++ b/docs/modules/WPCLI/index.html @@ -0,0 +1,2266 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + WPCLI - wp-browser docs + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + +
+ + +
+ +
+ + + + + + +
+
+ + + +
+
+
+ + + + + +
+
+
+ + + +
+
+
+ + + +
+
+
+ + + +
+ +
+ + + + + + + +

WPCLI

+ +

WPCLI module

+

Use WP-CLI to interact with the WordPress installation under test and issue commands.

+

This module is used in the context of end-to-end testing, together with, or as a replacement for +the WPDb module to manipulate the database and the WPFilesystem module to manipulate the +site file structure.

+

This module should be with Cest and Cept test cases.

+

Configuration

+
    +
  • path - required; the path to the WordPress installation under test. This can be a relative path to the + codeception root directory, or an absolute path to the WordPress installation directory. The WordPress installation + directory is the directory that contains the wp-load.php file.
  • +
  • url - the URL of the WordPress installation under test. Equivalent to the --url option of the wp command.
  • +
  • user - the user to use to run the wp command. Equivalent to the --user option of the wp command.
  • +
  • skip-plugins - a boolean value to indicate if the wp command should skip loading plugins. Equivalent to the + --skip-plugins option of the wp command.
  • +
  • skip-themes - a boolean value to indicate if the wp command should skip loading themes. Equivalent to the + --skip-themes option of the wp command.
  • +
  • skip-packages - a boolean value to indicate if the wp command should skip loading packages. Equivalent to the + --skip-packages option of the wp command.
  • +
  • require - a list of PHP files to require before running the wp command. Equivalent to the --require option of + the wp command.
  • +
  • exec - PHP code to execute before running the wp command. Equivalent to the --exec option of the wp command.
  • +
  • context - the context to use when running the wp command. Equivalent to the --context option of the wp + command.
  • +
  • color - a boolean value to indicate if the wp command should output in color. Equivalent to the --color option + of the wp command.
  • +
  • no-color - a boolean value to indicate if the wp command should not output in color. Equivalent to the + --no-color option of the wp command.
  • +
  • debug - a boolean value to indicate if the wp command should output debug information. Equivalent to the + --debug option of the wp command.
  • +
  • quiet - a boolean value to indicate if the wp command should suppress informational messages. Equivalent to the + --quiet option of the wp command.
  • +
  • throw - a boolean value to indicate if the wp command should throw an exception if the command fails.
  • +
  • timeout - the timeout to use when running the wp command. When the timeout is reached the command will be + terminated as a failure.
  • +
  • cache-dir - the directory to use to cache the files WPCLI might downloads. Equivalent to setting + the WP_CLI_CACHE_DIR + environment variable.
  • +
  • config-path - the path to the wp-cli.yml file to use. Equivalent to setting the WP_CLI_CONFIG_PATH + environment variable.
  • +
  • custom-shell - the shell to use to run the wp command. Equivalent to setting the WP_CLI_SHELL environment + variable.
  • +
  • packages-dir - the directory to use to store the packages downloaded by the wp package command. Equivalent to + setting the WP_CLI_PACKAGES_DIR environment variable.
  • +
+

The following is an example of the module configuration to run WPCLI commands on the /var/wordpress directory:

+
modules:
+  enabled:
+    lucatume\WPBrowser\Module\WPCLI:
+      path: /var/wordpress
+      throw: true
+
+

The following configuration uses dynamic configuration parameters to set the module configuration:

+
modules:
+  enabled:
+    lucatume\WPBrowser\Module\WPCLI:
+      path: '%WP_ROOT_DIR%'
+      throw: true
+
+

Methods

+

The module provides the following methods:

+
    +
  • cli(array|string [$command], ?array [$env], mixed [$input]) : int
  • +
  • cliToArray(array $command, ?callable [$splitCallback], ?array [$env], mixed [$input]) : array
  • +
  • cliToString(array $command, ?array [$env], mixed [$input]) : string
  • +
  • dontSeeInShellOutput(string $text) : void
  • +
  • dontSeeShellOutputMatches(string $regex) : void
  • +
  • grabLastCliProcess() : lucatume\WPBrowser\WordPress\CliProcess
  • +
  • grabLastShellErrorOutput() : string
  • +
  • grabLastShellOutput() : string
  • +
  • seeInShellOutput(string $text) : void
  • +
  • seeResultCodeIs(int $code) : void
  • +
  • seeResultCodeIsNot(int $code) : void
  • +
  • seeShellOutputMatches(string $regex) : void
  • +
+

Explore the WP-CLI documentation for more information on the available commands.

+ + + + + + + +
+
+ + + +
+ + + +
+ + + +
+
+
+
+ + + + + + + + + \ No newline at end of file diff --git a/docs/modules/WPDb/index.html b/docs/modules/WPDb/index.html new file mode 100644 index 000000000..f14237a6a --- /dev/null +++ b/docs/modules/WPDb/index.html @@ -0,0 +1,2435 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + WPDb - wp-browser docs + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + +
+ + +
+ +
+ + + + + + +
+
+ + + +
+
+
+ + + + + +
+
+
+ + + +
+
+
+ + + +
+
+
+ + + +
+ +
+ + + + + + + +

WPDb

+ +

WPDb module

+

This module allows to manipulate the database of the WordPress installation under test directly, without using the +WordPress API.

+

The module is used together with the WPBrowser module, WPWebDriver +and WPFilesystem modules to control the site state, the database, and the site file structure.

+

Note about interaction with the WPLoader module: both this module and the WPLoader one can be used to +control the state of the database before tests and set up fixtures: use either this or WPLoader, do not use both. +This module should be used in end-to-end testing, the WPLoader module should be used in integration +testing. +If you're using this module to load a database dump before integration tests, +use the WPLoader module dump configuration parameter instead.

+

This module should be with Cest and Cept test cases.

+

Configuration

+

This module extends the Codeception Db module adding some configuration options and functions that are specific to +WordPress.

+
    +
  • dbUrl - required; the URL to use to connect to the database. The URL must be in the form + mysql://user:password@host:port/database if you're using a MySQL database for your tests, or in the form + sqlite://path/to/database/file if you're using a SQLite database for your tests ( + like the default configuration does)
  • +
  • dsn - required; the DSN to use to connect to the database; required if not using the dbUrl parameter.
  • +
  • user - required; the user to use to connect to the database; required if not using the dbUrl parameter.
  • +
  • password - required; the password to use to connect to the database; required if not using the dbUrl + parameter.
  • +
  • url - required;the URL of the WordPress installation under test. E.g. http://localhost:8080 + or https://wordpress.test.
  • +
  • tablePrefix - the table prefix to use when interacting with the database; defaults to wp_.
  • +
  • dump - the path to a database dump file, or a set of database files, to load before running tests. The path can be + relative to the project root directory, e.g. tests/_data/dump.sql, or absolute.
  • +
  • populate - a boolean value to indicate if the database should be populated importing the dump file(s) at the start + of the suite.
  • +
  • cleanup - a boolean value to indicate if the database should be populated importing the dump file(s) before each + test.
  • +
  • reconnect - a boolean value to indicate if the database connection should be re-established before each test.
  • +
  • populator - a command to use to populate the database instead of using + PHP; read more on the Codeception documentation.
  • +
  • urlReplacement - a boolean value to indicate if the database dump file(s) should be searched for the siteurl + and home options and replaced with the url parameter value. This is required since WordPress hard-codes URLs in + the database, the original URL is inferred, if the originalUrl parameter is not provided.
  • +
  • originalUrl - if provided together with the urlReplacement parameter, the module will not try to infer the + original URL from the database dump file(s) but use the provided value instead.
  • +
  • waitlock - the number of seconds to wait for a database lock to be released before failing the test. Defaults to + 10 meaning that the test will fail if the database lock is not released after 10 seconds.
  • +
  • createIfNotExists - a boolean value to indicate if the database should be created if it does not exist. Defaults to + false.
  • +
+

The following is an example of the module configuration to run tests on thehttp://localhost:8080 site:

+
modules:
+  enabled:
+    - lucatume\WPBrowser\Module\WPDb:
+        dbUrl: 'mysql://root:password@localhost:3306/wordpress'
+        url: 'http://localhost:8080'
+        tablePrefix: 'wp_'
+        dump: 'tests/_data/dump.sql'
+        populate: true
+        cleanup: true
+        reconnect: false
+        urlReplacement: true
+        originalUrl: http://wordpress.test
+        waitlock: 10
+        createIfNotExists: true
+
+

The following configuration uses dynamic configuration parameters to set the module configuration:

+
modules:
+  enabled:
+    - lucatume\WPBrowser\Module\WPDb:
+        dbUrl: '%DB_URL%'
+        url: '%WORDPRESS_URL%'
+        tablePrefix: '%WORDPRESS_TABLE_PREFIX%'
+        dump: '%DB_DUMP%'
+        populate: true
+        cleanup: true
+        reconnect: false
+        urlReplacement: true
+        originalUrl: '%WORDPRESS_ORIGINAL_URL%'
+        waitlock: 10
+        createIfNotExists: true
+
+

The following configuration uses a SQLite database:

+
modules:
+  enabled:
+    - lucatume\WPBrowser\Module\WPDb:
+        dbUrl: 'sqlite://tests/database.sqlite'
+        url: 'http://localhost:8080'
+        tablePrefix: 'wp_'
+        dump: 'tests/_data/dump.sql'
+        populate: true
+        cleanup: true
+        reconnect: false
+        urlReplacement: true
+        originalUrl: http://wordpress.test
+        waitlock: 10
+        createIfNotExists: true
+
+

Methods

+

The module provides the following methods:

+
    +
  • amConnectedToDatabase(string $databaseKey) : void
  • +
  • countRowsInDatabase(string $table, array [$criteria]) : int
  • +
  • dontHaveAttachmentFilesInDatabase(array|int $attachmentIds) : void
  • +
  • dontHaveAttachmentInDatabase(array $criteria, bool [$purgeMeta], bool [$removeFiles]) : void
  • +
  • dontHaveBlogInDatabase(array $criteria, bool [$removeTables], bool [$removeUploads]) : void
  • +
  • dontHaveCommentInDatabase(array $criteria, bool [$purgeMeta]) : void
  • +
  • dontHaveCommentMetaInDatabase(array $criteria) : void
  • +
  • dontHaveInDatabase(string $table, array $criteria) : void
  • +
  • dontHaveLinkInDatabase(array $criteria) : void
  • +
  • dontHaveOptionInDatabase(string $key, mixed [$value]) : void
  • +
  • dontHavePostInDatabase(array $criteria, bool [$purgeMeta]) : void
  • +
  • dontHavePostMetaInDatabase(array $criteria) : void
  • +
  • dontHavePostThumbnailInDatabase(int $postId) : void
  • +
  • dontHaveSiteOptionInDatabase(string $key, mixed [$value]) : void
  • +
  • dontHaveSiteTransientInDatabase(string $key) : void
  • +
  • dontHaveTableInDatabase(string $fullTableName) : void
  • +
  • dontHaveTermInDatabase(array $criteria, bool [$purgeMeta]) : void
  • +
  • dontHaveTermMetaInDatabase(array $criteria) : void
  • +
  • dontHaveTermRelationshipInDatabase(array $criteria) : void
  • +
  • dontHaveTermTaxonomyInDatabase(array $criteria) : void
  • +
  • dontHaveTransientInDatabase(string $transient) : void
  • +
  • dontHaveUserInDatabase(string|int $userIdOrLogin, bool [$purgeMeta]) : void
  • +
  • dontHaveUserInDatabaseWithEmail(string $userEmail, bool [$purgeMeta]) : array
  • +
  • dontHaveUserMetaInDatabase(array $criteria) : void
  • +
  • dontSeeAttachmentInDatabase(array $criteria) : void
  • +
  • dontSeeBlogInDatabase(array $criteria) : void
  • +
  • dontSeeCommentInDatabase(array $criteria) : void
  • +
  • dontSeeCommentMetaInDatabase(array $criteria) : void
  • +
  • dontSeeInDatabase(string $table, array [$criteria]) : void
  • +
  • dontSeeLinkInDatabase(array $criteria) : void
  • +
  • dontSeeOptionInDatabase(array|string $criteriaOrName, mixed [$value]) : void
  • +
  • dontSeePageInDatabase(array $criteria) : void
  • +
  • dontSeePostInDatabase(array $criteria) : void
  • +
  • dontSeePostMetaInDatabase(array $criteria) : void
  • +
  • dontSeePostWithTermInDatabase(int $post_id, int $term_taxonomy_id, ?int [$term_order], ?string [$taxonomy]) : void
  • +
  • dontSeeSiteOptionInDatabase(array|string $criteriaOrName, mixed [$value]) : void
  • +
  • dontSeeTableInDatabase(string $table) : void
  • +
  • dontSeeTermInDatabase(array $criteria) : void
  • +
  • dontSeeTermMetaInDatabase(array $criteria) : void
  • +
  • dontSeeTermTaxonomyInDatabase(array $criteria) : void
  • +
  • dontSeeUserInDatabase(array $criteria) : void
  • +
  • dontSeeUserMetaInDatabase(array $criteria) : void
  • +
  • getSiteDomain() : string
  • +
  • getUsersTableName() : string
  • +
  • grabAllFromDatabase(string $table, string $column, array $criteria) : array
  • +
  • grabAttachmentAttachedFile(int $attachmentPostId) : string
  • +
  • grabAttachmentMetadata(int $attachmentPostId) : array
  • +
  • grabBlogDomain(int $blogId) : string
  • +
  • grabBlogPath(int $blogId) : string
  • +
  • grabBlogTableName(int $blogId, string $table) : string
  • +
  • grabBlogTableNames(int $blogId) : array
  • +
  • grabBlogTablePrefix(int $blogId) : string
  • +
  • grabBlogVersionsTableName() : string
  • +
  • grabBlogsTableName() : string
  • +
  • grabColumnFromDatabase(string $table, string $column, array [$criteria]) : array
  • +
  • grabCommentmetaTableName() : string
  • +
  • grabCommentsTableName() : string
  • +
  • grabEntriesFromDatabase(string $table, array [$criteria]) : array
  • +
  • grabEntryFromDatabase(string $table, array [$criteria]) : array
  • +
  • grabFromDatabase(string $table, string $column, array [$criteria]) : void
  • +
  • grabLatestEntryByFromDatabase(string $tableName, string [$idColumn]) : int
  • +
  • grabLinksTableName() : string
  • +
  • grabNumRecords(string $table, array [$criteria]) : int
  • +
  • grabOptionFromDatabase(string $option_name) : mixed
  • +
  • grabPostFieldFromDatabase(int $postId, string $field) : mixed
  • +
  • grabPostMetaFromDatabase(int $postId, string $metaKey, bool [$single]) : mixed
  • +
  • grabPostmetaTableName() : string
  • +
  • grabPostsTableName() : string
  • +
  • grabPrefixedTableNameFor(string [$tableName]) : string
  • +
  • grabRegistrationLogTableName() : string
  • +
  • grabSignupsTableName() : string
  • +
  • grabSiteMetaFromDatabase(int $blogId, string $key, bool $single) : mixed
  • +
  • grabSiteMetaTableName() : string
  • +
  • grabSiteOptionFromDatabase(string $key) : mixed
  • +
  • grabSiteTableName() : string
  • +
  • grabSiteTransientFromDatabase(string $key) : mixed
  • +
  • grabSiteUrl(?string [$path]) : string
  • +
  • grabTablePrefix() : string
  • +
  • grabTermIdFromDatabase(array $criteria) : int|false
  • +
  • grabTermMetaTableName() : string
  • +
  • grabTermRelationshipsTableName() : string
  • +
  • grabTermTaxonomyIdFromDatabase(array $criteria) : int|false
  • +
  • grabTermTaxonomyTableName() : string
  • +
  • grabTermsTableName() : string
  • +
  • grabUserIdFromDatabase(string $userLogin) : int|false
  • +
  • grabUserMetaFromDatabase(int $userId, string $meta_key, bool [$single]) : mixed
  • +
  • grabUsermetaTableName() : string
  • +
  • grabUsersTableName() : string
  • +
  • haveAttachmentInDatabase(string $file, string|int [$date], array [$overrides], ?array [$imageSizes]) : int
  • +
  • haveBlogInDatabase(string $domainOrPath, array [$overrides], bool [$subdomain]) : int
  • +
  • haveCommentInDatabase(int $comment_post_ID, array [$data]) : int
  • +
  • haveCommentMetaInDatabase(int $comment_id, string $meta_key, mixed $meta_value) : int
  • +
  • haveInDatabase(string $table, array $data) : int
  • +
  • haveLinkInDatabase(array [$overrides]) : int
  • +
  • haveManyBlogsInDatabase(int $count, array [$overrides], bool [$subdomain]) : array
  • +
  • haveManyCommentsInDatabase(int $count, int $comment_post_ID, array [$overrides]) : array
  • +
  • haveManyLinksInDatabase(int $count, array [$overrides]) : array
  • +
  • haveManyPostsInDatabase(int $count, array [$overrides]) : array
  • +
  • haveManyTermsInDatabase(int $count, string $name, string $taxonomy, array [$overrides]) : array
  • +
  • haveManyUsersInDatabase(int $count, string $user_login, string [$role], array [$overrides]) : array
  • +
  • haveMenuInDatabase(string $slug, string $location, array [$overrides]) : array
  • +
  • haveMenuItemInDatabase(string $menuSlug, string $title, ?int [$menuOrder], array [$meta]) : int
  • +
  • haveOptionInDatabase(string $option_name, mixed $option_value, string [$autoload]) : int
  • +
  • havePageInDatabase(array [$overrides]) : int
  • +
  • havePostInDatabase(array [$data]) : int
  • +
  • havePostThumbnailInDatabase(int $postId, int $thumbnailId) : int
  • +
  • havePostmetaInDatabase(int $postId, string $meta_key, mixed $meta_value) : int
  • +
  • haveSiteMetaInDatabase(int $blogId, string $string, mixed $value) : int
  • +
  • haveSiteOptionInDatabase(string $key, mixed $value) : int
  • +
  • haveSiteTransientInDatabase(string $key, mixed $value) : int
  • +
  • haveTermInDatabase(string $name, string $taxonomy, array [$overrides]) : array
  • +
  • haveTermMetaInDatabase(int $term_id, string $meta_key, mixed $meta_value) : int
  • +
  • haveTermRelationshipInDatabase(int $object_id, int $term_taxonomy_id, int [$term_order]) : void
  • +
  • haveTransientInDatabase(string $transient, mixed $value) : int
  • +
  • haveUserCapabilitiesInDatabase(int $userId, array|string $role) : array
  • +
  • haveUserInDatabase(string $user_login, array|string [$role], array [$overrides]) : int
  • +
  • haveUserLevelsInDatabase(int $userId, array|string $role) : array
  • +
  • haveUserMetaInDatabase(int $userId, string $meta_key, mixed $meta_value) : array
  • +
  • importSql(array $sql) : void
  • +
  • importSqlDumpFile(?string [$dumpFile]) : void
  • +
  • performInDatabase($databaseKey, $actions) : void
  • +
  • seeAttachmentInDatabase(array $criteria) : void
  • +
  • seeBlogInDatabase(array $criteria) : void
  • +
  • seeCommentInDatabase(array $criteria) : void
  • +
  • seeCommentMetaInDatabase(array $criteria) : void
  • +
  • seeInDatabase(string $table, array [$criteria]) : void
  • +
  • seeLinkInDatabase(array $criteria) : void
  • +
  • seeNumRecords(int $expectedNumber, string $table, array [$criteria]) : void
  • +
  • seeOptionInDatabase(array|string $criteriaOrName, mixed [$value]) : void
  • +
  • seePageInDatabase(array $criteria) : void
  • +
  • seePostInDatabase(array $criteria) : void
  • +
  • seePostMetaInDatabase(array $criteria) : void
  • +
  • seePostWithTermInDatabase(int $post_id, int $term_taxonomy_id, ?int [$term_order], ?string [$taxonomy]) : void
  • +
  • seeSiteOptionInDatabase(array|string $criteriaOrName, mixed [$value]) : void
  • +
  • seeSiteSiteTransientInDatabase(string $key, mixed [$value]) : void
  • +
  • seeTableInDatabase(string $table) : void
  • +
  • seeTermInDatabase(array $criteria) : void
  • +
  • seeTermMetaInDatabase(array $criteria) : void
  • +
  • seeTermRelationshipInDatabase(array $criteria) : void
  • +
  • seeTermTaxonomyInDatabase(array $criteria) : void
  • +
  • seeUserInDatabase(array $criteria) : void
  • +
  • seeUserMetaInDatabase(array $criteria) : void
  • +
  • updateInDatabase(string $table, array $data, array [$criteria]) : void
  • +
  • useBlog(int [$blogId]) : void
  • +
  • useMainBlog() : void
  • +
  • useTheme(string $stylesheet, ?string [$template], ?string [$themeName]) : void
  • +
+

Read more in Codeception documentation for the Db module.

+ + + + + + + +
+
+ + + +
+ + + +
+ + + +
+
+
+
+ + + + + + + + + \ No newline at end of file diff --git a/docs/modules/WPFilesystem/index.html b/docs/modules/WPFilesystem/index.html new file mode 100644 index 000000000..b9fc19e8c --- /dev/null +++ b/docs/modules/WPFilesystem/index.html @@ -0,0 +1,2292 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + WPFilesystem - wp-browser docs + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + +
+ + +
+ +
+ + + + + + +
+
+ + + +
+
+
+ + + + + +
+
+
+ + + +
+
+
+ + + +
+
+
+ + + +
+ +
+ + + + + + + +

WPFilesystem

+ +

WPFilesystem module

+

Interact and make assertions on the WordPress file structure.

+

This module is used together with the WPDb module to manage the state of the WordPress installation in the +context of end-to-end tests.

+

This module extends the Filesystem module from Codeception, you can reference to the Codeception documentation to +find out more about the module configuration and usage.

+

This module should be with Cest and Cept test cases.

+

Configuration

+

wpRootFolder - required; the path to the WordPress installation root folder. This can be a relative path to the +codeception root directory, or an absolute path to the WordPress installation directory. The WordPress installation +directory is the directory that contains the wp-load.php file. +themes - the path, relative to the path specified in the wpRootFolder parameter, to the themes directory. By +default, +it's /wp-content/themes. +plugins - the path, relative to the path specified in the wpRootFolder parameter, to the plugins directory. By +default, it's /wp-content/plugins. +mu-plugins - the path, relative to the path specified in the wpRootFolder parameter, to the must-use plugins. By +default, it's /wp-content/mu-plugins. directory. +uploads - the path, relative to the path specified in the wpRootFolder parameter, to the uploads directory. By +default, it's /wp-content/uploads.

+

The following is an example of the module configuration to run tests on the /var/wordpress site:

+
modules:
+  enabled:
+    lucatume\WPBrowser\Module\WPFilesystem:
+      wpRootFolder: /var/wordpress
+      themes: wp-content/themes
+      plugins: wp-content/plugins
+      mu-plugins: wp-content/mu-plugins
+      uploads: wp-content/uploads
+
+

The following configuration uses dynamic configuration parameters to set the module configuration:

+
modules:
+  enabled:
+    lucatume\WPBrowser\Module\WPFilesystem:
+      wpRootFolder: '%WP_ROOT_FOLDER%'
+
+

Methods

+

The module provides the following methods:

+
    +
  • amInMuPluginPath(string $path) : void
  • +
  • amInPath(string $path) : void
  • +
  • amInPluginPath(string $path) : void
  • +
  • amInThemePath(string $path) : void
  • +
  • amInUploadsPath(?string [$path]) : void
  • +
  • assertDirectoryExists(string $directory, string [$message]) : void
  • +
  • cleanDir(string $dirname) : void
  • +
  • cleanMuPluginDir(string $dir) : void
  • +
  • cleanPluginDir(string $dir) : void
  • +
  • cleanThemeDir(string $dir) : void
  • +
  • cleanUploadsDir(?string [$dir], DateTime|string|int|null [$date]) : void
  • +
  • copyDir(string $src, string $dst) : void
  • +
  • copyDirToMuPlugin(string $src, string $pluginDst) : void
  • +
  • copyDirToPlugin(string $src, string $pluginDst) : void
  • +
  • copyDirToTheme(string $src, string $themeDst) : void
  • +
  • copyDirToUploads(string $src, string $dst, DateTime|string|int|null [$date]) : void
  • +
  • deleteDir(string $dirname) : void
  • +
  • deleteFile(string $filename) : void
  • +
  • deleteMuPluginFile(string $file) : void
  • +
  • deletePluginFile(string $file) : void
  • +
  • deleteThemeFile(string $file) : void
  • +
  • deleteThisFile() : void
  • +
  • deleteUploadedDir(string $dir, DateTime|string|int|null [$date]) : void
  • +
  • deleteUploadedFile(string $file, string|int|null [$date]) : void
  • +
  • dontSeeFileFound(string $filename, string [$path]) : void
  • +
  • dontSeeInMuPluginFile(string $file, string $contents) : void
  • +
  • dontSeeInPluginFile(string $file, string $contents) : void
  • +
  • dontSeeInThemeFile(string $file, string $contents) : void
  • +
  • dontSeeInThisFile(string $text) : void
  • +
  • dontSeeInUploadedFile(string $file, string $contents, string|int|null [$date]) : void
  • +
  • dontSeeMuPluginFileFound(string $file) : void
  • +
  • dontSeePluginFileFound(string $file) : void
  • +
  • dontSeeThemeFileFound(string $file) : void
  • +
  • dontSeeUploadedFileFound(string $file, string|int|null [$date]) : void
  • +
  • getBlogUploadsPath(int $blogId, string [$file], DateTimeImmutable|DateTime|string|null [$date]) : string
  • +
  • getUploadsPath(string [$file], mixed [$date]) : string
  • +
  • getWpRootFolder() : string
  • +
  • haveMuPlugin(string $filename, string $code) : void
  • +
  • havePlugin(string $path, string $code) : void
  • +
  • haveTheme(string $folder, string $indexFileCode, string [$functionsFileCode]) : void
  • +
  • makeUploadsDir(string $path) : string
  • +
  • openFile(string $filename) : void
  • +
  • openUploadedFile(string $filename, DateTime|string|int|null [$date]) : void
  • +
  • seeFileContentsEqual(string $text) : void
  • +
  • seeFileFound(string $filename, string [$path]) : void
  • +
  • seeInMuPluginFile(string $file, string $contents) : void
  • +
  • seeInPluginFile(string $file, string $contents) : void
  • +
  • seeInThemeFile(string $file, string $contents) : void
  • +
  • seeInThisFile(string $text) : void
  • +
  • seeInUploadedFile(string $file, string $contents, string|int|null [$date]) : void
  • +
  • seeMuPluginFileFound(string $file) : void
  • +
  • seeNumberNewLines(int $number) : void
  • +
  • seePluginFileFound(string $file) : void
  • +
  • seeThemeFileFound(string $file) : void
  • +
  • seeThisFileMatches(string $regex) : void
  • +
  • seeUploadedFileFound(string $filename, string|int|null [$date]) : void
  • +
  • writeToFile(string $filename, string $contents) : void
  • +
  • writeToMuPluginFile(string $file, string $data) : void
  • +
  • writeToPluginFile(string $file, string $data) : void
  • +
  • writeToThemeFile(string $file, string $data) : void
  • +
  • writeToUploadedFile(string $filename, string $data, DateTime|string|int|null [$date]) : string
  • +
+

Read more in Codeception documentation.

+ + + + + + + +
+
+ + + +
+ + + +
+ + + +
+
+
+
+ + + + + + + + + \ No newline at end of file diff --git a/docs/modules/WPLoader/index.html b/docs/modules/WPLoader/index.html new file mode 100644 index 000000000..061c63876 --- /dev/null +++ b/docs/modules/WPLoader/index.html @@ -0,0 +1,2469 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + WPLoader - wp-browser docs + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + +
+ + +
+ +
+ + + + + + +
+
+ + + +
+
+
+ + + + + +
+
+
+ + + + + + + +
+ +
+ + + + + + + +

WPLoader

+ +

WPLoader module

+

A module to load WordPress and make its code available in tests.

+

Depending on the value of the loadOnly configuration parameter, the module will behave differently:

+
    +
  • loadOnly: false - The module will load WordPress like the Core PHPUnit suite does to run integration tests in a + controlled environment. Use the module in this mode with test cases generated + using the generate:wpunit command.
  • +
  • loadOnly: true - The module will load WordPress to make it available in the context of tests. Use the module in this + mode in Cest, Cept and Codeception unit test cases.
  • +
+

Configuration with loadOnly: false

+

The module will load WordPress like the Core PHPUnit suite does to run integration tests in a controlled +environment.
+Together with the test case generated by the generate:wpunit command the module +will:

+
    +
  • take care of running any test method in a database transaction rolled back after each test
  • +
  • manage and clean up the global environment and context between tests
  • +
+

When used in this mode, the module supports the following configuration parameters:

+
    +
  • loadOnly - false to load WordPress and run tests in a controlled environment.
  • +
  • wpRootFolder - required; the path to the WordPress installation root folder. This can be a relative path to the + codeception root directory, or an absolute path to the WordPress installation directory. The WordPress installation + directory is the directory that contains the wp-load.php file.
  • +
  • dbUrl - required; the URL to the database to use to run tests. The URL must be in the form + mysql://username:password@host:port/database to use a MySQL database, or in the form sqlite://path/to/database to + use a SQLite database. Alternatively, you can use the dbName, dbUser, dbPassword, dbHost configuration + parameters to specify the database connection details.
  • +
  • dump - the path to a database dump, or a set of database dumps, to load before running tests. The dump will be + loaded only once, after the tests run.
  • +
  • tablePrefix - the database table prefix to use when loading WordPress, defaults to wp_.
  • +
  • multisite - a boolean value to indicate if WordPress should be loaded and initialized in multisite mode.
  • +
  • dbCharset - the database charset to use when loading WordPress.
  • +
  • dbCollate - the database collate to use when loading WordPress.
  • +
  • domain - the domain to use when loading WordPress. Equivalent to defining the WP_TESTS_DOMAIN constant.
  • +
  • adminEmail - the administrator email to use when loading WordPress. Equivalent to defining the WP_TESTS_EMAIL + constant.
  • +
  • title - the site title to use when loading WordPress. Equivalent to defining the WP_TESTS_TITLE constant.
  • +
  • phpBinary - the path to the PHP binary to use to run tests. Defaults to the WP_PHP_BINARY constant.
  • +
  • language - the language to use when loading WordPress. Equivalent to defining the WPLANG constant.
  • +
  • configFile - a configuration file, or a set of configuration files, to load before the tests to further customize + and control the WordPress testing environment.
  • +
  • pluginsFolder - the path to the plugins folder to use when loading WordPress. Equivalent to defining the + WP_PLUGIN_DIR constant.
  • +
  • plugins - a list of plugins to activate and load in the WordPress installation. Each plugin must be specified in a + format like hello.php or my-plugin/my-plugin.php format.
  • +
  • bootstrapActions - a list of actions or callbacks to call after WordPress is loaded and before the tests run.
  • +
  • theme - the theme to activate and load in the WordPress installation. The theme must be specified in slug format + like + twentytwentythree.
  • +
  • AUTH_KEY - the AUTH_KEY constant value to use when loading WordPress. If the wpRootFolder path points at a + configured installation, containing the wp-config.php file, then the value of the constant in the configuration file + will be used, else it will be randomly generated.
  • +
  • SECURE_AUTH_KEY - the SECURE_AUTH_KEY constant value to use when loading WordPress. If the wpRootFolder path + points at a configured installation, containing the wp-config.php file, then the value of the constant in the + configuration file will be used, else it will be randomly generated.
  • +
  • LOGGED_IN_KEY - the LOGGED_IN_KEY constant value to use when loading WordPress. If the wpRootFolder path points + at a configured installation, containing the wp-config.php file, then the value of the constant in the configuration + file will be used, else it will be randomly generated.
  • +
  • NONCE_KEY - the NONCE_KEY constant value to use when loading WordPress. If the wpRootFolder path points at a + configured installation, containing the wp-config.php file, then the value of the constant in the configuration file + will be used, else it will be randomly generated.
  • +
  • AUTH_SALT - the AUTH_SALT constant value to use when loading WordPress. If the wpRootFolder path points at a + configured installation, containing the wp-config.php file, then the value of the constant in the configuration file + will be used, else it will be randomly generated.
  • +
  • SECURE_AUTH_SALT - the SECURE_AUTH_SALT constant value to use when loading WordPress. If the wpRootFolder path + points at a configured installation, containing the wp-config.php file, then the value of the constant in the + configuration file will be used, else it will be randomly generated.
  • +
  • LOGGED_IN_SALT - the LOGGED_IN_SALT constant value to use when loading WordPress. If the wpRootFolder path + points at a configured installation, containing the wp-config.php file, then the value of the constant in the + configuration file will be used, else it will be randomly generated.
  • +
  • NONCE_SALT - the NONCE_SALT constant value to use when loading WordPress. If the wpRootFolder path points at a + configured installation, containing the wp-config.php file, then the value of the constant in the configuration file + will be used, else it will be randomly generated.
  • +
  • AUTOMATIC_UPDATER_DISABLED - the AUTOMATIC_UPDATER_DISABLED constant value to use when loading WordPress. If + the wpRootFolder path points at a configured installation, containing the wp-config.php file, then the value of + the constant in the configuration file will be used, else it will be randomly generated.
  • +
  • WP_HTTP_BLOCK_EXTERNAL - the WP_HTTP_BLOCK_EXTERNAL constant value to use when loading WordPress. If + the wpRootFolder path points at a configured installation, containing the wp-config.php file, then the value of + the constant in the configuration file will be used, else it will be randomly generated.
  • +
+

This is an example of an integration suite configured to use the module:

+
actor: IntegrationTester
+bootstrap: _bootstrap.php
+modules:
+  enabled:
+    - \Helper\Integration
+    - lucatume\WPBrowser\Module\WPLoader:
+        wpRootFolder: /var/wordpress
+        dbUrl: mysql://root:root@mysql:3306/wordpress
+        tablePrefix: test_
+        domain: wordpress.test
+        adminEmail: admin@wordpress.test
+        title: 'Integration Tests'
+        plugins:
+          - hello.php
+          - woocommerce/woocommerce.php
+          - my-plugin/my-plugin.php
+        theme: twentytwentythree
+
+

The following configuration uses dynamic configuration parameters to set the module configuration:

+
actor: IntegrationTester
+bootstrap: _bootstrap.php
+modules:
+  enabled:
+    - \Helper\Integration
+    - lucatume\WPBrowser\Module\WPLoader:
+        wpRootFolder: '%WP_ROOT_FOLDER%'
+        dbUrl: '%WP_DB_URL%'
+        tablePrefix: '%WP_TABLE_PREFIX%'
+        domain: '%WP_DOMAIN%'
+        adminEmail: '%WP_ADMIN_EMAIL%'
+        title: '%WP_TITLE%'
+        plugins:
+          - hello.php
+          - woocommerce/woocommerce.php
+          - my-plugin/my-plugin.php
+        theme: twentytwentythree
+
+

The following example configuration uses a SQLite database and loads a database fixture before the tests run:

+
actor: IntegrationTester
+bootstrap: _bootstrap.php
+modules:
+  enabled:
+    - \Helper\Integration
+    - lucatume\WPBrowser\Module\WPLoader:
+        wpRootFolder: /var/wordpress
+        dbUrl: sqlite:///var/wordpress/wp-tests.sqlite
+        dump:
+          - tests/_data/products.sql
+          - tests/_data/users.sql
+          - tests/_data/orders.sql
+        tablePrefix: test_
+        domain: wordpress.test
+        adminEmail: admin@wordpress.test
+        title: 'Integration Tests'
+        plugins:
+          - hello.php
+          - woocommerce/woocommerce.php
+          - my-plugin/my-plugin.php
+        theme: twentytwentythree
+
+

Handling a custom site structure

+

If you're working on a site project using a custom file structure, e.g. [Bedrock][4], you should +use a custom configuration and, together with that, configure the WPLoader module to +load WordPress, plugins and themes code from the correct locations. +Take care to point the wpRootFolder parameter to the directory containing the wp-load.php file, +the /var/my-site/web/wp one in the following example, and the module will read the project configuration file to load +the WordPress code from the correct location.

+

Here's an example of how the module should be configured to run integration tests on a Bedrock installation:

+
actor: IntegrationTester
+bootstrap: _bootstrap.php
+modules:
+  enabled:
+    - \Helper\Integration
+    - lucatume\WPBrowser\Module\WPLoader:
+        wpRootFolder: /var/my-site/web/wp
+        dbUrl: mysql://root:root@mysql:3306/wordpress
+        tablePrefix: test_
+        domain: my-project.test
+        adminEmail: admin@my-project.test
+        title: 'Integration Tests'
+        plugins:
+          - hello.php
+          - woocommerce/woocommerce.php
+          - my-plugin/my-plugin.php
+        theme: twentytwentythree
+
+

In general, pointing the wpRootFolder parameter to the directory containing the wp-load.php file should take care of +loading WordPress code from the correct location. +Should that not be the case, use the configFile parameter to point the module to the project test configuration file: +a PHP file defining the constants and environment variables to use to load WordPress, plugins and themes correctly.

+

Configuration with loadOnly: true

+

The module will load WordPress from the location specified by the wpRootFodler parameter, relying +on the WPDb module to manage the database state.

+

When used in this mode, the module supports the following configuration parameters:

+
    +
  • loadOnly - true to load WordPress and make it available in the context of tests.
  • +
  • wpRootFolder - required; the path to the WordPress installation root folder. This can be a relative path to the + codeception root directory, or an absolute path to the WordPress installation directory. The WordPress installation + directory is the directory that contains the wp-load.php file.
  • +
  • dbUrl - required; the URL to the database to use to run tests. The URL must be in the form + mysql://username:password@host:port/database to use a MySQL database, or in the form sqlite://path/to/database to + use a SQLite database. Alternatively, you can use the dbName, dbUser, dbPassword, dbHost configuration + parameters to specify the database connection details.
  • +
  • domain - the domain to use when loading WordPress. Equivalent to defining the WP_TESTS_DOMAIN constant.
  • +
+

The following is an example of the module configuration to run end-to-end tests on the site served +at http://localhost:8080 URL and served from the /var/wordpress directory:

+
actor: EndToEndTester
+bootstrap: _bootstrap.php
+modules:
+  enabled:
+    - \Helper\Integration
+    - lucatume\WPBrowser\Module\WPDb:
+        dbUrl: 'mysql://root:password@localhost:3306/wordpress'
+        url: 'http://localhost:8080'
+        tablePrefix: 'wp_'
+        dump: 'tests/_data/dump.sql'
+        populate: true
+        cleanup: true
+        reconnect: false
+        urlReplacement: true
+        originalUrl: http://wordpress.test
+        waitlock: 10
+        createIfNotExists: true
+    - lucatume\WPBrowser\Module\WPLoader:
+        loadOnly: true
+        wpRootFolder: /var/wordpress
+        dbUrl: 'mysql://root:password@localhost:3306/wordpress'
+        domain: wordpress.test
+
+

Methods

+

The module provides the following methods:

+
    +
  • factory() : lucatume\WPBrowser\Module\WPLoader\FactoryStore
  • +
  • getContentFolder(string [$path]) : string
  • +
  • getInstallation() : lucatume\WPBrowser\WordPress\Installation
  • +
  • getPluginsFolder(string [$path]) : string
  • +
  • getThemesFolder(string [$path]) : string
  • +
  • getWpRootFolder(?string [$path]) : string
  • +
+ + + + + + + +
+
+ + + +
+ + + +
+ + + +
+
+
+
+ + + + + + + + + \ No newline at end of file diff --git a/docs/modules/WPQueries/index.html b/docs/modules/WPQueries/index.html new file mode 100644 index 000000000..b9399ac12 --- /dev/null +++ b/docs/modules/WPQueries/index.html @@ -0,0 +1,2232 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + WPQueries - wp-browser docs + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + +
+ + +
+ +
+ + + + + + +
+
+ + + +
+
+
+ + + + + +
+
+
+ + + +
+
+
+ + + +
+
+
+ + + +
+ +
+ + + + + + + +

WPQueries

+ +

WPQueries module

+

This module provides assertions for WordPress queries.

+

This module can be used in any test context where the global $wpdb variable is defined, this usually means in any +suite where the WPLoader module is used.

+

Configuration

+

The method does not require configuration.

+

Methods

+

The module provides the following methods:

+
    +
  • assertCountQueries(int $n, string [$message]) : void
  • +
  • assertNotQueries(string [$message]) : void
  • +
  • assertNotQueriesByAction(string $action, string [$message]) : void
  • +
  • assertNotQueriesByFilter(string $filter, string [$message]) : void
  • +
  • assertNotQueriesByFunction(string $function, string [$message]) : void
  • +
  • assertNotQueriesByMethod(string $class, string $method, string [$message]) : void
  • +
  • assertNotQueriesByStatement(string $statement, string [$message]) : void
  • +
  • assertNotQueriesByStatementAndAction(string $statement, string $action, string [$message]) : void
  • +
  • assertNotQueriesByStatementAndFilter(string $statement, string $filter, string [$message]) : void
  • +
  • assertNotQueriesByStatementAndFunction(string $statement, string $function, string [$message]) : void
  • +
  • assertNotQueriesByStatementAndMethod(string $statement, string $class, string $method, string [$message]) : void
  • +
  • assertQueries(string [$message]) : void
  • +
  • assertQueriesByAction(string $action, string [$message]) : void
  • +
  • assertQueriesByFilter(string $filter, string [$message]) : void
  • +
  • assertQueriesByFunction(string $function, string [$message]) : void
  • +
  • assertQueriesByMethod(string $class, string $method, string [$message]) : void
  • +
  • assertQueriesByStatement(string $statement, string [$message]) : void
  • +
  • assertQueriesByStatementAndAction(string $statement, string $action, string [$message]) : void
  • +
  • assertQueriesByStatementAndFilter(string $statement, string $filter, string [$message]) : void
  • +
  • assertQueriesByStatementAndFunction(string $statement, string $function, string [$message]) : void
  • +
  • assertQueriesByStatementAndMethod(string $statement, string $class, string $method, string [$message]) : void
  • +
  • assertQueriesCountByAction(int $n, string $action, string [$message]) : void
  • +
  • assertQueriesCountByFilter(int $n, string $filter, string [$message]) : void
  • +
  • assertQueriesCountByFunction(int $n, string $function, string [$message]) : void
  • +
  • assertQueriesCountByMethod(int $n, string $class, string $method, string [$message]) : void
  • +
  • assertQueriesCountByStatement(int $n, string $statement, string [$message]) : void
  • +
  • assertQueriesCountByStatementAndAction(int $n, string $statement, string $action, string [$message]) : void
  • +
  • assertQueriesCountByStatementAndFilter(int $n, string $statement, string $filter, string [$message]) : void
  • +
  • assertQueriesCountByStatementAndFunction(int $n, string $statement, string $function, string [$message]) : void
  • +
  • assertQueriesCountByStatementAndMethod(int $n, string $statement, string $class, string $method, string [$message]) : void
  • +
  • countQueries(?wpdb [$wpdb]) : int
  • +
  • getQueries(?wpdb [$wpdb]) : array
  • +
+ + + + + + + +
+
+ + + +
+ + + +
+ + + +
+
+
+
+ + + + + + + + + \ No newline at end of file diff --git a/docs/modules/WPWebDriver/index.html b/docs/modules/WPWebDriver/index.html new file mode 100644 index 000000000..d9a9d7fef --- /dev/null +++ b/docs/modules/WPWebDriver/index.html @@ -0,0 +1,2365 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + WPWebDriver - wp-browser docs + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + +
+ + +
+ +
+ + + + + + +
+
+ + + +
+
+
+ + + + + +
+
+
+ + + +
+
+
+ + + +
+
+
+ + + +
+ +
+ + + + + + + +

WPWebDriver

+ +

WPWebDriver module

+

This module drives a browser using a solution like Selenium or Chromedriver to simulate user interactions with +the WordPress project.

+

The module has full Javascript support, differently from the WPBrowser module, and can be used to test +sites that use Javascript to render the page or to make assertions that require Javascript support.

+

The method extends the Codeception WebDriver module and is used in the context of Cest and Cept test +cases.

+

Configuration

+
    +
  • browser - the browser to use; e.g. 'chrome'
  • +
  • url - required; the start URL of your WordPress project.
  • +
  • adminUsername - required; the site administrator username to use in actions like loginAsAdmin.
  • +
  • adminPassword - required; the site administrator password to use in actions like loginAsAdmin.
  • +
  • adminPath - the path to the WordPress admin directory; defaults to /wp-admin.
  • +
+

More configuration options, and their explanation, are available in the Codeception WebDriver module documentation.

+

The following is an example of the module configuration to run tests on thehttp://localhost:8080 site:

+
modules:
+  enabled:
+    lucatume\WPBrowser\Module\WPBrowser:
+      url: 'http://localhost:8080'
+      adminUsername: 'admin'
+      adminPassword: 'password'
+      adminPath: '/wp-admin'
+      browser: chrome
+      host: 'localhost'
+      port: '4444'
+      window_size: false
+      capabilities:
+        chromeOptions:
+          args: [ "--headless", "--disable-gpu", "--proxy-server='direct://'", "--proxy-bypass-list=*", "--no-sandbox", "--disable-dev-shm-usage" ]
+
+

The following configuration uses dynamic configuration parameters to set the module configuration:

+
modules:
+  enabled:
+    lucatume\WPBrowser\Module\WPBrowser:
+      url: 'http://localhost:8080'
+      adminUsername: 'admin'
+      adminPassword: 'password'
+      adminPath: '/wp-admin'
+      browser: chrome
+      host: '%CHROME_HOST%'
+      port: '%CHROME_PORT%'
+      window_size: `1920,1080`
+      capabilities:
+        chromeOptions:
+          args: [ "--disable-gpu", "--proxy-server='direct://'", "--proxy-bypass-list=*", "--no-sandbox", "--disable-dev-shm-usage" ]
+
+

Furthermore, the above configuration will not run Chrome in headless mode: the browser window will be visible.

+

Methods

+

The module provides the following methods:

+
    +
  • acceptPopup() : void
  • +
  • activatePlugin(array|string $pluginSlug) : void
  • +
  • amEditingPostWithId(int $id) : void
  • +
  • amOnAdminAjaxPage(array|string|null [$queryVars]) : void
  • +
  • amOnAdminPage(string $page) : void
  • +
  • amOnCronPage(array|string|null [$queryVars]) : void
  • +
  • amOnPage($page) : void
  • +
  • amOnPagesPage() : void
  • +
  • amOnPluginsPage() : void
  • +
  • amOnSubdomain(string $subdomain) : void
  • +
  • amOnUrl($url) : void
  • +
  • appendField($field, string $value) : void
  • +
  • attachFile($field, string $filename) : void
  • +
  • cancelPopup() : void
  • +
  • checkOption($option) : void
  • +
  • clearField($field) : void
  • +
  • click($link, [$context]) : void
  • +
  • clickWithLeftButton([$cssOrXPath], ?int [$offsetX], ?int [$offsetY]) : void
  • +
  • clickWithRightButton([$cssOrXPath], ?int [$offsetX], ?int [$offsetY]) : void
  • +
  • closeTab() : void
  • +
  • deactivatePlugin(array|string $pluginSlug) : void
  • +
  • debugWebDriverLogs(?Codeception\TestInterface [$test]) : void
  • +
  • deleteSessionSnapshot($name) : void
  • +
  • dontSee($text, [$selector]) : void
  • +
  • dontSeeCheckboxIsChecked($checkbox) : void
  • +
  • dontSeeCookie($cookie, array [$params], bool [$showDebug]) : void
  • +
  • dontSeeCurrentUrlEquals(string $uri) : void
  • +
  • dontSeeCurrentUrlMatches(string $uri) : void
  • +
  • dontSeeElement($selector, array [$attributes]) : void
  • +
  • dontSeeElementInDOM($selector, array [$attributes]) : void
  • +
  • dontSeeInCurrentUrl(string $uri) : void
  • +
  • dontSeeInField($field, $value) : void
  • +
  • dontSeeInFormFields($formSelector, array $params) : void
  • +
  • dontSeeInPageSource(string $text) : void
  • +
  • dontSeeInPopup(string $text) : void
  • +
  • dontSeeInSource($raw) : void
  • +
  • dontSeeInTitle($title) : void
  • +
  • dontSeeLink(string $text, string [$url]) : void
  • +
  • dontSeeOptionIsSelected($selector, $optionText) : void
  • +
  • dontSeePluginInstalled(string $pluginSlug) : void
  • +
  • doubleClick($cssOrXPath) : void
  • +
  • dragAndDrop($source, $target) : void
  • +
  • executeAsyncJS(string $script, array [$arguments]) : void
  • +
  • executeInSelenium(Closure $function) : void
  • +
  • executeJS(string $script, array [$arguments]) : void
  • +
  • fillField($field, $value) : void
  • +
  • grabAttributeFrom($cssOrXpath, $attribute) : ?string
  • +
  • grabCookie($cookie, array [$params]) : mixed
  • +
  • grabCookiesWithPattern(string $cookiePattern) : ?array
  • +
  • grabFromCurrentUrl([$uri]) : mixed
  • +
  • grabFullUrl() : string
  • +
  • grabMultiple($cssOrXpath, [$attribute]) : array
  • +
  • grabPageSource() : string
  • +
  • grabTextFrom($cssOrXPathOrRegex) : mixed
  • +
  • grabValueFrom($field) : ?string
  • +
  • grabWordPressTestCookie(?string [$name]) : ?Symfony\Component\BrowserKit\Cookie
  • +
  • loadSessionSnapshot($name, bool [$showDebug]) : bool
  • +
  • logOut(string|bool [$redirectTo]) : void
  • +
  • loginAs(string $username, string $password, int [$timeout], int [$maxAttempts]) : void
  • +
  • loginAsAdmin(int [$timeout], int [$maxAttempts]) : void
  • +
  • makeElementScreenshot($selector, ?string [$name]) : void
  • +
  • makeHtmlSnapshot(?string [$name]) : void
  • +
  • makeScreenshot(?string [$name]) : void
  • +
  • maximizeWindow() : void
  • +
  • moveBack() : void
  • +
  • moveForward() : void
  • +
  • moveMouseOver([$cssOrXPath], ?int [$offsetX], ?int [$offsetY]) : void
  • +
  • openNewTab() : void
  • +
  • performOn($element, $actions, int [$timeout]) : void
  • +
  • pressKey($element, ...[$chars]) : void
  • +
  • reloadPage() : void
  • +
  • resetCookie($cookie, array [$params], bool [$showDebug]) : void
  • +
  • resizeWindow(int $width, int $height) : void
  • +
  • saveSessionSnapshot($name) : void
  • +
  • scrollTo($selector, ?int [$offsetX], ?int [$offsetY]) : void
  • +
  • see($text, [$selector]) : void
  • +
  • seeCheckboxIsChecked($checkbox) : void
  • +
  • seeCookie($cookie, array [$params], bool [$showDebug]) : void
  • +
  • seeCurrentUrlEquals(string $uri) : void
  • +
  • seeCurrentUrlMatches(string $uri) : void
  • +
  • seeElement($selector, array [$attributes]) : void
  • +
  • seeElementInDOM($selector, array [$attributes]) : void
  • +
  • seeErrorMessage(array|string [$classes]) : void
  • +
  • seeInCurrentUrl(string $uri) : void
  • +
  • seeInField($field, $value) : void
  • +
  • seeInFormFields($formSelector, array $params) : void
  • +
  • seeInPageSource(string $text) : void
  • +
  • seeInPopup(string $text) : void
  • +
  • seeInSource($raw) : void
  • +
  • seeInTitle($title) : void
  • +
  • seeLink(string $text, ?string [$url]) : void
  • +
  • seeMessage(array|string [$classes]) : void
  • +
  • seeNumberOfElements($selector, $expected) : void
  • +
  • seeNumberOfElementsInDOM($selector, $expected) : void
  • +
  • seeNumberOfTabs(int $number) : void
  • +
  • seeOptionIsSelected($selector, $optionText) : void
  • +
  • seePluginActivated(string $pluginSlug) : void
  • +
  • seePluginDeactivated(string $pluginSlug) : void
  • +
  • seePluginInstalled(string $pluginSlug) : void
  • +
  • seeWpDiePage() : void
  • +
  • selectOption($select, $option) : void
  • +
  • setCookie($name, $value, array [$params], [$showDebug]) : void
  • +
  • submitForm($selector, array $params, [$button]) : void
  • +
  • switchToFrame(?string [$locator]) : void
  • +
  • switchToIFrame(?string [$locator]) : void
  • +
  • switchToNextTab(int [$offset]) : void
  • +
  • switchToPreviousTab(int [$offset]) : void
  • +
  • switchToWindow(?string [$name]) : void
  • +
  • type(string $text, int [$delay]) : void
  • +
  • typeInPopup(string $keys) : void
  • +
  • uncheckOption($option) : void
  • +
  • unselectOption($select, $option) : void
  • +
  • wait($timeout) : void
  • +
  • waitForElement($element, int [$timeout]) : void
  • +
  • waitForElementChange($element, Closure $callback, int [$timeout]) : void
  • +
  • waitForElementClickable($element, int [$timeout]) : void
  • +
  • waitForElementNotVisible($element, int [$timeout]) : void
  • +
  • waitForElementVisible($element, int [$timeout]) : void
  • +
  • waitForJS(string $script, int [$timeout]) : void
  • +
  • waitForJqueryAjax(int [$time]) : void
  • +
  • waitForText(string $text, int [$timeout], [$selector]) : void
  • +
+

Read more in Codeception documentation.

+ + + + + + + +
+
+ + + +
+ + + +
+ + + +
+
+
+
+ + + + + + + + + \ No newline at end of file diff --git a/docs/plugins/social/templates/default.yml b/docs/plugins/social/templates/default.yml new file mode 100644 index 000000000..2d803a982 --- /dev/null +++ b/docs/plugins/social/templates/default.yml @@ -0,0 +1,231 @@ +# Copyright (c) 2016-2023 Martin Donath + +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: + +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. + +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. + +# ----------------------------------------------------------------------------- +# Configuration +# ----------------------------------------------------------------------------- + +# Definitions +definitions: + + # Background image + - &background_image >- + {{ layout.background_image | x }} + + # Background color (default: indigo) + - &background_color >- + {%- if layout.background_color -%} + {{ layout.background_color }} + {%- else -%} + {%- set palette = config.theme.palette or {} -%} + {%- if not palette is mapping -%} + {%- set palette = palette | first -%} + {%- endif -%} + {%- set primary = palette.get("primary", "indigo") -%} + {%- set primary = primary.replace(" ", "-") -%} + {{ { + "red": "#ef5552", + "pink": "#e92063", + "purple": "#ab47bd", + "deep-purple": "#7e56c2", + "indigo": "#4051b5", + "blue": "#2094f3", + "light-blue": "#02a6f2", + "cyan": "#00bdd6", + "teal": "#009485", + "green": "#4cae4f", + "light-green": "#8bc34b", + "lime": "#cbdc38", + "yellow": "#ffec3d", + "amber": "#ffc105", + "orange": "#ffa724", + "deep-orange": "#ff6e42", + "brown": "#795649", + "grey": "#757575", + "blue-grey": "#546d78", + "black": "#000000", + "white": "#ffffff" + }[primary] or "#4051b5" }} + {%- endif -%} + + # Text color (default: white) + - &color >- + {%- if layout.color -%} + {{ layout.color }} + {%- else -%} + {%- set palette = config.theme.palette or {} -%} + {%- if not palette is mapping -%} + {%- set palette = palette | first -%} + {%- endif -%} + {%- set primary = palette.get("primary", "indigo") -%} + {%- set primary = primary.replace(" ", "-") -%} + {{ { + "red": "#ffffff", + "pink": "#ffffff", + "purple": "#ffffff", + "deep-purple": "#ffffff", + "indigo": "#ffffff", + "blue": "#ffffff", + "light-blue": "#ffffff", + "cyan": "#ffffff", + "teal": "#ffffff", + "green": "#ffffff", + "light-green": "#ffffff", + "lime": "#000000", + "yellow": "#000000", + "amber": "#000000", + "orange": "#000000", + "deep-orange": "#ffffff", + "brown": "#ffffff", + "grey": "#ffffff", + "blue-grey": "#ffffff", + "black": "#ffffff", + "white": "#000000" + }[primary] or "#ffffff" }} + {%- endif -%} + + # Font family (default: Roboto) + - &font_family >- + {%- if layout.font_family -%} + {{ layout.font_family }} + {%- elif config.theme.font != false -%} + {{ config.theme.font.get("text", "Roboto") }} + {%- else -%} + Roboto + {%- endif -%} + + # Site name + - &site_name >- + {{ config.site_name }} + + # Page title + - &page_title >- + {%- if layout.title -%} + {{ layout.title }} + {%- else -%} + {{ page.meta.get("title", page.title) }} + {%- endif -%} + + # Page title with site name + - &page_title_with_site_name >- + {%- if not page.is_homepage -%} + {{ page.meta.get("title", page.title) }} - {{ config.site_name }} + {%- else -%} + {{ page.meta.get("title", page.title) }} + {%- endif -%} + + # Page description + - &page_description >- + {%- if layout.description -%} + {{ layout.description }} + {%- else -%} + {{ page.meta.get("description", config.site_description) | x }} + {%- endif -%} + + # Logo + - &logo >- + {%- if layout.logo -%} + {{ layout.logo }} + {%- elif config.theme.logo -%} + {{ config.docs_dir }}/{{ config.theme.logo }} + {%- endif -%} + + # Logo (icon) + - &logo_icon >- + {{ config.theme.icon.logo | x }} + +# Meta tags +tags: + + # Open Graph + og:type: website + og:title: *page_title_with_site_name + og:description: *page_description + og:image: "{{ image.url }}" + og:image:type: "{{ image.type }}" + og:image:width: "{{ image.width }}" + og:image:height: "{{ image.height }}" + og:url: "{{ page.canonical_url }}" + + # Twitter + twitter:card: summary_large_image + twitter.title: *page_title_with_site_name + twitter:description: *page_description + twitter:image: "{{ image.url }}" + +# ----------------------------------------------------------------------------- +# Specification +# ----------------------------------------------------------------------------- + +# Card size and layers +size: { width: 1200, height: 630 } +layers: + + # Background + - background: + image: *background_image + color: *background_color + + # Logo + - size: { width: 144, height: 144 } + offset: { x: 992, y: 64 } + background: + image: *logo + icon: + value: *logo_icon + color: *color + + # Site name + - size: { width: 832, height: 42 } + offset: { x: 64, y: 64 } + typography: + content: *site_name + color: *color + font: + family: *font_family + style: Bold + + # Page title + - size: { width: 832, height: 310 } + offset: { x: 62, y: 160 } + typography: + content: *page_title + align: start + color: *color + line: + amount: 3 + height: 1.25 + font: + family: *font_family + style: Bold + + # Page description + - size: { width: 832, height: 64 } + offset: { x: 64, y: 512 } + typography: + content: *page_description + align: start + color: *color + line: + amount: 2 + height: 1.5 + font: + family: *font_family + style: Regular diff --git a/docs/plugins/social/templates/default/accent.yml b/docs/plugins/social/templates/default/accent.yml new file mode 100644 index 000000000..dde03b533 --- /dev/null +++ b/docs/plugins/social/templates/default/accent.yml @@ -0,0 +1,221 @@ +# Copyright (c) 2016-2023 Martin Donath + +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: + +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. + +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. + +# ----------------------------------------------------------------------------- +# Configuration +# ----------------------------------------------------------------------------- + +# Definitions +definitions: + + # Background image + - &background_image >- + {{ layout.background_image | x }} + + # Background color (default: indigo) + - &background_color >- + {%- if layout.background_color -%} + {{ layout.background_color }} + {%- else -%} + {%- set palette = config.theme.palette or {} -%} + {%- if not palette is mapping -%} + {%- set palette = palette | first -%} + {%- endif -%} + {%- set accent = palette.get("accent", "indigo") -%} + {%- set accent = accent.replace(" ", "-") -%} + {{ { + "red": "#ff1a47", + "pink": "#f50056", + "purple": "#df41fb", + "deep-purple": "#7c4dff", + "indigo": "#526cfe", + "blue": "#4287ff", + "light-blue": "#0091eb", + "cyan": "#00bad6", + "teal": "#00bda4", + "green": "#00c753", + "light-green": "#63de17", + "lime": "#b0eb00", + "yellow": "#ffd500", + "amber": "#ffaa00", + "orange": "#ff9100", + "deep-orange": "#ff6e42" + }[accent] or "#4051b5" }} + {%- endif -%} + + # Text color (default: white) + - &color >- + {%- if layout.color -%} + {{ layout.color }} + {%- else -%} + {%- set palette = config.theme.palette or {} -%} + {%- if not palette is mapping -%} + {%- set palette = palette | first -%} + {%- endif -%} + {%- set accent = palette.get("accent", "indigo") -%} + {%- set accent = accent.replace(" ", "-") -%} + {{ { + "red": "#ffffff", + "pink": "#ffffff", + "purple": "#ffffff", + "deep-purple": "#ffffff", + "indigo": "#ffffff", + "blue": "#ffffff", + "light-blue": "#ffffff", + "cyan": "#ffffff", + "teal": "#ffffff", + "green": "#ffffff", + "light-green": "#ffffff", + "lime": "#000000", + "yellow": "#000000", + "amber": "#000000", + "orange": "#000000", + "deep-orange": "#ffffff" + }[accent] or "#ffffff" }} + {%- endif -%} + + # Font family (default: Roboto) + - &font_family >- + {%- if layout.font_family -%} + {{ layout.font_family }} + {%- elif config.theme.font != false -%} + {{ config.theme.font.get("text", "Roboto") }} + {%- else -%} + Roboto + {%- endif -%} + + # Site name + - &site_name >- + {{ config.site_name }} + + # Page title + - &page_title >- + {%- if layout.title -%} + {{ layout.title }} + {%- else -%} + {{ page.meta.get("title", page.title) }} + {%- endif -%} + + # Page title with site name + - &page_title_with_site_name >- + {%- if not page.is_homepage -%} + {{ page.meta.get("title", page.title) }} - {{ config.site_name }} + {%- else -%} + {{ page.meta.get("title", page.title) }} + {%- endif -%} + + # Page description + - &page_description >- + {%- if layout.description -%} + {{ layout.description }} + {%- else -%} + {{ page.meta.get("description", config.site_description) | x }} + {%- endif -%} + + # Logo + - &logo >- + {%- if layout.logo -%} + {{ layout.logo }} + {%- elif config.theme.logo -%} + {{ config.docs_dir }}/{{ config.theme.logo }} + {%- endif -%} + + # Logo (icon) + - &logo_icon >- + {{ config.theme.icon.logo | x }} + +# Meta tags +tags: + + # Open Graph + og:type: website + og:title: *page_title_with_site_name + og:description: *page_description + og:image: "{{ image.url }}" + og:image:type: "{{ image.type }}" + og:image:width: "{{ image.width }}" + og:image:height: "{{ image.height }}" + og:url: "{{ page.canonical_url }}" + + # Twitter + twitter:card: summary_large_image + twitter.title: *page_title_with_site_name + twitter:description: *page_description + twitter:image: "{{ image.url }}" + +# ----------------------------------------------------------------------------- +# Specification +# ----------------------------------------------------------------------------- + +# Card size and layers +size: { width: 1200, height: 630 } +layers: + + # Background + - background: + image: *background_image + color: *background_color + + # Logo + - size: { width: 144, height: 144 } + offset: { x: 992, y: 64 } + background: + image: *logo + icon: + value: *logo_icon + color: *color + + # Site name + - size: { width: 832, height: 42 } + offset: { x: 64, y: 64 } + typography: + content: *site_name + color: *color + font: + family: *font_family + style: Bold + + # Page title + - size: { width: 832, height: 310 } + offset: { x: 62, y: 160 } + typography: + content: *page_title + align: start + color: *color + line: + amount: 3 + height: 1.25 + font: + family: *font_family + style: Bold + + # Page description + - size: { width: 832, height: 64 } + offset: { x: 64, y: 512 } + typography: + content: *page_description + align: start + color: *color + line: + amount: 2 + height: 1.5 + font: + family: *font_family + style: Regular diff --git a/docs/plugins/social/templates/default/invert.yml b/docs/plugins/social/templates/default/invert.yml new file mode 100644 index 000000000..7ea36443e --- /dev/null +++ b/docs/plugins/social/templates/default/invert.yml @@ -0,0 +1,231 @@ +# Copyright (c) 2016-2023 Martin Donath + +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: + +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. + +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. + +# ----------------------------------------------------------------------------- +# Configuration +# ----------------------------------------------------------------------------- + +# Definitions +definitions: + + # Background image + - &background_image >- + {{ layout.background_image | x }} + + # Background color (default: white) + - &background_color >- + {%- if layout.background_color -%} + {{ layout.background_color }} + {%- else -%} + {%- set palette = config.theme.palette or {} -%} + {%- if not palette is mapping -%} + {%- set palette = palette | first -%} + {%- endif -%} + {%- set primary = palette.get("primary", "indigo") -%} + {%- set primary = primary.replace(" ", "-") -%} + {{ { + "red": "#ffffff", + "pink": "#ffffff", + "purple": "#ffffff", + "deep-purple": "#ffffff", + "indigo": "#ffffff", + "blue": "#ffffff", + "light-blue": "#ffffff", + "cyan": "#ffffff", + "teal": "#ffffff", + "green": "#ffffff", + "light-green": "#ffffff", + "lime": "#000000", + "yellow": "#000000", + "amber": "#000000", + "orange": "#000000", + "deep-orange": "#ffffff", + "brown": "#ffffff", + "grey": "#ffffff", + "blue-grey": "#ffffff", + "black": "#ffffff", + "white": "#000000" + }[primary] or "#ffffff" }} + {%- endif -%} + + # Text color (default: indigo) + - &color >- + {%- if layout.color -%} + {{ layout.color }} + {%- else -%} + {%- set palette = config.theme.palette or {} -%} + {%- if not palette is mapping -%} + {%- set palette = palette | first -%} + {%- endif -%} + {%- set primary = palette.get("primary", "indigo") -%} + {%- set primary = primary.replace(" ", "-") -%} + {{ { + "red": "#ef5552", + "pink": "#e92063", + "purple": "#ab47bd", + "deep-purple": "#7e56c2", + "indigo": "#4051b5", + "blue": "#2094f3", + "light-blue": "#02a6f2", + "cyan": "#00bdd6", + "teal": "#009485", + "green": "#4cae4f", + "light-green": "#8bc34b", + "lime": "#cbdc38", + "yellow": "#ffec3d", + "amber": "#ffc105", + "orange": "#ffa724", + "deep-orange": "#ff6e42", + "brown": "#795649", + "grey": "#757575", + "blue-grey": "#546d78", + "black": "#000000", + "white": "#ffffff" + }[primary] or "#4051b5" }} + {%- endif -%} + + # Font family (default: Roboto) + - &font_family >- + {%- if layout.font_family -%} + {{ layout.font_family }} + {%- elif config.theme.font != false -%} + {{ config.theme.font.get("text", "Roboto") }} + {%- else -%} + Roboto + {%- endif -%} + + # Site name + - &site_name >- + {{ config.site_name }} + + # Page title + - &page_title >- + {%- if layout.title -%} + {{ layout.title }} + {%- else -%} + {{ page.meta.get("title", page.title) }} + {%- endif -%} + + # Page title with site name + - &page_title_with_site_name >- + {%- if not page.is_homepage -%} + {{ page.meta.get("title", page.title) }} - {{ config.site_name }} + {%- else -%} + {{ page.meta.get("title", page.title) }} + {%- endif -%} + + # Page description + - &page_description >- + {%- if layout.description -%} + {{ layout.description }} + {%- else -%} + {{ page.meta.get("description", config.site_description) | x }} + {%- endif -%} + + # Logo + - &logo >- + {%- if layout.logo -%} + {{ layout.logo }} + {%- elif config.theme.logo -%} + {{ config.docs_dir }}/{{ config.theme.logo }} + {%- endif -%} + + # Logo (icon) + - &logo_icon >- + {{ config.theme.icon.logo | x }} + +# Meta tags +tags: + + # Open Graph + og:type: website + og:title: *page_title_with_site_name + og:description: *page_description + og:image: "{{ image.url }}" + og:image:type: "{{ image.type }}" + og:image:width: "{{ image.width }}" + og:image:height: "{{ image.height }}" + og:url: "{{ page.canonical_url }}" + + # Twitter + twitter:card: summary_large_image + twitter.title: *page_title_with_site_name + twitter:description: *page_description + twitter:image: "{{ image.url }}" + +# ----------------------------------------------------------------------------- +# Specification +# ----------------------------------------------------------------------------- + +# Card size and layers +size: { width: 1200, height: 630 } +layers: + + # Background + - background: + image: *background_image + color: *background_color + + # Logo + - size: { width: 144, height: 144 } + offset: { x: 992, y: 64 } + background: + image: *logo + icon: + value: *logo_icon + color: *color + + # Site name + - size: { width: 832, height: 42 } + offset: { x: 64, y: 64 } + typography: + content: *site_name + color: *color + font: + family: *font_family + style: Bold + + # Page title + - size: { width: 832, height: 310 } + offset: { x: 62, y: 160 } + typography: + content: *page_title + align: start + color: *color + line: + amount: 3 + height: 1.25 + font: + family: *font_family + style: Bold + + # Page description + - size: { width: 832, height: 64 } + offset: { x: 64, y: 512 } + typography: + content: *page_description + align: start + color: *color + line: + amount: 2 + height: 1.5 + font: + family: *font_family + style: Regular diff --git a/docs/plugins/social/templates/default/only/image.yml b/docs/plugins/social/templates/default/only/image.yml new file mode 100644 index 000000000..ee10b9c2b --- /dev/null +++ b/docs/plugins/social/templates/default/only/image.yml @@ -0,0 +1,77 @@ +# Copyright (c) 2016-2023 Martin Donath + +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: + +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. + +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. + +# ----------------------------------------------------------------------------- +# Configuration +# ----------------------------------------------------------------------------- + +# Definitions +definitions: + + # Background image + - &background_image >- + {{ layout.background_image }} + + # Page title with site name + - &page_title_with_site_name >- + {%- if not page.is_homepage -%} + {{ page.meta.get("title", page.title) }} - {{ config.site_name }} + {%- else -%} + {{ page.meta.get("title", page.title) }} + {%- endif -%} + + # Page description + - &page_description >- + {%- if layout.description -%} + {{ layout.description }} + {%- else -%} + {{ page.meta.get("description", config.site_description) | x }} + {%- endif -%} + +# Meta tags +tags: + + # Open Graph + og:type: website + og:title: *page_title_with_site_name + og:description: *page_description + og:image: "{{ image.url }}" + og:image:type: "{{ image.type }}" + og:image:width: "{{ image.width }}" + og:image:height: "{{ image.height }}" + og:url: "{{ page.canonical_url }}" + + # Twitter + twitter:card: summary_large_image + twitter.title: *page_title_with_site_name + twitter:description: *page_description + twitter:image: "{{ image.url }}" + +# ----------------------------------------------------------------------------- +# Specification +# ----------------------------------------------------------------------------- + +# Card size and layers +size: { width: 1200, height: 630 } +layers: + + # Background + - background: + image: *background_image diff --git a/docs/plugins/social/templates/default/variant.yml b/docs/plugins/social/templates/default/variant.yml new file mode 100644 index 000000000..9f5053727 --- /dev/null +++ b/docs/plugins/social/templates/default/variant.yml @@ -0,0 +1,242 @@ +# Copyright (c) 2016-2023 Martin Donath + +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: + +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. + +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. + +# ----------------------------------------------------------------------------- +# Configuration +# ----------------------------------------------------------------------------- + +# Definitions +definitions: + + # Background image + - &background_image >- + {{ layout.background_image | x }} + + # Background color (default: indigo) + - &background_color >- + {%- if layout.background_color -%} + {{ layout.background_color }} + {%- else -%} + {%- set palette = config.theme.palette or {} -%} + {%- if not palette is mapping -%} + {%- set palette = palette | first -%} + {%- endif -%} + {%- set primary = palette.get("primary", "indigo") -%} + {%- set primary = primary.replace(" ", "-") -%} + {{ { + "red": "#ef5552", + "pink": "#e92063", + "purple": "#ab47bd", + "deep-purple": "#7e56c2", + "indigo": "#4051b5", + "blue": "#2094f3", + "light-blue": "#02a6f2", + "cyan": "#00bdd6", + "teal": "#009485", + "green": "#4cae4f", + "light-green": "#8bc34b", + "lime": "#cbdc38", + "yellow": "#ffec3d", + "amber": "#ffc105", + "orange": "#ffa724", + "deep-orange": "#ff6e42", + "brown": "#795649", + "grey": "#757575", + "blue-grey": "#546d78", + "black": "#000000", + "white": "#ffffff" + }[primary] or "#4051b5" }} + {%- endif -%} + + # Text color (default: white) + - &color >- + {%- if layout.color -%} + {{ layout.color }} + {%- else -%} + {%- set palette = config.theme.palette or {} -%} + {%- if not palette is mapping -%} + {%- set palette = palette | first -%} + {%- endif -%} + {%- set primary = palette.get("primary", "indigo") -%} + {%- set primary = primary.replace(" ", "-") -%} + {{ { + "red": "#ffffff", + "pink": "#ffffff", + "purple": "#ffffff", + "deep-purple": "#ffffff", + "indigo": "#ffffff", + "blue": "#ffffff", + "light-blue": "#ffffff", + "cyan": "#ffffff", + "teal": "#ffffff", + "green": "#ffffff", + "light-green": "#ffffff", + "lime": "#000000", + "yellow": "#000000", + "amber": "#000000", + "orange": "#000000", + "deep-orange": "#ffffff", + "brown": "#ffffff", + "grey": "#ffffff", + "blue-grey": "#ffffff", + "black": "#ffffff", + "white": "#000000" + }[primary] or "#ffffff" }} + {%- endif -%} + + # Font family (default: Roboto) + - &font_family >- + {%- if layout.font_family -%} + {{ layout.font_family }} + {%- elif config.theme.font != false -%} + {{ config.theme.font.get("text", "Roboto") }} + {%- else -%} + Roboto + {%- endif -%} + + # Site name + - &site_name >- + {{ config.site_name }} + + # Page title + - &page_title >- + {%- if layout.title -%} + {{ layout.title }} + {%- else -%} + {{ page.meta.get("title", page.title) }} + {%- endif -%} + + # Page title with site name + - &page_title_with_site_name >- + {%- if not page.is_homepage -%} + {{ page.meta.get("title", page.title) }} - {{ config.site_name }} + {%- else -%} + {{ page.meta.get("title", page.title) }} + {%- endif -%} + + # Page description + - &page_description >- + {%- if layout.description -%} + {{ layout.description }} + {%- else -%} + {{ page.meta.get("description", config.site_description) | x }} + {%- endif -%} + + # Page icon + - &page_icon >- + {{ page.meta.icon | x }} + + # Logo + - &logo >- + {%- if layout.logo -%} + {{ layout.logo }} + {%- elif config.theme.logo -%} + {{ config.docs_dir }}/{{ config.theme.logo }} + {%- endif -%} + + # Logo (icon) + - &logo_icon >- + {{ config.theme.icon.logo | x }} + +# Meta tags +tags: + + # Open Graph + og:type: website + og:title: *page_title_with_site_name + og:description: *page_description + og:image: "{{ image.url }}" + og:image:type: "{{ image.type }}" + og:image:width: "{{ image.width }}" + og:image:height: "{{ image.height }}" + og:url: "{{ page.canonical_url }}" + + # Twitter + twitter:card: summary_large_image + twitter.title: *page_title_with_site_name + twitter:description: *page_description + twitter:image: "{{ image.url }}" + +# ----------------------------------------------------------------------------- +# Specification +# ----------------------------------------------------------------------------- + +# Card size and layers +size: { width: 1200, height: 630 } +layers: + + # Background + - background: + image: *background_image + color: *background_color + + # Page icon + - size: { width: 630, height: 630 } + offset: { x: 800, y: 0 } + icon: + value: *page_icon + color: "#00000033" + + # Logo + - size: { width: 64, height: 64 } + offset: { x: 64, y: 64 } + background: + image: *logo + icon: + value: *logo_icon + color: *color + + # Site name + - size: { width: 768, height: 42 } + offset: { x: 160, y: 74 } + typography: + content: *site_name + color: *color + font: + family: *font_family + style: Bold + + # Page title + - size: { width: 864, height: 256 } + offset: { x: 62, y: 192 } + typography: + content: *page_title + align: start + color: *color + line: + amount: 3 + height: 1.25 + font: + family: *font_family + style: Bold + + # Page description + - size: { width: 864, height: 64 } + offset: { x: 64, y: 512 } + typography: + content: *page_description + align: start + color: *color + line: + amount: 2 + height: 1.5 + font: + family: *font_family + style: Regular diff --git a/docs/public/404.html b/docs/public/404.html deleted file mode 100644 index 5a8299082..000000000 --- a/docs/public/404.html +++ /dev/null @@ -1,279 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - wp-browser docs - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
-
- -
- - - - - - -
- - -
- -
- - - - - - -
-
- - - -
-
-
- - - - -
-
-
- - - -
-
-
- - - -
-
-
- - - -
-
- -

404 - Not found

- -
-
- - -
- -
- - - -
-
-
-
- - - - - - - - - \ No newline at end of file diff --git a/docs/public/assets/javascripts/bundle.220ee61c.min.js b/docs/public/assets/javascripts/bundle.220ee61c.min.js deleted file mode 100644 index 8ae651f39..000000000 --- a/docs/public/assets/javascripts/bundle.220ee61c.min.js +++ /dev/null @@ -1,29 +0,0 @@ -"use strict";(()=>{var Ci=Object.create;var gr=Object.defineProperty;var Ri=Object.getOwnPropertyDescriptor;var ki=Object.getOwnPropertyNames,Ht=Object.getOwnPropertySymbols,Hi=Object.getPrototypeOf,yr=Object.prototype.hasOwnProperty,nn=Object.prototype.propertyIsEnumerable;var rn=(e,t,r)=>t in e?gr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,P=(e,t)=>{for(var r in t||(t={}))yr.call(t,r)&&rn(e,r,t[r]);if(Ht)for(var r of Ht(t))nn.call(t,r)&&rn(e,r,t[r]);return e};var on=(e,t)=>{var r={};for(var n in e)yr.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Ht)for(var n of Ht(e))t.indexOf(n)<0&&nn.call(e,n)&&(r[n]=e[n]);return r};var Pt=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Pi=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of ki(t))!yr.call(e,o)&&o!==r&&gr(e,o,{get:()=>t[o],enumerable:!(n=Ri(t,o))||n.enumerable});return e};var yt=(e,t,r)=>(r=e!=null?Ci(Hi(e)):{},Pi(t||!e||!e.__esModule?gr(r,"default",{value:e,enumerable:!0}):r,e));var sn=Pt((xr,an)=>{(function(e,t){typeof xr=="object"&&typeof an!="undefined"?t():typeof define=="function"&&define.amd?define(t):t()})(xr,function(){"use strict";function e(r){var n=!0,o=!1,i=null,s={text:!0,search:!0,url:!0,tel:!0,email:!0,password:!0,number:!0,date:!0,month:!0,week:!0,time:!0,datetime:!0,"datetime-local":!0};function a(O){return!!(O&&O!==document&&O.nodeName!=="HTML"&&O.nodeName!=="BODY"&&"classList"in O&&"contains"in O.classList)}function f(O){var Qe=O.type,De=O.tagName;return!!(De==="INPUT"&&s[Qe]&&!O.readOnly||De==="TEXTAREA"&&!O.readOnly||O.isContentEditable)}function c(O){O.classList.contains("focus-visible")||(O.classList.add("focus-visible"),O.setAttribute("data-focus-visible-added",""))}function u(O){O.hasAttribute("data-focus-visible-added")&&(O.classList.remove("focus-visible"),O.removeAttribute("data-focus-visible-added"))}function p(O){O.metaKey||O.altKey||O.ctrlKey||(a(r.activeElement)&&c(r.activeElement),n=!0)}function m(O){n=!1}function d(O){a(O.target)&&(n||f(O.target))&&c(O.target)}function h(O){a(O.target)&&(O.target.classList.contains("focus-visible")||O.target.hasAttribute("data-focus-visible-added"))&&(o=!0,window.clearTimeout(i),i=window.setTimeout(function(){o=!1},100),u(O.target))}function v(O){document.visibilityState==="hidden"&&(o&&(n=!0),Y())}function Y(){document.addEventListener("mousemove",N),document.addEventListener("mousedown",N),document.addEventListener("mouseup",N),document.addEventListener("pointermove",N),document.addEventListener("pointerdown",N),document.addEventListener("pointerup",N),document.addEventListener("touchmove",N),document.addEventListener("touchstart",N),document.addEventListener("touchend",N)}function B(){document.removeEventListener("mousemove",N),document.removeEventListener("mousedown",N),document.removeEventListener("mouseup",N),document.removeEventListener("pointermove",N),document.removeEventListener("pointerdown",N),document.removeEventListener("pointerup",N),document.removeEventListener("touchmove",N),document.removeEventListener("touchstart",N),document.removeEventListener("touchend",N)}function N(O){O.target.nodeName&&O.target.nodeName.toLowerCase()==="html"||(n=!1,B())}document.addEventListener("keydown",p,!0),document.addEventListener("mousedown",m,!0),document.addEventListener("pointerdown",m,!0),document.addEventListener("touchstart",m,!0),document.addEventListener("visibilitychange",v,!0),Y(),r.addEventListener("focus",d,!0),r.addEventListener("blur",h,!0),r.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&r.host?r.host.setAttribute("data-js-focus-visible",""):r.nodeType===Node.DOCUMENT_NODE&&(document.documentElement.classList.add("js-focus-visible"),document.documentElement.setAttribute("data-js-focus-visible",""))}if(typeof window!="undefined"&&typeof document!="undefined"){window.applyFocusVisiblePolyfill=e;var t;try{t=new CustomEvent("focus-visible-polyfill-ready")}catch(r){t=document.createEvent("CustomEvent"),t.initCustomEvent("focus-visible-polyfill-ready",!1,!1,{})}window.dispatchEvent(t)}typeof document!="undefined"&&e(document)})});var cn=Pt(Er=>{(function(e){var t=function(){try{return!!Symbol.iterator}catch(c){return!1}},r=t(),n=function(c){var u={next:function(){var p=c.shift();return{done:p===void 0,value:p}}};return r&&(u[Symbol.iterator]=function(){return u}),u},o=function(c){return encodeURIComponent(c).replace(/%20/g,"+")},i=function(c){return decodeURIComponent(String(c).replace(/\+/g," "))},s=function(){var c=function(p){Object.defineProperty(this,"_entries",{writable:!0,value:{}});var m=typeof p;if(m!=="undefined")if(m==="string")p!==""&&this._fromString(p);else if(p instanceof c){var d=this;p.forEach(function(B,N){d.append(N,B)})}else if(p!==null&&m==="object")if(Object.prototype.toString.call(p)==="[object Array]")for(var h=0;hd[0]?1:0}),c._entries&&(c._entries={});for(var p=0;p1?i(d[1]):"")}})})(typeof global!="undefined"?global:typeof window!="undefined"?window:typeof self!="undefined"?self:Er);(function(e){var t=function(){try{var o=new e.URL("b","http://a");return o.pathname="c d",o.href==="http://a/c%20d"&&o.searchParams}catch(i){return!1}},r=function(){var o=e.URL,i=function(f,c){typeof f!="string"&&(f=String(f)),c&&typeof c!="string"&&(c=String(c));var u=document,p;if(c&&(e.location===void 0||c!==e.location.href)){c=c.toLowerCase(),u=document.implementation.createHTMLDocument(""),p=u.createElement("base"),p.href=c,u.head.appendChild(p);try{if(p.href.indexOf(c)!==0)throw new Error(p.href)}catch(O){throw new Error("URL unable to set base "+c+" due to "+O)}}var m=u.createElement("a");m.href=f,p&&(u.body.appendChild(m),m.href=m.href);var d=u.createElement("input");if(d.type="url",d.value=f,m.protocol===":"||!/:/.test(m.href)||!d.checkValidity()&&!c)throw new TypeError("Invalid URL");Object.defineProperty(this,"_anchorElement",{value:m});var h=new e.URLSearchParams(this.search),v=!0,Y=!0,B=this;["append","delete","set"].forEach(function(O){var Qe=h[O];h[O]=function(){Qe.apply(h,arguments),v&&(Y=!1,B.search=h.toString(),Y=!0)}}),Object.defineProperty(this,"searchParams",{value:h,enumerable:!0});var N=void 0;Object.defineProperty(this,"_updateSearchParams",{enumerable:!1,configurable:!1,writable:!1,value:function(){this.search!==N&&(N=this.search,Y&&(v=!1,this.searchParams._fromString(this.search),v=!0))}})},s=i.prototype,a=function(f){Object.defineProperty(s,f,{get:function(){return this._anchorElement[f]},set:function(c){this._anchorElement[f]=c},enumerable:!0})};["hash","host","hostname","port","protocol"].forEach(function(f){a(f)}),Object.defineProperty(s,"search",{get:function(){return this._anchorElement.search},set:function(f){this._anchorElement.search=f,this._updateSearchParams()},enumerable:!0}),Object.defineProperties(s,{toString:{get:function(){var f=this;return function(){return f.href}}},href:{get:function(){return this._anchorElement.href.replace(/\?$/,"")},set:function(f){this._anchorElement.href=f,this._updateSearchParams()},enumerable:!0},pathname:{get:function(){return this._anchorElement.pathname.replace(/(^\/?)/,"/")},set:function(f){this._anchorElement.pathname=f},enumerable:!0},origin:{get:function(){var f={"http:":80,"https:":443,"ftp:":21}[this._anchorElement.protocol],c=this._anchorElement.port!=f&&this._anchorElement.port!=="";return this._anchorElement.protocol+"//"+this._anchorElement.hostname+(c?":"+this._anchorElement.port:"")},enumerable:!0},password:{get:function(){return""},set:function(f){},enumerable:!0},username:{get:function(){return""},set:function(f){},enumerable:!0}}),i.createObjectURL=function(f){return o.createObjectURL.apply(o,arguments)},i.revokeObjectURL=function(f){return o.revokeObjectURL.apply(o,arguments)},e.URL=i};if(t()||r(),e.location!==void 0&&!("origin"in e.location)){var n=function(){return e.location.protocol+"//"+e.location.hostname+(e.location.port?":"+e.location.port:"")};try{Object.defineProperty(e.location,"origin",{get:n,enumerable:!0})}catch(o){setInterval(function(){e.location.origin=n()},100)}}})(typeof global!="undefined"?global:typeof window!="undefined"?window:typeof self!="undefined"?self:Er)});var qr=Pt((Mt,Nr)=>{/*! - * clipboard.js v2.0.11 - * https://clipboardjs.com/ - * - * Licensed MIT © Zeno Rocha - */(function(t,r){typeof Mt=="object"&&typeof Nr=="object"?Nr.exports=r():typeof define=="function"&&define.amd?define([],r):typeof Mt=="object"?Mt.ClipboardJS=r():t.ClipboardJS=r()})(Mt,function(){return function(){var e={686:function(n,o,i){"use strict";i.d(o,{default:function(){return Ai}});var s=i(279),a=i.n(s),f=i(370),c=i.n(f),u=i(817),p=i.n(u);function m(j){try{return document.execCommand(j)}catch(T){return!1}}var d=function(T){var E=p()(T);return m("cut"),E},h=d;function v(j){var T=document.documentElement.getAttribute("dir")==="rtl",E=document.createElement("textarea");E.style.fontSize="12pt",E.style.border="0",E.style.padding="0",E.style.margin="0",E.style.position="absolute",E.style[T?"right":"left"]="-9999px";var H=window.pageYOffset||document.documentElement.scrollTop;return E.style.top="".concat(H,"px"),E.setAttribute("readonly",""),E.value=j,E}var Y=function(T,E){var H=v(T);E.container.appendChild(H);var I=p()(H);return m("copy"),H.remove(),I},B=function(T){var E=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{container:document.body},H="";return typeof T=="string"?H=Y(T,E):T instanceof HTMLInputElement&&!["text","search","url","tel","password"].includes(T==null?void 0:T.type)?H=Y(T.value,E):(H=p()(T),m("copy")),H},N=B;function O(j){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?O=function(E){return typeof E}:O=function(E){return E&&typeof Symbol=="function"&&E.constructor===Symbol&&E!==Symbol.prototype?"symbol":typeof E},O(j)}var Qe=function(){var T=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},E=T.action,H=E===void 0?"copy":E,I=T.container,q=T.target,Me=T.text;if(H!=="copy"&&H!=="cut")throw new Error('Invalid "action" value, use either "copy" or "cut"');if(q!==void 0)if(q&&O(q)==="object"&&q.nodeType===1){if(H==="copy"&&q.hasAttribute("disabled"))throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');if(H==="cut"&&(q.hasAttribute("readonly")||q.hasAttribute("disabled")))throw new Error(`Invalid "target" attribute. You can't cut text from elements with "readonly" or "disabled" attributes`)}else throw new Error('Invalid "target" value, use a valid Element');if(Me)return N(Me,{container:I});if(q)return H==="cut"?h(q):N(q,{container:I})},De=Qe;function $e(j){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?$e=function(E){return typeof E}:$e=function(E){return E&&typeof Symbol=="function"&&E.constructor===Symbol&&E!==Symbol.prototype?"symbol":typeof E},$e(j)}function Ei(j,T){if(!(j instanceof T))throw new TypeError("Cannot call a class as a function")}function tn(j,T){for(var E=0;E0&&arguments[0]!==void 0?arguments[0]:{};this.action=typeof I.action=="function"?I.action:this.defaultAction,this.target=typeof I.target=="function"?I.target:this.defaultTarget,this.text=typeof I.text=="function"?I.text:this.defaultText,this.container=$e(I.container)==="object"?I.container:document.body}},{key:"listenClick",value:function(I){var q=this;this.listener=c()(I,"click",function(Me){return q.onClick(Me)})}},{key:"onClick",value:function(I){var q=I.delegateTarget||I.currentTarget,Me=this.action(q)||"copy",kt=De({action:Me,container:this.container,target:this.target(q),text:this.text(q)});this.emit(kt?"success":"error",{action:Me,text:kt,trigger:q,clearSelection:function(){q&&q.focus(),window.getSelection().removeAllRanges()}})}},{key:"defaultAction",value:function(I){return vr("action",I)}},{key:"defaultTarget",value:function(I){var q=vr("target",I);if(q)return document.querySelector(q)}},{key:"defaultText",value:function(I){return vr("text",I)}},{key:"destroy",value:function(){this.listener.destroy()}}],[{key:"copy",value:function(I){var q=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{container:document.body};return N(I,q)}},{key:"cut",value:function(I){return h(I)}},{key:"isSupported",value:function(){var I=arguments.length>0&&arguments[0]!==void 0?arguments[0]:["copy","cut"],q=typeof I=="string"?[I]:I,Me=!!document.queryCommandSupported;return q.forEach(function(kt){Me=Me&&!!document.queryCommandSupported(kt)}),Me}}]),E}(a()),Ai=Li},828:function(n){var o=9;if(typeof Element!="undefined"&&!Element.prototype.matches){var i=Element.prototype;i.matches=i.matchesSelector||i.mozMatchesSelector||i.msMatchesSelector||i.oMatchesSelector||i.webkitMatchesSelector}function s(a,f){for(;a&&a.nodeType!==o;){if(typeof a.matches=="function"&&a.matches(f))return a;a=a.parentNode}}n.exports=s},438:function(n,o,i){var s=i(828);function a(u,p,m,d,h){var v=c.apply(this,arguments);return u.addEventListener(m,v,h),{destroy:function(){u.removeEventListener(m,v,h)}}}function f(u,p,m,d,h){return typeof u.addEventListener=="function"?a.apply(null,arguments):typeof m=="function"?a.bind(null,document).apply(null,arguments):(typeof u=="string"&&(u=document.querySelectorAll(u)),Array.prototype.map.call(u,function(v){return a(v,p,m,d,h)}))}function c(u,p,m,d){return function(h){h.delegateTarget=s(h.target,p),h.delegateTarget&&d.call(u,h)}}n.exports=f},879:function(n,o){o.node=function(i){return i!==void 0&&i instanceof HTMLElement&&i.nodeType===1},o.nodeList=function(i){var s=Object.prototype.toString.call(i);return i!==void 0&&(s==="[object NodeList]"||s==="[object HTMLCollection]")&&"length"in i&&(i.length===0||o.node(i[0]))},o.string=function(i){return typeof i=="string"||i instanceof String},o.fn=function(i){var s=Object.prototype.toString.call(i);return s==="[object Function]"}},370:function(n,o,i){var s=i(879),a=i(438);function f(m,d,h){if(!m&&!d&&!h)throw new Error("Missing required arguments");if(!s.string(d))throw new TypeError("Second argument must be a String");if(!s.fn(h))throw new TypeError("Third argument must be a Function");if(s.node(m))return c(m,d,h);if(s.nodeList(m))return u(m,d,h);if(s.string(m))return p(m,d,h);throw new TypeError("First argument must be a String, HTMLElement, HTMLCollection, or NodeList")}function c(m,d,h){return m.addEventListener(d,h),{destroy:function(){m.removeEventListener(d,h)}}}function u(m,d,h){return Array.prototype.forEach.call(m,function(v){v.addEventListener(d,h)}),{destroy:function(){Array.prototype.forEach.call(m,function(v){v.removeEventListener(d,h)})}}}function p(m,d,h){return a(document.body,m,d,h)}n.exports=f},817:function(n){function o(i){var s;if(i.nodeName==="SELECT")i.focus(),s=i.value;else if(i.nodeName==="INPUT"||i.nodeName==="TEXTAREA"){var a=i.hasAttribute("readonly");a||i.setAttribute("readonly",""),i.select(),i.setSelectionRange(0,i.value.length),a||i.removeAttribute("readonly"),s=i.value}else{i.hasAttribute("contenteditable")&&i.focus();var f=window.getSelection(),c=document.createRange();c.selectNodeContents(i),f.removeAllRanges(),f.addRange(c),s=f.toString()}return s}n.exports=o},279:function(n){function o(){}o.prototype={on:function(i,s,a){var f=this.e||(this.e={});return(f[i]||(f[i]=[])).push({fn:s,ctx:a}),this},once:function(i,s,a){var f=this;function c(){f.off(i,c),s.apply(a,arguments)}return c._=s,this.on(i,c,a)},emit:function(i){var s=[].slice.call(arguments,1),a=((this.e||(this.e={}))[i]||[]).slice(),f=0,c=a.length;for(f;f{"use strict";/*! - * escape-html - * Copyright(c) 2012-2013 TJ Holowaychuk - * Copyright(c) 2015 Andreas Lubbe - * Copyright(c) 2015 Tiancheng "Timothy" Gu - * MIT Licensed - */var rs=/["'&<>]/;Yo.exports=ns;function ns(e){var t=""+e,r=rs.exec(t);if(!r)return t;var n,o="",i=0,s=0;for(i=r.index;i0&&i[i.length-1])&&(c[0]===6||c[0]===2)){r=0;continue}if(c[0]===3&&(!i||c[1]>i[0]&&c[1]=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function W(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),o,i=[],s;try{for(;(t===void 0||t-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(a){s={error:a}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return i}function D(e,t,r){if(r||arguments.length===2)for(var n=0,o=t.length,i;n1||a(m,d)})})}function a(m,d){try{f(n[m](d))}catch(h){p(i[0][3],h)}}function f(m){m.value instanceof et?Promise.resolve(m.value.v).then(c,u):p(i[0][2],m)}function c(m){a("next",m)}function u(m){a("throw",m)}function p(m,d){m(d),i.shift(),i.length&&a(i[0][0],i[0][1])}}function pn(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],r;return t?t.call(e):(e=typeof Ee=="function"?Ee(e):e[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(i){r[i]=e[i]&&function(s){return new Promise(function(a,f){s=e[i](s),o(a,f,s.done,s.value)})}}function o(i,s,a,f){Promise.resolve(f).then(function(c){i({value:c,done:a})},s)}}function C(e){return typeof e=="function"}function at(e){var t=function(n){Error.call(n),n.stack=new Error().stack},r=e(t);return r.prototype=Object.create(Error.prototype),r.prototype.constructor=r,r}var It=at(function(e){return function(r){e(this),this.message=r?r.length+` errors occurred during unsubscription: -`+r.map(function(n,o){return o+1+") "+n.toString()}).join(` - `):"",this.name="UnsubscriptionError",this.errors=r}});function Ve(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}var Ie=function(){function e(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}return e.prototype.unsubscribe=function(){var t,r,n,o,i;if(!this.closed){this.closed=!0;var s=this._parentage;if(s)if(this._parentage=null,Array.isArray(s))try{for(var a=Ee(s),f=a.next();!f.done;f=a.next()){var c=f.value;c.remove(this)}}catch(v){t={error:v}}finally{try{f&&!f.done&&(r=a.return)&&r.call(a)}finally{if(t)throw t.error}}else s.remove(this);var u=this.initialTeardown;if(C(u))try{u()}catch(v){i=v instanceof It?v.errors:[v]}var p=this._finalizers;if(p){this._finalizers=null;try{for(var m=Ee(p),d=m.next();!d.done;d=m.next()){var h=d.value;try{ln(h)}catch(v){i=i!=null?i:[],v instanceof It?i=D(D([],W(i)),W(v.errors)):i.push(v)}}}catch(v){n={error:v}}finally{try{d&&!d.done&&(o=m.return)&&o.call(m)}finally{if(n)throw n.error}}}if(i)throw new It(i)}},e.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)ln(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=(r=this._finalizers)!==null&&r!==void 0?r:[]).push(t)}},e.prototype._hasParent=function(t){var r=this._parentage;return r===t||Array.isArray(r)&&r.includes(t)},e.prototype._addParent=function(t){var r=this._parentage;this._parentage=Array.isArray(r)?(r.push(t),r):r?[r,t]:t},e.prototype._removeParent=function(t){var r=this._parentage;r===t?this._parentage=null:Array.isArray(r)&&Ve(r,t)},e.prototype.remove=function(t){var r=this._finalizers;r&&Ve(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=function(){var t=new e;return t.closed=!0,t}(),e}();var Sr=Ie.EMPTY;function jt(e){return e instanceof Ie||e&&"closed"in e&&C(e.remove)&&C(e.add)&&C(e.unsubscribe)}function ln(e){C(e)?e():e.unsubscribe()}var Le={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};var st={setTimeout:function(e,t){for(var r=[],n=2;n0},enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(r){return this._throwIfClosed(),e.prototype._trySubscribe.call(this,r)},t.prototype._subscribe=function(r){return this._throwIfClosed(),this._checkFinalizedStatuses(r),this._innerSubscribe(r)},t.prototype._innerSubscribe=function(r){var n=this,o=this,i=o.hasError,s=o.isStopped,a=o.observers;return i||s?Sr:(this.currentObservers=null,a.push(r),new Ie(function(){n.currentObservers=null,Ve(a,r)}))},t.prototype._checkFinalizedStatuses=function(r){var n=this,o=n.hasError,i=n.thrownError,s=n.isStopped;o?r.error(i):s&&r.complete()},t.prototype.asObservable=function(){var r=new F;return r.source=this,r},t.create=function(r,n){return new xn(r,n)},t}(F);var xn=function(e){ie(t,e);function t(r,n){var o=e.call(this)||this;return o.destination=r,o.source=n,o}return t.prototype.next=function(r){var n,o;(o=(n=this.destination)===null||n===void 0?void 0:n.next)===null||o===void 0||o.call(n,r)},t.prototype.error=function(r){var n,o;(o=(n=this.destination)===null||n===void 0?void 0:n.error)===null||o===void 0||o.call(n,r)},t.prototype.complete=function(){var r,n;(n=(r=this.destination)===null||r===void 0?void 0:r.complete)===null||n===void 0||n.call(r)},t.prototype._subscribe=function(r){var n,o;return(o=(n=this.source)===null||n===void 0?void 0:n.subscribe(r))!==null&&o!==void 0?o:Sr},t}(x);var Et={now:function(){return(Et.delegate||Date).now()},delegate:void 0};var wt=function(e){ie(t,e);function t(r,n,o){r===void 0&&(r=1/0),n===void 0&&(n=1/0),o===void 0&&(o=Et);var i=e.call(this)||this;return i._bufferSize=r,i._windowTime=n,i._timestampProvider=o,i._buffer=[],i._infiniteTimeWindow=!0,i._infiniteTimeWindow=n===1/0,i._bufferSize=Math.max(1,r),i._windowTime=Math.max(1,n),i}return t.prototype.next=function(r){var n=this,o=n.isStopped,i=n._buffer,s=n._infiniteTimeWindow,a=n._timestampProvider,f=n._windowTime;o||(i.push(r),!s&&i.push(a.now()+f)),this._trimBuffer(),e.prototype.next.call(this,r)},t.prototype._subscribe=function(r){this._throwIfClosed(),this._trimBuffer();for(var n=this._innerSubscribe(r),o=this,i=o._infiniteTimeWindow,s=o._buffer,a=s.slice(),f=0;f0?e.prototype.requestAsyncId.call(this,r,n,o):(r.actions.push(this),r._scheduled||(r._scheduled=ut.requestAnimationFrame(function(){return r.flush(void 0)})))},t.prototype.recycleAsyncId=function(r,n,o){var i;if(o===void 0&&(o=0),o!=null?o>0:this.delay>0)return e.prototype.recycleAsyncId.call(this,r,n,o);var s=r.actions;n!=null&&((i=s[s.length-1])===null||i===void 0?void 0:i.id)!==n&&(ut.cancelAnimationFrame(n),r._scheduled=void 0)},t}(Wt);var Sn=function(e){ie(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.flush=function(r){this._active=!0;var n=this._scheduled;this._scheduled=void 0;var o=this.actions,i;r=r||o.shift();do if(i=r.execute(r.state,r.delay))break;while((r=o[0])&&r.id===n&&o.shift());if(this._active=!1,i){for(;(r=o[0])&&r.id===n&&o.shift();)r.unsubscribe();throw i}},t}(Dt);var Oe=new Sn(wn);var M=new F(function(e){return e.complete()});function Vt(e){return e&&C(e.schedule)}function Cr(e){return e[e.length-1]}function Ye(e){return C(Cr(e))?e.pop():void 0}function Te(e){return Vt(Cr(e))?e.pop():void 0}function zt(e,t){return typeof Cr(e)=="number"?e.pop():t}var pt=function(e){return e&&typeof e.length=="number"&&typeof e!="function"};function Nt(e){return C(e==null?void 0:e.then)}function qt(e){return C(e[ft])}function Kt(e){return Symbol.asyncIterator&&C(e==null?void 0:e[Symbol.asyncIterator])}function Qt(e){return new TypeError("You provided "+(e!==null&&typeof e=="object"?"an invalid object":"'"+e+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}function zi(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var Yt=zi();function Gt(e){return C(e==null?void 0:e[Yt])}function Bt(e){return un(this,arguments,function(){var r,n,o,i;return $t(this,function(s){switch(s.label){case 0:r=e.getReader(),s.label=1;case 1:s.tries.push([1,,9,10]),s.label=2;case 2:return[4,et(r.read())];case 3:return n=s.sent(),o=n.value,i=n.done,i?[4,et(void 0)]:[3,5];case 4:return[2,s.sent()];case 5:return[4,et(o)];case 6:return[4,s.sent()];case 7:return s.sent(),[3,2];case 8:return[3,10];case 9:return r.releaseLock(),[7];case 10:return[2]}})})}function Jt(e){return C(e==null?void 0:e.getReader)}function U(e){if(e instanceof F)return e;if(e!=null){if(qt(e))return Ni(e);if(pt(e))return qi(e);if(Nt(e))return Ki(e);if(Kt(e))return On(e);if(Gt(e))return Qi(e);if(Jt(e))return Yi(e)}throw Qt(e)}function Ni(e){return new F(function(t){var r=e[ft]();if(C(r.subscribe))return r.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function qi(e){return new F(function(t){for(var r=0;r=2;return function(n){return n.pipe(e?A(function(o,i){return e(o,i,n)}):de,ge(1),r?He(t):Dn(function(){return new Zt}))}}function Vn(){for(var e=[],t=0;t=2,!0))}function pe(e){e===void 0&&(e={});var t=e.connector,r=t===void 0?function(){return new x}:t,n=e.resetOnError,o=n===void 0?!0:n,i=e.resetOnComplete,s=i===void 0?!0:i,a=e.resetOnRefCountZero,f=a===void 0?!0:a;return function(c){var u,p,m,d=0,h=!1,v=!1,Y=function(){p==null||p.unsubscribe(),p=void 0},B=function(){Y(),u=m=void 0,h=v=!1},N=function(){var O=u;B(),O==null||O.unsubscribe()};return y(function(O,Qe){d++,!v&&!h&&Y();var De=m=m!=null?m:r();Qe.add(function(){d--,d===0&&!v&&!h&&(p=$r(N,f))}),De.subscribe(Qe),!u&&d>0&&(u=new rt({next:function($e){return De.next($e)},error:function($e){v=!0,Y(),p=$r(B,o,$e),De.error($e)},complete:function(){h=!0,Y(),p=$r(B,s),De.complete()}}),U(O).subscribe(u))})(c)}}function $r(e,t){for(var r=[],n=2;ne.next(document)),e}function K(e,t=document){return Array.from(t.querySelectorAll(e))}function z(e,t=document){let r=ce(e,t);if(typeof r=="undefined")throw new ReferenceError(`Missing element: expected "${e}" to be present`);return r}function ce(e,t=document){return t.querySelector(e)||void 0}function _e(){return document.activeElement instanceof HTMLElement&&document.activeElement||void 0}function tr(e){return L(b(document.body,"focusin"),b(document.body,"focusout")).pipe(ke(1),l(()=>{let t=_e();return typeof t!="undefined"?e.contains(t):!1}),V(e===_e()),J())}function Xe(e){return{x:e.offsetLeft,y:e.offsetTop}}function Kn(e){return L(b(window,"load"),b(window,"resize")).pipe(Ce(0,Oe),l(()=>Xe(e)),V(Xe(e)))}function rr(e){return{x:e.scrollLeft,y:e.scrollTop}}function dt(e){return L(b(e,"scroll"),b(window,"resize")).pipe(Ce(0,Oe),l(()=>rr(e)),V(rr(e)))}var Yn=function(){if(typeof Map!="undefined")return Map;function e(t,r){var n=-1;return t.some(function(o,i){return o[0]===r?(n=i,!0):!1}),n}return function(){function t(){this.__entries__=[]}return Object.defineProperty(t.prototype,"size",{get:function(){return this.__entries__.length},enumerable:!0,configurable:!0}),t.prototype.get=function(r){var n=e(this.__entries__,r),o=this.__entries__[n];return o&&o[1]},t.prototype.set=function(r,n){var o=e(this.__entries__,r);~o?this.__entries__[o][1]=n:this.__entries__.push([r,n])},t.prototype.delete=function(r){var n=this.__entries__,o=e(n,r);~o&&n.splice(o,1)},t.prototype.has=function(r){return!!~e(this.__entries__,r)},t.prototype.clear=function(){this.__entries__.splice(0)},t.prototype.forEach=function(r,n){n===void 0&&(n=null);for(var o=0,i=this.__entries__;o0},e.prototype.connect_=function(){!Wr||this.connected_||(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),va?(this.mutationsObserver_=new MutationObserver(this.refresh),this.mutationsObserver_.observe(document,{attributes:!0,childList:!0,characterData:!0,subtree:!0})):(document.addEventListener("DOMSubtreeModified",this.refresh),this.mutationEventsAdded_=!0),this.connected_=!0)},e.prototype.disconnect_=function(){!Wr||!this.connected_||(document.removeEventListener("transitionend",this.onTransitionEnd_),window.removeEventListener("resize",this.refresh),this.mutationsObserver_&&this.mutationsObserver_.disconnect(),this.mutationEventsAdded_&&document.removeEventListener("DOMSubtreeModified",this.refresh),this.mutationsObserver_=null,this.mutationEventsAdded_=!1,this.connected_=!1)},e.prototype.onTransitionEnd_=function(t){var r=t.propertyName,n=r===void 0?"":r,o=ba.some(function(i){return!!~n.indexOf(i)});o&&this.refresh()},e.getInstance=function(){return this.instance_||(this.instance_=new e),this.instance_},e.instance_=null,e}(),Gn=function(e,t){for(var r=0,n=Object.keys(t);r0},e}(),Jn=typeof WeakMap!="undefined"?new WeakMap:new Yn,Xn=function(){function e(t){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function.");if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");var r=ga.getInstance(),n=new La(t,r,this);Jn.set(this,n)}return e}();["observe","unobserve","disconnect"].forEach(function(e){Xn.prototype[e]=function(){var t;return(t=Jn.get(this))[e].apply(t,arguments)}});var Aa=function(){return typeof nr.ResizeObserver!="undefined"?nr.ResizeObserver:Xn}(),Zn=Aa;var eo=new x,Ca=$(()=>k(new Zn(e=>{for(let t of e)eo.next(t)}))).pipe(g(e=>L(ze,k(e)).pipe(R(()=>e.disconnect()))),X(1));function he(e){return{width:e.offsetWidth,height:e.offsetHeight}}function ye(e){return Ca.pipe(S(t=>t.observe(e)),g(t=>eo.pipe(A(({target:r})=>r===e),R(()=>t.unobserve(e)),l(()=>he(e)))),V(he(e)))}function bt(e){return{width:e.scrollWidth,height:e.scrollHeight}}function ar(e){let t=e.parentElement;for(;t&&(e.scrollWidth<=t.scrollWidth&&e.scrollHeight<=t.scrollHeight);)t=(e=t).parentElement;return t?e:void 0}var to=new x,Ra=$(()=>k(new IntersectionObserver(e=>{for(let t of e)to.next(t)},{threshold:0}))).pipe(g(e=>L(ze,k(e)).pipe(R(()=>e.disconnect()))),X(1));function sr(e){return Ra.pipe(S(t=>t.observe(e)),g(t=>to.pipe(A(({target:r})=>r===e),R(()=>t.unobserve(e)),l(({isIntersecting:r})=>r))))}function ro(e,t=16){return dt(e).pipe(l(({y:r})=>{let n=he(e),o=bt(e);return r>=o.height-n.height-t}),J())}var cr={drawer:z("[data-md-toggle=drawer]"),search:z("[data-md-toggle=search]")};function no(e){return cr[e].checked}function Ke(e,t){cr[e].checked!==t&&cr[e].click()}function Ue(e){let t=cr[e];return b(t,"change").pipe(l(()=>t.checked),V(t.checked))}function ka(e,t){switch(e.constructor){case HTMLInputElement:return e.type==="radio"?/^Arrow/.test(t):!0;case HTMLSelectElement:case HTMLTextAreaElement:return!0;default:return e.isContentEditable}}function Ha(){return L(b(window,"compositionstart").pipe(l(()=>!0)),b(window,"compositionend").pipe(l(()=>!1))).pipe(V(!1))}function oo(){let e=b(window,"keydown").pipe(A(t=>!(t.metaKey||t.ctrlKey)),l(t=>({mode:no("search")?"search":"global",type:t.key,claim(){t.preventDefault(),t.stopPropagation()}})),A(({mode:t,type:r})=>{if(t==="global"){let n=_e();if(typeof n!="undefined")return!ka(n,r)}return!0}),pe());return Ha().pipe(g(t=>t?M:e))}function le(){return new URL(location.href)}function ot(e){location.href=e.href}function io(){return new x}function ao(e,t){if(typeof t=="string"||typeof t=="number")e.innerHTML+=t.toString();else if(t instanceof Node)e.appendChild(t);else if(Array.isArray(t))for(let r of t)ao(e,r)}function _(e,t,...r){let n=document.createElement(e);if(t)for(let o of Object.keys(t))typeof t[o]!="undefined"&&(typeof t[o]!="boolean"?n.setAttribute(o,t[o]):n.setAttribute(o,""));for(let o of r)ao(n,o);return n}function fr(e){if(e>999){let t=+((e-950)%1e3>99);return`${((e+1e-6)/1e3).toFixed(t)}k`}else return e.toString()}function so(){return location.hash.substring(1)}function Dr(e){let t=_("a",{href:e});t.addEventListener("click",r=>r.stopPropagation()),t.click()}function Pa(e){return L(b(window,"hashchange"),e).pipe(l(so),V(so()),A(t=>t.length>0),X(1))}function co(e){return Pa(e).pipe(l(t=>ce(`[id="${t}"]`)),A(t=>typeof t!="undefined"))}function Vr(e){let t=matchMedia(e);return er(r=>t.addListener(()=>r(t.matches))).pipe(V(t.matches))}function fo(){let e=matchMedia("print");return L(b(window,"beforeprint").pipe(l(()=>!0)),b(window,"afterprint").pipe(l(()=>!1))).pipe(V(e.matches))}function zr(e,t){return e.pipe(g(r=>r?t():M))}function ur(e,t={credentials:"same-origin"}){return ue(fetch(`${e}`,t)).pipe(fe(()=>M),g(r=>r.status!==200?Ot(()=>new Error(r.statusText)):k(r)))}function We(e,t){return ur(e,t).pipe(g(r=>r.json()),X(1))}function uo(e,t){let r=new DOMParser;return ur(e,t).pipe(g(n=>n.text()),l(n=>r.parseFromString(n,"text/xml")),X(1))}function pr(e){let t=_("script",{src:e});return $(()=>(document.head.appendChild(t),L(b(t,"load"),b(t,"error").pipe(g(()=>Ot(()=>new ReferenceError(`Invalid script: ${e}`))))).pipe(l(()=>{}),R(()=>document.head.removeChild(t)),ge(1))))}function po(){return{x:Math.max(0,scrollX),y:Math.max(0,scrollY)}}function lo(){return L(b(window,"scroll",{passive:!0}),b(window,"resize",{passive:!0})).pipe(l(po),V(po()))}function mo(){return{width:innerWidth,height:innerHeight}}function ho(){return b(window,"resize",{passive:!0}).pipe(l(mo),V(mo()))}function bo(){return G([lo(),ho()]).pipe(l(([e,t])=>({offset:e,size:t})),X(1))}function lr(e,{viewport$:t,header$:r}){let n=t.pipe(ee("size")),o=G([n,r]).pipe(l(()=>Xe(e)));return G([r,t,o]).pipe(l(([{height:i},{offset:s,size:a},{x:f,y:c}])=>({offset:{x:s.x-f,y:s.y-c+i},size:a})))}(()=>{function e(n,o){parent.postMessage(n,o||"*")}function t(...n){return n.reduce((o,i)=>o.then(()=>new Promise(s=>{let a=document.createElement("script");a.src=i,a.onload=s,document.body.appendChild(a)})),Promise.resolve())}var r=class extends EventTarget{constructor(n){super(),this.url=n,this.m=i=>{i.source===this.w&&(this.dispatchEvent(new MessageEvent("message",{data:i.data})),this.onmessage&&this.onmessage(i))},this.e=(i,s,a,f,c)=>{if(s===`${this.url}`){let u=new ErrorEvent("error",{message:i,filename:s,lineno:a,colno:f,error:c});this.dispatchEvent(u),this.onerror&&this.onerror(u)}};let o=document.createElement("iframe");o.hidden=!0,document.body.appendChild(this.iframe=o),this.w.document.open(),this.w.document.write(` - - - - - - - - - - - - - - - - - - - -
- -
- - - - - - -
- - -
- -
- - - - - - -
-
- - - -
-
-
- - - - -
-
-
- - - -
-
- -
-
- - - -
-
- - - - - - - -

Commands

- -

Codeception commands provided by the library

-

The library provides some custom commands that can be added to the project Codeception configuration file ( -either codeception.yml or codeception.dist.yml).

-

run and codeception:run

-

WordPress extensive use of global variables, constants and side effectes makes it difficult to run multiple test suites -in the same process without running into conflicts due to leaking state and side effects. -For this reason the project replaces Codeception run command with one that will run each suite in a separate process. -You can invoke the original Codeception command using the codeception:run command. -Just like the original, the run command accepts all the arguments and options of the original Codeception -command.

-

Run all the suites, each one in a separate process:

-
vendor/bin/codecept run
-
-

Run only the Integration suite:

-
vendor/bin/codecept run Integration
-
-

Run a specific test file:

-
vendor/bin/codecept run Integration tests/Integration/MyTest.php
-
-

Run a specific test method:

-
vendor/bin/codecept run Integration tests/Integration/MyTest.php:testMyMethod
-
-

Read the Codeception documentation for more information about the run command.

-

dev:start

-

If not already running, start the services required to run the tests. -The started services are read from the Codeception configuration file (either codeception.yml -or codeception.dist.yml), from the extensions section, under the config key.

-

Given the following configuration:

-
extensions:
-  enabled:
-    - lucatume\WPBrowser\Extension\ChromeDriverController
-    - lucatume\WPBrowser\Extension\BuiltInServerController
-    - lucatume\WPBrowser\Extension\DockerComposeController
-  config:
-    lucatume\WPBrowser\Extension\ChromeDriverController:
-      port: '%CHROMEDRIVER_PORT%'
-    lucatume\WPBrowser\Extension\BuiltInServerController:
-      docRoot: '%WORDPRESS_ROOT_DIR%'
-      workers: 5
-      port: '%BUILT_IN_SERVER_PORT%'
-    lucatume\WPBrowser\Extension\DockerComposeController:
-      compose-file: 'tests/docker-compose.yml'
-      env-file: 'tests/.env'
-
-

Running the command will start ChromeDriver, the built-in PHP server and Docker Compose.

-

dev:stop

-

If running, stop the services required to run the tests. -The stopped services are read from the Codeception configuration file (either codeception.yml -or codeception.dist.yml), from the extensions section, under the config key.

-

Given the following configuration:

-
extensions:
-  enabled:
-    - lucatume\WPBrowser\Extension\ChromeDriverController
-    - lucatume\WPBrowser\Extension\BuiltInServerController
-    - lucatume\WPBrowser\Extension\DockerComposeController
-  config:
-    lucatume\WPBrowser\Extension\ChromeDriverController:
-      port: '%CHROMEDRIVER_PORT%'
-    lucatume\WPBrowser\Extension\BuiltInServerController:
-      docRoot: '%WORDPRESS_ROOT_DIR%'
-      workers: 5
-      port: '%BUILT_IN_SERVER_PORT%'
-    lucatume\WPBrowser\Extension\DockerComposeController:
-      compose-file: 'tests/docker-compose.yml'
-      env-file: 'tests/.env'
-
-

Running the command will stop ChromeDriver, the built-in PHP server and Docker Compose.

-

dev:restart

-

This command is just a shortcut to run dev:stop and dev:start in sequence.

-

dev:info

-

Provides information about the local testing stack managed by -the DockerComposeController, BuiltInServerController -and ChromeDriverController extensions.

-

wp:db:import

-

You can use WP CLI to interact with your WordPress installation, but WP CLI does not support SQLite databases in -the context of the wp db import command. -This command fills that gap by providing a database dump file import command that will support MySQL and SQLite -databases.

-

wp:db:export

-

You can use WP CLI to interact with your WordPress installation, but WP CLI does not support SQLite databases in -the context of the wp db export command. -This command fills that gap by providing a database dump file export command that will support MySQL and SQLite -databases.

-

chromedriver:update

-

If you're using Chromedriver as a binary installed in the Composer vendor directory (vendor/bin by default), you can -use this command to update it. -This command will download the latest version of Chromedriver compatible with the Chrome version installed on your -machine in the Composer vendor directory.

-

generate:wpunit

-

Generate a test case extending the lucatume\WPBrowser\TestCase\WPTestCase class. -The class incorporates the WordPress test case from the wordpress-develop repository and adds some utility -methods to make testing easier in the context of Codeception.

-

The lucatume\WPBrowser\TestCase\WPTestCase class is the one that should be used when writing tests for WordPress -code when using the WPLoader module.

-

Together with the WPLoader module, the WPTestCase class provides a number of functionalities to clean up the -database -after each test method and to reset the global state of WordPress.

-

Every test method runs in a transaction

-

Database queries running in the context of test methods of a test case extending the WPTestCase class will run in a -transaction that is rolled back after the test method is run. This means that any database change happening in the -context of a test method will not appear in the database while the test is running and after the test is run.

- - - - - - -
-
- - -
- -
- - - -
-
-
-
- - - - - - - - - \ No newline at end of file diff --git a/docs/public/custom-configuration/index.html b/docs/public/custom-configuration/index.html deleted file mode 100644 index b3100a39b..000000000 --- a/docs/public/custom-configuration/index.html +++ /dev/null @@ -1,386 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - Custom configuration - wp-browser docs - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
- - - - - - -
- - -
- -
- - - - - - -
-
- - - -
-
-
- - - - -
-
-
- - - -
- -
- - - -
-
- - - - - - - -

Custom configuration

- -

Custom testing configuration

-

Any non default configuration is considered a custom configuration.
-If your project requires a tailored set up, this is the configuration for you.

-

Using a custom configuration to run tests

-

If you decide to skip the default configuration, or are working -on a project that cannot use the default configuration -you will be able to set up wp-browser to suit your needs using a custom configuration.

-

Choose "no", to not use the default configuration, when running the vendor/bin/codecept init wpbrowser command.

-

The command will set up the file structure to be able to run integration and end-to-end tests and will -leverage Codeception dynamic configuration using parameters to control the testing stack using the tests/.env -file.

-

Walkthrough of the tests/.env file

-
    -
  • WORDPRESS_ROOT_DIR - the path to the root WordPress installation directory. This is the directory that contains - WordPress files, like wp-load.php. This path can be absolute or relative to the root project directory; - e.g. vendor/wordpress (relative) or /var/www/wordpress (absolute) will work.
  • -
  • WORDPRESS_URL - the URL of the WordPress installation. This is the URL that will be used by the browser to access - the WordPress - installation in the context of end-to-end tests; e.g. http://localhost:8080 or https://wordpress.local.
  • -
  • WORDPRESS_DOMAIN - the domain of the WordPress installation; this value should follow the WORDPRESS_URL value. - E.g. if WORDPRESS_URL is http://localhost:8080 the WORDPRESS_DOMAIN value should be localhost:8080; - if WORDPRESS_URL is https://wordpress.local the WORDPRESS_DOMAIN value should be wordpress.local.
  • -
  • WORDPRESS_DB_URL - the user, password, host, and name of the database used by the tests. If the database is a MySQL - database, the value should be in the form mysql://user:password@host:port/database_name. - If the database is a SQLite database, the value should be in the form sqlite://path/to/database/file.
  • -
  • WORDPRESS_TABLE_PREFIX - the database table prefix used by the WordPress installation, the one served - at WORDPRESS_URL. - This value is usually wp_ but can be different if the WordPress installation has been configured to use a different - prefix.
  • -
  • TEST_TABLE_PREFIX - the database table prefix used by the WPLoader module to - install WordPress and run the tests. This value is usually test_ and should be different from - the WORDPRESS_TABLE_PREFIX value.
  • -
  • WORDPRESS_ADMIN_USER - the username of the WordPress administrator user. E.g. admin.
  • -
  • WORDPRESS_ADMIN_PASSWORD - the password of the WordPress administrator user. E.g. secret!password.
  • -
  • CHROMEDRIVER_HOST - the host of the Chromedriver server. This value is usually localhost if you're running - Chromedriver on the same machine as the tests. If you're running your tests using a container stack, it will be the - name of the container running Chromedriver, e.g. chromedriver.
  • -
  • CHROMEDRIVER_PORT - the port of the Chromedriver server. This value is usually 9515 if you're running Chromedriver - on the same machine as the tests. If you're running your tests using a container stack, it will be the port exposed by - the container running Chromedriver, e.g. 4444. Note the default configuration will set - this value to a random port during set up to avoid conflicts with other services running on the same machine.
  • -
-

Handling custom file structures

-

If your site uses a customized file structure to manage WordPress, you will need to further -configure the WPLoader module to correctly look for the site content. -Read more about setting up WPLoader to correctly load plugins and themes from custom locations here.

- - - - - - -
-
- - -
- -
- - - -
-
-
-
- - - - - - - - - \ No newline at end of file diff --git a/docs/public/default-configuration/index.html b/docs/public/default-configuration/index.html deleted file mode 100644 index 7d6d7963f..000000000 --- a/docs/public/default-configuration/index.html +++ /dev/null @@ -1,432 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - Default configuration - wp-browser docs - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
- - - - - - -
- - -
- -
- - - - - - -
-
- - - -
-
-
- - - - -
-
-
- - - - - - - -
-
- - - - - - - -

Default configuration

- -

Default testing configuration

-

The recommended configuration for most projects. -It allows you to get into WordPress integration and end-to-end testing quickly and easily.

-

Requirements

-

The default configuration will set up Codeception and wp-browser to use SQLite as the database engine, PHP built-in -server to serve the test site on localhost and your local version of Chrome, driven by Chromedriver, to run end-to-end -tests.

-

As such, the default configuration has the following requirements:

-
    -
  • the sqlite3 PHP extension; you can check if if's installed by running php -m | grep sqlite3 in your terminal
  • -
  • the pdo_sqlite PHP extension; you can check if if's installed by running php -m | grep pdo_sqlite in your terminal
  • -
  • PHP built-in server can work with only one thread, but it will be faster using multiple threads; multiple threads are - not supported on Windows, but they are supported on WSL.
  • -
  • the Chrome browser installed on your machine
  • -
-

Overview - plugin and theme project

-

If you're configuring wp-browser for a plugin or theme project, the default configuration will install WordPress in -the tests/_wordpress directory and configure the installation to run using SQLite as a database engine. -The SQLite Database Integration plugin) will be placed in the installation must-use plugins directory.

-

If your plugin or theme project requires additional plugins or theme to work, you can place them in -the tests/_worpdress/wp-content/plugins and tests/_wordpress/wp-content/themes directories respectively.

-

When adding, or removing, plugin and themes, remember to -update the WPLoader module configuration to load the correct plugins and themes in -your integration tests.

-

On the same note, update the database dump used by the WPDb module to reflect the -changes in the dump loaded in the end-to-end tests. -The easiest way to update the database fixture is to load the current database dump -using the wp:db:import command, manually setting up the site interacting with it and then -exporting the database dump using the wp:db:export command.

-

You can find out about the URL of the site served by the PHP built-in web server by -running the dev:info command.

-

Overview - site project

-

If you're configuring wp-browser for a site project, the default configuration will use a combination of PHP built-in -web server and the SQLite Database Integration plugin to run the tests and serve your site.

-

The router file used by the PHP built-in web server will force the site, when served on localhost, to use SQLite as -database engine leaving your existing local MySQL database untouched.

-

Your existing WordPress installation will be picked up as it is, with all the plugins and themes found in the contents -directory.

-

Existing plugins and themes are not added to WPLoader module configuration by -wp-browser, you have to do that manually.

-

Similarly, the database dump used by the WPDb module is, by default, an empty WordPress -installation where no plugins and themes are active. -You have to update the database dump used by the module to reflect the state of your site. -You can do that by loading the current database dump using the wp:db:import command, -manually setting up the site interacting with it and then -exporting the database dump using the wp:db:export command.

-

You can find out about the URL of the site served by the PHP built-in web server by -running the dev:info command.

-

When not to use the default configuration

-

The default configuration is the recommended one for most projects, but some projects might require you to use a custom -configuration to make the most out of wp-browser.

-

Database drop-in

-

The default configuration will use the SQLite Database Integration plugin to use SQLite as the database engine. -This requires placing a db.php drop-in file in the WordPress content directory.

-

If your project already requires a db.php drop-in file, you will have to use a custom configuration.

-

Multisite with sub-domains

-

While Chrome will handle sub-domains correctly, even on localhost, WordPress will not. -If you're testing a multisite installation with sub-domains, you will have to use a custom configuration.

-

Custom site structure

-

If your site uses a customized file structure to manage WordPress, you will need to configure wp-browser using a custom -configuration. -This is usually true for some site projects, and will most likely not be an issue for plugin and theme projects.

-

Using a custom configuration is not that difficult -though: read more about using a custom configuration here.

- - - - - - -
-
- - -
- -
- - - -
-
-
-
- - - - - - - - - \ No newline at end of file diff --git a/docs/public/extensions/index.html b/docs/public/extensions/index.html deleted file mode 100644 index 50cd9a447..000000000 --- a/docs/public/extensions/index.html +++ /dev/null @@ -1,465 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - Extensions - wp-browser docs - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
- - - - - - -
- - -
- -
- - - - - - -
-
- - - -
-
-
- - - - -
-
-
- - - -
-
-
- - - -
-
-
- - - -
-
- - - - - - - -

Extensions

- -

Codeception Extensions provided by the library

-

The library provides some custom Codeception extensions that can be added to the project Codeception configuration file, -in the extensions section.

-

BuiltInServerController

-

This extension will start and stop the PHP built-in web server before and after the tests run.

-

The extension can be configured with the following parameters:

-
    -
  • required
      -
    • docRoot - the document root to use for the PHP Built-in server; it can be either an absolute path or a path - relative to the Codeception root directory.
    • -
    -
  • -
  • optional
      -
    • suites - an array of Codeception suites to run the server for; if not set the server will be started for all the - suites.
    • -
    • port - the port to use for the PHP Built-in server, if not set the server will use port 2389.
    • -
    • workers - the number of workers to use for the PHP Built-in server, if not set the server will use 5 workers. - This is the equivalent of the PHP_CLI_SERVER_WORKERS environment variable.
    • -
    -
  • -
-
-

Note: if you run PHP built-in server on Windows, the workers parameter will be ignored and the server will always -run with a single worker. This limit is not present in WSL.

-
-

Example configuration starting the server for all suites:

-
extensions:
-  enabled:
-    - lucatume\WPBrowser\Extension\BuiltInServerController
-  config:
-    lucatume\WPBrowser\Extension\BuiltInServerController:
-      docRoot: /var/www/html
-      workers: 5
-
-

The extension can access environment variables defined in the tests configuration file:

-
extensions:
-  enabled:
-    - lucatume\WPBrowser\Extension\BuiltInServerController
-  config:
-    lucatume\WPBrowser\Extension\BuiltInServerController:
-      suites:
-        - EndToEnd
-        - WebApp
-      docRoot: '%WORDPRESS_ROOT_DIR%'
-      port: '%BUILT_IN_SERVER_PORT%'
-      workers: '%BUILT_IN_SERVER_WORKERS%'
-
-

This is a service extension that will be started and stopped by the dev:start -and dev:stop commands.

-

ChromeDriverController

-

This extension will start and stop the ChromeDriver before and after the tests are run.

-

The extension can be configured with the following parameters:

-
    -
  • optional
      -
    • suites - an array of Codeception suites to run the server for; if not set the server will be started for all the - suites.
    • -
    • port - the port to use for the ChromeDriver, if not set the server will use port 9515.
    • -
    • binary - the path to the ChromeDriver binary, if not set the server will use the chromedriver binary in the - Composer bin directory.
    • -
    -
  • -
-

Example configuration starting the server for all suites:

-
extensions:
-  enabled:
-    - lucatume\WPBrowser\Extension\ChromeDriverController
-  config:
-    lucatume\WPBrowser\Extension\ChromeDriverController:
-      port: 4444
-      binary: /usr/local/bin/chromedriver
-
-

The extension can access environment variables defined in the tests configuration file:

-
extensions:
-  enabled:
-    - lucatume\WPBrowser\Extension\ChromeDriverController
-  config:
-    suites:
-      - EndToEnd
-      - WebApp
-    lucatume\WPBrowser\Extension\ChromeDriverController:
-      port: '%CHROMEDRIVER_PORT%'
-      binary: '%CHROMEDRIVER_BINARY%'
-
-

You can use the chromedriver:update command to download the latest version of -ChromeDriver -compatible with your Chrome browser version and place it in the Composer bin directory.

-

This is a service extension that will be started and stopped by the dev:start -and dev:stop commands.

-

DockerComposeController

-

This extension will start and stop a docker compose stack before and after the tests are run.

-

The extension can be configured with the following parameters:

-
    -
  • required
      -
    • compose-file - the path to the docker compose file to use; it can be either an absolute path or a path - relative to the Codeception root directory.
    • -
    -
  • -
  • optional
      -
    • env-file- the path to the environment file to use; it can be either an absolute path or a path.
    • -
    -
  • -
-

Example configuration starting the server for all suites:

-
extensions:
-  enabled:
-    - lucatume\WPBrowser\Extension\DockerComposeController
-  config:
-    lucatume\WPBrowser\Extension\DockerComposeController:
-      compose-file: /var/www/html/docker-compose.yml
-      env-file: /var/www/html/.env
-
-

The extension can access environment variables defined in the tests configuration file:

-
extensions:
-  enabled:
-    - lucatume\WPBrowser\Extension\DockerComposeController
-  config:
-    suites:
-      - EndToEnd
-      - WebApp
-    lucatume\WPBrowser\Extension\DockerComposeController:
-      compose-file: '%DOCKER_COMPOSE_FILE%'
-      env-file: '%DOCKER_COMPOSE_ENV_FILE%'
-
-

This is a service extension that will be started and stopped by the dev:start -and wp:dev-stop commands.

- - - - - - -
-
- - -
- -
- - - -
-
-
-
- - - - - - - - - \ No newline at end of file diff --git a/docs/public/index.html b/docs/public/index.html deleted file mode 100644 index beb35eadd..000000000 --- a/docs/public/index.html +++ /dev/null @@ -1,464 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - wp-browser docs - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
- - - - - - -
- - -
- -
- - - - - - -
-
- - - -
-
-
- - - - -
-
-
- - - -
-
-
- - - -
-
-
- - - -
-
- - - - - - - -

Start here

- -

The wp-browser library provides a set of Codeception modules and middleware to enable the testing of WordPress sites, plugins and themes.

-
-

This is the documentation for version 4 of the project, the current version. -Documentation for the previous version of the project, version 3, can be found here.

-
-

Installation

-

Add wp-browser to your project as a development dependency using Composer

-
cd my-wordrpess-project
-composer require --dev lucatume/wp-browser
-
-

Initialize wp-browser to quickly configured to suite your project and setup:

-
vendor/bin/codecept init wpbrowser
-
-

The command will set up your project to run integration and end-to-end tests using:

-
    -
  • SQLite as the database engine, leveraging the SQLite Database Integration plugin
  • -
  • PHP built-in web server to serve the WordPress site on localhost (e.g. http://localhost:8080)
  • -
  • Chromedriver to drive the local version of Chrome installed on your machine
  • -
-

If you're working on a plugin or theme project, the default configuration will add some extra steps:

-
    -
  • install the latest version of WordPress in the tests/_wordpress directory
  • -
  • create a tests/_plugins directory: any file or directory in this directory will be symlinked into the WordPress - installation in tests/_wordpress/wp-content/plugins
  • -
  • create a tests/_themes directory: any file or directory in this directory will be symlinked into the WordPress - installation in tests/_wordpress/wp-content/themes
  • -
-

For most projects this configuration will be enough to get started with testing.

-

You can run your tests immediately using the vendor/bin/codecept run command.

-

Read more about the commands provided by the library here.

-

Using a custom configuration

-

If you decide to skip the default configuration, you will be able to set up wp-browser to suit your needs and local -setup by editing the tests/.env file. -The inline documentation in the file will guide you through the configuration process.

-

Read more about using a custom configuration here.

-

Getting support for wp-browser configuration and usage

-

The best place to get support for wp-browser is this documentation. -Since this project builds on top of PHPUnit and Codeception, you can also refer to their documentation.

-

If you can't find the answer to your question here you can ask on -the "Issues" section of the wp-browser repository taking care to provide as much information as possible.

-

Finally, you can contact me directly to set up a call to discuss your -project needs and how wp-browser can help you.

-

Table of contents:

- - - - - - - -
-
- - -
- -
- - - -
-
-
-
- - - - - - - - - \ No newline at end of file diff --git a/docs/public/modules/WPBrowser/index.html b/docs/public/modules/WPBrowser/index.html deleted file mode 100644 index e92eb52db..000000000 --- a/docs/public/modules/WPBrowser/index.html +++ /dev/null @@ -1,475 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - WPBrowser - wp-browser docs - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
- - - - - - -
- - -
- -
- - - - - - -
-
- - - -
-
-
- - - - -
-
-
- - - -
-
-
- - - -
-
-
- - - -
-
- - - - - - - -

WPBrowser

- -

WPBrowser module

-

Browse and test the site HTML with a fast browser without Javascript support.

-

This module trades the WPWebDriver module Javascript support for speed and stability. It is a good -choice for testing sites that don't use Javascript or to make assertions that do not require Javascript support like:

-
    -
  • testing HTTP return codes
  • -
  • testing HTML structure
  • -
  • testing JSON and XML responses from APIs
  • -
-

This module is used together with the WPDb module and the WPFilesystem module to -control the site state, the database, and the site file structure.

-

This module is an extension of the Codeception PHPBrowser module, you can reference to the Codeception module -documentation for more information on the module configuration and usage.

-

This module should be with Cest and Cept test cases.

-

Configuration

-
    -
  • url - required; the start URL of your WordPress project.
  • -
  • adminUsername - required; the site administrator username to use in actions like loginAsAdmin.
  • -
  • adminPassword - required; the site administrator password to use in actions like loginAsAdmin.
  • -
  • adminPath - the path to the WordPress admin directory; defaults to /wp-admin.
  • -
-

More Guzzle request options are available like:

-

headers - default headers are set before each test.
-cookies - default cookies are set before each test.
-auth - default authentication to be set before each test.

-

... and more.

-

The following is an example of the module configuration to run tests on thehttp://localhost:8080 site:

-
modules:
-  enabled:
-    lucatume\WPBrowser\Module\WPBrowser:
-      url: 'http://localhost:8080'
-      adminUsername: 'admin'
-      adminPassword: 'password'
-      adminPath: '/wp-admin'
-      headers:
-        X_WPBROWSER_REQUEST: 1
-        X_TEST_REQUEST: 1
-        X_APM_REQUEST: 1
-
-

The following configuration uses dynamic configuration parameters to set the module configuration:

-
modules:
-  enabled:
-    lucatume\WPBrowser\Module\WPBrowser:
-      url: '%WORDPRESS_URL%'
-      adminUsername: '%WORDPRESS_ADMIN_USER%'
-      adminPassword: '%WORDPRESS_ADMIN_PASSWORD%'
-      adminPath: '/wp-admin'
-      headers:
-        X_WPBROWSER_REQUEST: 1
-        X_TEST_REQUEST: 1
-        X_APM_REQUEST: 1
-
-

Methods

-

The module provides the following methods:

-
    -
  • activatePlugin(array|string $pluginSlug) : void
  • -
  • amEditingPostWithId(int $id) : void
  • -
  • amHttpAuthenticated($username, $password) : void
  • -
  • amOnAdminAjaxPage(array|string|null [$queryVars]) : void
  • -
  • amOnAdminPage(string $page) : void
  • -
  • amOnCronPage(array|string|null [$queryVars]) : void
  • -
  • amOnPage(string $page) : void
  • -
  • amOnPagesPage() : void
  • -
  • amOnPluginsPage() : void
  • -
  • amOnSubdomain($subdomain) : void
  • -
  • amOnUrl($url) : void
  • -
  • attachFile($field, string $filename) : void
  • -
  • checkOption($option) : void
  • -
  • click($link, [$context]) : void
  • -
  • deactivatePlugin(array|string $pluginSlug) : void
  • -
  • deleteHeader(string $name) : void
  • -
  • dontSee(string $text, [$selector]) : void
  • -
  • dontSeeCheckboxIsChecked($checkbox) : void
  • -
  • dontSeeCookie($cookie, [$params]) : void
  • -
  • dontSeeCurrentUrlEquals(string $uri) : void
  • -
  • dontSeeCurrentUrlMatches(string $uri) : void
  • -
  • dontSeeElement($selector, array [$attributes]) : void
  • -
  • dontSeeInCurrentUrl(string $uri) : void
  • -
  • dontSeeInField($field, $value) : void
  • -
  • dontSeeInFormFields($formSelector, array $params) : void
  • -
  • dontSeeInSource(string $raw) : void
  • -
  • dontSeeInTitle($title) : void
  • -
  • dontSeeLink(string $text, string [$url]) : void
  • -
  • dontSeeOptionIsSelected($selector, $optionText) : void
  • -
  • dontSeePluginInstalled(string $pluginSlug) : void
  • -
  • dontSeeResponseCodeIs(int $code) : void
  • -
  • executeInGuzzle(Closure $function) : void
  • -
  • fillField($field, $value) : void
  • -
  • followRedirect() : void
  • -
  • grabAttributeFrom($cssOrXpath, string $attribute) : mixed
  • -
  • grabCookie(string $cookie, array [$params]) : mixed
  • -
  • grabCookiesWithPattern(string $cookiePattern) : ?array
  • -
  • grabFromCurrentUrl(?string [$uri]) : mixed
  • -
  • grabMultiple($cssOrXpath, ?string [$attribute]) : array
  • -
  • grabPageSource() : string
  • -
  • grabTextFrom($cssOrXPathOrRegex) : mixed
  • -
  • grabValueFrom($field) : mixed
  • -
  • grabWordPressTestCookie(?string [$name]) : ?Symfony\Component\BrowserKit\Cookie
  • -
  • haveHttpHeader(string $name, string $value) : void
  • -
  • haveServerParameter(string $name, string $value) : void
  • -
  • logOut(string|bool [$redirectTo]) : void
  • -
  • loginAs(string $username, string $password) : void
  • -
  • loginAsAdmin() : void
  • -
  • makeHtmlSnapshot(?string [$name]) : void
  • -
  • moveBack(int [$numberOfSteps]) : void
  • -
  • resetCookie($cookie, [$params]) : void
  • -
  • see(string $text, [$selector]) : void
  • -
  • seeCheckboxIsChecked($checkbox) : void
  • -
  • seeCookie($cookie, [$params]) : void
  • -
  • seeCurrentUrlEquals(string $uri) : void
  • -
  • seeCurrentUrlMatches(string $uri) : void
  • -
  • seeElement($selector, array [$attributes]) : void
  • -
  • seeErrorMessage(array|string [$classes]) : void
  • -
  • seeInCurrentUrl(string $uri) : void
  • -
  • seeInField($field, $value) : void
  • -
  • seeInFormFields($formSelector, array $params) : void
  • -
  • seeInSource(string $raw) : void
  • -
  • seeInTitle($title) : void
  • -
  • seeLink(string $text, ?string [$url]) : void
  • -
  • seeMessage(array|string [$classes]) : void
  • -
  • seeNumberOfElements($selector, $expected) : void
  • -
  • seeOptionIsSelected($selector, $optionText) : void
  • -
  • seePageNotFound() : void
  • -
  • seePluginActivated(string $pluginSlug) : void
  • -
  • seePluginDeactivated(string $pluginSlug) : void
  • -
  • seePluginInstalled(string $pluginSlug) : void
  • -
  • seeResponseCodeIs(int $code) : void
  • -
  • seeResponseCodeIsBetween(int $from, int $to) : void
  • -
  • seeResponseCodeIsClientError() : void
  • -
  • seeResponseCodeIsRedirection() : void
  • -
  • seeResponseCodeIsServerError() : void
  • -
  • seeResponseCodeIsSuccessful() : void
  • -
  • seeWpDiePage() : void
  • -
  • selectOption($select, $option) : void
  • -
  • sendAjaxGetRequest(string $uri, array [$params]) : void
  • -
  • sendAjaxPostRequest(string $uri, array [$params]) : void
  • -
  • sendAjaxRequest(string $method, string $uri, array [$params]) : void
  • -
  • setCookie($name, $val, [$params]) : void
  • -
  • setHeader(string $name, string $value) : void
  • -
  • setMaxRedirects(int $maxRedirects) : void
  • -
  • setServerParameters(array $params) : void
  • -
  • startFollowingRedirects() : void
  • -
  • stopFollowingRedirects() : void
  • -
  • submitForm($selector, array $params, ?string [$button]) : void
  • -
  • switchToIframe(string $name) : void
  • -
  • uncheckOption($option) : void
  • -
-

Read more in Codeception documentation.

- - - - - - -
-
- - -
- -
- - - -
-
-
-
- - - - - - - - - \ No newline at end of file diff --git a/docs/public/modules/WPCLI/index.html b/docs/public/modules/WPCLI/index.html deleted file mode 100644 index b4f9cb3e9..000000000 --- a/docs/public/modules/WPCLI/index.html +++ /dev/null @@ -1,403 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - WPCLI - wp-browser docs - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
- - - - - - -
- - -
- -
- - - - - - -
-
- - - -
-
-
- - - - -
-
-
- - - -
-
-
- - - -
-
-
- - - -
-
- - - - - - - -

WPCLI

- -

WPCLI module

-

Use WP-CLI to interact with the WordPress installation under test and issue commands.

-

This module is used in the context of end-to-end testing, together with, or as a replacement for -the WPDb module to manipulate the database and the WPFilesystem module to manipulate the -site file structure.

-

This module should be with Cest and Cept test cases.

-

Configuration

-
    -
  • path - required; the path to the WordPress installation under test. This can be a relative path to the - codeception root directory, or an absolute path to the WordPress installation directory. The WordPress installation - directory is the directory that contains the wp-load.php file.
  • -
  • url - the URL of the WordPress installation under test. Equivalent to the --url option of the wp command.
  • -
  • user - the user to use to run the wp command. Equivalent to the --user option of the wp command.
  • -
  • skip-plugins - a boolean value to indicate if the wp command should skip loading plugins. Equivalent to the - --skip-plugins option of the wp command.
  • -
  • skip-themes - a boolean value to indicate if the wp command should skip loading themes. Equivalent to the - --skip-themes option of the wp command.
  • -
  • skip-packages - a boolean value to indicate if the wp command should skip loading packages. Equivalent to the - --skip-packages option of the wp command.
  • -
  • require - a list of PHP files to require before running the wp command. Equivalent to the --require option of - the wp command.
  • -
  • exec - PHP code to execute before running the wp command. Equivalent to the --exec option of the wp command.
  • -
  • context - the context to use when running the wp command. Equivalent to the --context option of the wp - command.
  • -
  • color - a boolean value to indicate if the wp command should output in color. Equivalent to the --color option - of the wp command.
  • -
  • no-color - a boolean value to indicate if the wp command should not output in color. Equivalent to the - --no-color option of the wp command.
  • -
  • debug - a boolean value to indicate if the wp command should output debug information. Equivalent to the - --debug option of the wp command.
  • -
  • quiet - a boolean value to indicate if the wp command should suppress informational messages. Equivalent to the - --quiet option of the wp command.
  • -
  • throw - a boolean value to indicate if the wp command should throw an exception if the command fails.
  • -
  • timeout - the timeout to use when running the wp command. When the timeout is reached the command will be - terminated as a failure.
  • -
  • cache-dir - the directory to use to cache the files WPCLI might downloads. Equivalent to setting - the WP_CLI_CACHE_DIR - environment variable.
  • -
  • config-path - the path to the wp-cli.yml file to use. Equivalent to setting the WP_CLI_CONFIG_PATH - environment variable.
  • -
  • custom-shell - the shell to use to run the wp command. Equivalent to setting the WP_CLI_SHELL environment - variable.
  • -
  • packages-dir - the directory to use to store the packages downloaded by the wp package command. Equivalent to - setting the WP_CLI_PACKAGES_DIR environment variable.
  • -
-

The following is an example of the module configuration to run WPCLI commands on the /var/wordpress directory:

-
modules:
-  enabled:
-    lucatume\WPBrowser\Module\WPCLI:
-      path: /var/wordpress
-      throw: true
-
-

The following configuration uses dynamic configuration parameters to set the module configuration:

-
modules:
-  enabled:
-    lucatume\WPBrowser\Module\WPCLI:
-      path: '%WP_ROOT_DIR%'
-      throw: true
-
-

Methods

-

The module provides the following methods:

-
    -
  • cli(array|string [$command], ?array [$env], mixed [$input]) : int
  • -
  • cliToArray(array $command, ?callable [$splitCallback], ?array [$env], mixed [$input]) : array
  • -
  • cliToString(array $command, ?array [$env], mixed [$input]) : string
  • -
  • dontSeeInShellOutput(string $text) : void
  • -
  • dontSeeShellOutputMatches(string $regex) : void
  • -
  • grabLastCliProcess() : lucatume\WPBrowser\WordPress\CliProcess
  • -
  • grabLastShellErrorOutput() : string
  • -
  • grabLastShellOutput() : string
  • -
  • seeInShellOutput(string $text) : void
  • -
  • seeResultCodeIs(int $code) : void
  • -
  • seeResultCodeIsNot(int $code) : void
  • -
  • seeShellOutputMatches(string $regex) : void
  • -
-

Explore the WP-CLI documentation for more information on the available commands.

- - - - - - -
-
- - -
- -
- - - -
-
-
-
- - - - - - - - - \ No newline at end of file diff --git a/docs/public/modules/WPDb/index.html b/docs/public/modules/WPDb/index.html deleted file mode 100644 index 123453342..000000000 --- a/docs/public/modules/WPDb/index.html +++ /dev/null @@ -1,572 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - WPDb - wp-browser docs - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
- - - - - - -
- - -
- -
- - - - - - -
-
- - - -
-
-
- - - - -
-
-
- - - -
-
-
- - - -
-
-
- - - -
-
- - - - - - - -

WPDb

- -

WPDb module

-

This module allows to manipulate the database of the WordPress installation under test directly, without using the -WordPress API.

-

The module is used together with the WPBrowser module, WPWebDriver -and WPFilesystem modules to control the site state, the database, and the site file structure.

-

Note about interaction with the WPLoader module: both this module and the WPLoader one can be used to -control the state of the database before tests and set up fixtures: use either this or WPLoader, do not use both. -This module should be used in end-to-end testing, the WPLoader module should be used in integration -testing. -If you're using this module to load a database dump before integration tests, -use the WPLoader module dump configuration parameter instead.

-

This module should be with Cest and Cept test cases.

-

Configuration

-

This module extends the Codeception Db module adding some configuration options and functions that are specific to -WordPress.

-
    -
  • dbUrl - required; the URL to use to connect to the database. The URL must be in the form - mysql://user:password@host:port/database if you're using a MySQL database for your tests, or in the form - sqlite://path/to/database/file if you're using a SQLite database for your tests ( - like the default configuration does)
  • -
  • dsn - required; the DSN to use to connect to the database; required if not using the dbUrl parameter.
  • -
  • user - required; the user to use to connect to the database; required if not using the dbUrl parameter.
  • -
  • password - required; the password to use to connect to the database; required if not using the dbUrl - parameter.
  • -
  • url - required;the URL of the WordPress installation under test. E.g. http://localhost:8080 - or https://wordpress.test.
  • -
  • tablePrefix - the table prefix to use when interacting with the database; defaults to wp_.
  • -
  • dump - the path to a database dump file, or a set of database files, to load before running tests. The path can be - relative to the project root directory, e.g. tests/_data/dump.sql, or absolute.
  • -
  • populate - a boolean value to indicate if the database should be populated importing the dump file(s) at the start - of the suite.
  • -
  • cleanup - a boolean value to indicate if the database should be populated importing the dump file(s) before each - test.
  • -
  • reconnect - a boolean value to indicate if the database connection should be re-established before each test.
  • -
  • populator - a command to use to populate the database instead of using - PHP; read more on the Codeception documentation.
  • -
  • urlReplacement - a boolean value to indicate if the database dump file(s) should be searched for the siteurl - and home options and replaced with the url parameter value. This is required since WordPress hard-codes URLs in - the database, the original URL is inferred, if the originalUrl parameter is not provided.
  • -
  • originalUrl - if provided together with the urlReplacement parameter, the module will not try to infer the - original URL from the database dump file(s) but use the provided value instead.
  • -
  • waitlock - the number of seconds to wait for a database lock to be released before failing the test. Defaults to - 10 meaning that the test will fail if the database lock is not released after 10 seconds.
  • -
  • createIfNotExists - a boolean value to indicate if the database should be created if it does not exist. Defaults to - false.
  • -
-

The following is an example of the module configuration to run tests on thehttp://localhost:8080 site:

-
modules:
-  enabled:
-    - lucatume\WPBrowser\Module\WPDb:
-        dbUrl: 'mysql://root:password@localhost:3306/wordpress'
-        url: 'http://localhost:8080'
-        tablePrefix: 'wp_'
-        dump: 'tests/_data/dump.sql'
-        populate: true
-        cleanup: true
-        reconnect: false
-        urlReplacement: true
-        originalUrl: http://wordpress.test
-        waitlock: 10
-        createIfNotExists: true
-
-

The following configuration uses dynamic configuration parameters to set the module configuration:

-
modules:
-  enabled:
-    - lucatume\WPBrowser\Module\WPDb:
-        dbUrl: '%DB_URL%'
-        url: '%WORDPRESS_URL%'
-        tablePrefix: '%WORDPRESS_TABLE_PREFIX%'
-        dump: '%DB_DUMP%'
-        populate: true
-        cleanup: true
-        reconnect: false
-        urlReplacement: true
-        originalUrl: '%WORDPRESS_ORIGINAL_URL%'
-        waitlock: 10
-        createIfNotExists: true
-
-

The following configuration uses a SQLite database:

-
modules:
-  enabled:
-    - lucatume\WPBrowser\Module\WPDb:
-        dbUrl: 'sqlite://tests/database.sqlite'
-        url: 'http://localhost:8080'
-        tablePrefix: 'wp_'
-        dump: 'tests/_data/dump.sql'
-        populate: true
-        cleanup: true
-        reconnect: false
-        urlReplacement: true
-        originalUrl: http://wordpress.test
-        waitlock: 10
-        createIfNotExists: true
-
-

Methods

-

The module provides the following methods:

-
    -
  • amConnectedToDatabase(string $databaseKey) : void
  • -
  • countRowsInDatabase(string $table, array [$criteria]) : int
  • -
  • dontHaveAttachmentFilesInDatabase(array|int $attachmentIds) : void
  • -
  • dontHaveAttachmentInDatabase(array $criteria, bool [$purgeMeta], bool [$removeFiles]) : void
  • -
  • dontHaveBlogInDatabase(array $criteria, bool [$removeTables], bool [$removeUploads]) : void
  • -
  • dontHaveCommentInDatabase(array $criteria, bool [$purgeMeta]) : void
  • -
  • dontHaveCommentMetaInDatabase(array $criteria) : void
  • -
  • dontHaveInDatabase(string $table, array $criteria) : void
  • -
  • dontHaveLinkInDatabase(array $criteria) : void
  • -
  • dontHaveOptionInDatabase(string $key, mixed [$value]) : void
  • -
  • dontHavePostInDatabase(array $criteria, bool [$purgeMeta]) : void
  • -
  • dontHavePostMetaInDatabase(array $criteria) : void
  • -
  • dontHavePostThumbnailInDatabase(int $postId) : void
  • -
  • dontHaveSiteOptionInDatabase(string $key, mixed [$value]) : void
  • -
  • dontHaveSiteTransientInDatabase(string $key) : void
  • -
  • dontHaveTableInDatabase(string $fullTableName) : void
  • -
  • dontHaveTermInDatabase(array $criteria, bool [$purgeMeta]) : void
  • -
  • dontHaveTermMetaInDatabase(array $criteria) : void
  • -
  • dontHaveTermRelationshipInDatabase(array $criteria) : void
  • -
  • dontHaveTermTaxonomyInDatabase(array $criteria) : void
  • -
  • dontHaveTransientInDatabase(string $transient) : void
  • -
  • dontHaveUserInDatabase(string|int $userIdOrLogin, bool [$purgeMeta]) : void
  • -
  • dontHaveUserInDatabaseWithEmail(string $userEmail, bool [$purgeMeta]) : array
  • -
  • dontHaveUserMetaInDatabase(array $criteria) : void
  • -
  • dontSeeAttachmentInDatabase(array $criteria) : void
  • -
  • dontSeeBlogInDatabase(array $criteria) : void
  • -
  • dontSeeCommentInDatabase(array $criteria) : void
  • -
  • dontSeeCommentMetaInDatabase(array $criteria) : void
  • -
  • dontSeeInDatabase(string $table, array [$criteria]) : void
  • -
  • dontSeeLinkInDatabase(array $criteria) : void
  • -
  • dontSeeOptionInDatabase(array|string $criteriaOrName, mixed [$value]) : void
  • -
  • dontSeePageInDatabase(array $criteria) : void
  • -
  • dontSeePostInDatabase(array $criteria) : void
  • -
  • dontSeePostMetaInDatabase(array $criteria) : void
  • -
  • dontSeePostWithTermInDatabase(int $post_id, int $term_taxonomy_id, ?int [$term_order], ?string [$taxonomy]) : void
  • -
  • dontSeeSiteOptionInDatabase(array|string $criteriaOrName, mixed [$value]) : void
  • -
  • dontSeeTableInDatabase(string $table) : void
  • -
  • dontSeeTermInDatabase(array $criteria) : void
  • -
  • dontSeeTermMetaInDatabase(array $criteria) : void
  • -
  • dontSeeTermTaxonomyInDatabase(array $criteria) : void
  • -
  • dontSeeUserInDatabase(array $criteria) : void
  • -
  • dontSeeUserMetaInDatabase(array $criteria) : void
  • -
  • getSiteDomain() : string
  • -
  • getUsersTableName() : string
  • -
  • grabAllFromDatabase(string $table, string $column, array $criteria) : array
  • -
  • grabAttachmentAttachedFile(int $attachmentPostId) : string
  • -
  • grabAttachmentMetadata(int $attachmentPostId) : array
  • -
  • grabBlogDomain(int $blogId) : string
  • -
  • grabBlogPath(int $blogId) : string
  • -
  • grabBlogTableName(int $blogId, string $table) : string
  • -
  • grabBlogTableNames(int $blogId) : array
  • -
  • grabBlogTablePrefix(int $blogId) : string
  • -
  • grabBlogVersionsTableName() : string
  • -
  • grabBlogsTableName() : string
  • -
  • grabColumnFromDatabase(string $table, string $column, array [$criteria]) : array
  • -
  • grabCommentmetaTableName() : string
  • -
  • grabCommentsTableName() : string
  • -
  • grabEntriesFromDatabase(string $table, array [$criteria]) : array
  • -
  • grabEntryFromDatabase(string $table, array [$criteria]) : array
  • -
  • grabFromDatabase(string $table, string $column, array [$criteria]) : void
  • -
  • grabLatestEntryByFromDatabase(string $tableName, string [$idColumn]) : int
  • -
  • grabLinksTableName() : string
  • -
  • grabNumRecords(string $table, array [$criteria]) : int
  • -
  • grabOptionFromDatabase(string $option_name) : mixed
  • -
  • grabPostFieldFromDatabase(int $postId, string $field) : mixed
  • -
  • grabPostMetaFromDatabase(int $postId, string $metaKey, bool [$single]) : mixed
  • -
  • grabPostmetaTableName() : string
  • -
  • grabPostsTableName() : string
  • -
  • grabPrefixedTableNameFor(string [$tableName]) : string
  • -
  • grabRegistrationLogTableName() : string
  • -
  • grabSignupsTableName() : string
  • -
  • grabSiteMetaFromDatabase(int $blogId, string $key, bool $single) : mixed
  • -
  • grabSiteMetaTableName() : string
  • -
  • grabSiteOptionFromDatabase(string $key) : mixed
  • -
  • grabSiteTableName() : string
  • -
  • grabSiteTransientFromDatabase(string $key) : mixed
  • -
  • grabSiteUrl(?string [$path]) : string
  • -
  • grabTablePrefix() : string
  • -
  • grabTermIdFromDatabase(array $criteria) : int|false
  • -
  • grabTermMetaTableName() : string
  • -
  • grabTermRelationshipsTableName() : string
  • -
  • grabTermTaxonomyIdFromDatabase(array $criteria) : int|false
  • -
  • grabTermTaxonomyTableName() : string
  • -
  • grabTermsTableName() : string
  • -
  • grabUserIdFromDatabase(string $userLogin) : int|false
  • -
  • grabUserMetaFromDatabase(int $userId, string $meta_key, bool [$single]) : mixed
  • -
  • grabUsermetaTableName() : string
  • -
  • grabUsersTableName() : string
  • -
  • haveAttachmentInDatabase(string $file, string|int [$date], array [$overrides], ?array [$imageSizes]) : int
  • -
  • haveBlogInDatabase(string $domainOrPath, array [$overrides], bool [$subdomain]) : int
  • -
  • haveCommentInDatabase(int $comment_post_ID, array [$data]) : int
  • -
  • haveCommentMetaInDatabase(int $comment_id, string $meta_key, mixed $meta_value) : int
  • -
  • haveInDatabase(string $table, array $data) : int
  • -
  • haveLinkInDatabase(array [$overrides]) : int
  • -
  • haveManyBlogsInDatabase(int $count, array [$overrides], bool [$subdomain]) : array
  • -
  • haveManyCommentsInDatabase(int $count, int $comment_post_ID, array [$overrides]) : array
  • -
  • haveManyLinksInDatabase(int $count, array [$overrides]) : array
  • -
  • haveManyPostsInDatabase(int $count, array [$overrides]) : array
  • -
  • haveManyTermsInDatabase(int $count, string $name, string $taxonomy, array [$overrides]) : array
  • -
  • haveManyUsersInDatabase(int $count, string $user_login, string [$role], array [$overrides]) : array
  • -
  • haveMenuInDatabase(string $slug, string $location, array [$overrides]) : array
  • -
  • haveMenuItemInDatabase(string $menuSlug, string $title, ?int [$menuOrder], array [$meta]) : int
  • -
  • haveOptionInDatabase(string $option_name, mixed $option_value, string [$autoload]) : int
  • -
  • havePageInDatabase(array [$overrides]) : int
  • -
  • havePostInDatabase(array [$data]) : int
  • -
  • havePostThumbnailInDatabase(int $postId, int $thumbnailId) : int
  • -
  • havePostmetaInDatabase(int $postId, string $meta_key, mixed $meta_value) : int
  • -
  • haveSiteMetaInDatabase(int $blogId, string $string, mixed $value) : int
  • -
  • haveSiteOptionInDatabase(string $key, mixed $value) : int
  • -
  • haveSiteTransientInDatabase(string $key, mixed $value) : int
  • -
  • haveTermInDatabase(string $name, string $taxonomy, array [$overrides]) : array
  • -
  • haveTermMetaInDatabase(int $term_id, string $meta_key, mixed $meta_value) : int
  • -
  • haveTermRelationshipInDatabase(int $object_id, int $term_taxonomy_id, int [$term_order]) : void
  • -
  • haveTransientInDatabase(string $transient, mixed $value) : int
  • -
  • haveUserCapabilitiesInDatabase(int $userId, array|string $role) : array
  • -
  • haveUserInDatabase(string $user_login, array|string [$role], array [$overrides]) : int
  • -
  • haveUserLevelsInDatabase(int $userId, array|string $role) : array
  • -
  • haveUserMetaInDatabase(int $userId, string $meta_key, mixed $meta_value) : array
  • -
  • importSql(array $sql) : void
  • -
  • importSqlDumpFile(?string [$dumpFile]) : void
  • -
  • performInDatabase($databaseKey, $actions) : void
  • -
  • seeAttachmentInDatabase(array $criteria) : void
  • -
  • seeBlogInDatabase(array $criteria) : void
  • -
  • seeCommentInDatabase(array $criteria) : void
  • -
  • seeCommentMetaInDatabase(array $criteria) : void
  • -
  • seeInDatabase(string $table, array [$criteria]) : void
  • -
  • seeLinkInDatabase(array $criteria) : void
  • -
  • seeNumRecords(int $expectedNumber, string $table, array [$criteria]) : void
  • -
  • seeOptionInDatabase(array|string $criteriaOrName, mixed [$value]) : void
  • -
  • seePageInDatabase(array $criteria) : void
  • -
  • seePostInDatabase(array $criteria) : void
  • -
  • seePostMetaInDatabase(array $criteria) : void
  • -
  • seePostWithTermInDatabase(int $post_id, int $term_taxonomy_id, ?int [$term_order], ?string [$taxonomy]) : void
  • -
  • seeSiteOptionInDatabase(array|string $criteriaOrName, mixed [$value]) : void
  • -
  • seeSiteSiteTransientInDatabase(string $key, mixed [$value]) : void
  • -
  • seeTableInDatabase(string $table) : void
  • -
  • seeTermInDatabase(array $criteria) : void
  • -
  • seeTermMetaInDatabase(array $criteria) : void
  • -
  • seeTermRelationshipInDatabase(array $criteria) : void
  • -
  • seeTermTaxonomyInDatabase(array $criteria) : void
  • -
  • seeUserInDatabase(array $criteria) : void
  • -
  • seeUserMetaInDatabase(array $criteria) : void
  • -
  • updateInDatabase(string $table, array $data, array [$criteria]) : void
  • -
  • useBlog(int [$blogId]) : void
  • -
  • useMainBlog() : void
  • -
  • useTheme(string $stylesheet, ?string [$template], ?string [$themeName]) : void
  • -
-

Read more in Codeception documentation for the Db module.

- - - - - - -
-
- - -
- -
- - - -
-
-
-
- - - - - - - - - \ No newline at end of file diff --git a/docs/public/modules/WPFilesystem/index.html b/docs/public/modules/WPFilesystem/index.html deleted file mode 100644 index 47b424147..000000000 --- a/docs/public/modules/WPFilesystem/index.html +++ /dev/null @@ -1,429 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - WPFilesystem - wp-browser docs - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
- - - - - - -
- - -
- -
- - - - - - -
-
- - - -
-
-
- - - - -
-
-
- - - -
-
-
- - - -
-
-
- - - -
-
- - - - - - - -

WPFilesystem

- -

WPFilesystem module

-

Interact and make assertions on the WordPress file structure.

-

This module is used together with the WPDb module to manage the state of the WordPress installation in the -context of end-to-end tests.

-

This module extends the Filesystem module from Codeception, you can reference to the Codeception documentation to -find out more about the module configuration and usage.

-

This module should be with Cest and Cept test cases.

-

Configuration

-

wpRootFolder - required; the path to the WordPress installation root folder. This can be a relative path to the -codeception root directory, or an absolute path to the WordPress installation directory. The WordPress installation -directory is the directory that contains the wp-load.php file. -themes - the path, relative to the path specified in the wpRootFolder parameter, to the themes directory. By -default, -it's /wp-content/themes. -plugins - the path, relative to the path specified in the wpRootFolder parameter, to the plugins directory. By -default, it's /wp-content/plugins. -mu-plugins - the path, relative to the path specified in the wpRootFolder parameter, to the must-use plugins. By -default, it's /wp-content/mu-plugins. directory. -uploads - the path, relative to the path specified in the wpRootFolder parameter, to the uploads directory. By -default, it's /wp-content/uploads.

-

The following is an example of the module configuration to run tests on the /var/wordpress site:

-
modules:
-  enabled:
-    lucatume\WPBrowser\Module\WPFilesystem:
-      wpRootFolder: /var/wordpress
-      themes: wp-content/themes
-      plugins: wp-content/plugins
-      mu-plugins: wp-content/mu-plugins
-      uploads: wp-content/uploads
-
-

The following configuration uses dynamic configuration parameters to set the module configuration:

-
modules:
-  enabled:
-    lucatume\WPBrowser\Module\WPFilesystem:
-      wpRootFolder: '%WP_ROOT_FOLDER%'
-
-

Methods

-

The module provides the following methods:

-
    -
  • amInMuPluginPath(string $path) : void
  • -
  • amInPath(string $path) : void
  • -
  • amInPluginPath(string $path) : void
  • -
  • amInThemePath(string $path) : void
  • -
  • amInUploadsPath(?string [$path]) : void
  • -
  • assertDirectoryExists(string $directory, string [$message]) : void
  • -
  • cleanDir(string $dirname) : void
  • -
  • cleanMuPluginDir(string $dir) : void
  • -
  • cleanPluginDir(string $dir) : void
  • -
  • cleanThemeDir(string $dir) : void
  • -
  • cleanUploadsDir(?string [$dir], DateTime|string|int|null [$date]) : void
  • -
  • copyDir(string $src, string $dst) : void
  • -
  • copyDirToMuPlugin(string $src, string $pluginDst) : void
  • -
  • copyDirToPlugin(string $src, string $pluginDst) : void
  • -
  • copyDirToTheme(string $src, string $themeDst) : void
  • -
  • copyDirToUploads(string $src, string $dst, DateTime|string|int|null [$date]) : void
  • -
  • deleteDir(string $dirname) : void
  • -
  • deleteFile(string $filename) : void
  • -
  • deleteMuPluginFile(string $file) : void
  • -
  • deletePluginFile(string $file) : void
  • -
  • deleteThemeFile(string $file) : void
  • -
  • deleteThisFile() : void
  • -
  • deleteUploadedDir(string $dir, DateTime|string|int|null [$date]) : void
  • -
  • deleteUploadedFile(string $file, string|int|null [$date]) : void
  • -
  • dontSeeFileFound(string $filename, string [$path]) : void
  • -
  • dontSeeInMuPluginFile(string $file, string $contents) : void
  • -
  • dontSeeInPluginFile(string $file, string $contents) : void
  • -
  • dontSeeInThemeFile(string $file, string $contents) : void
  • -
  • dontSeeInThisFile(string $text) : void
  • -
  • dontSeeInUploadedFile(string $file, string $contents, string|int|null [$date]) : void
  • -
  • dontSeeMuPluginFileFound(string $file) : void
  • -
  • dontSeePluginFileFound(string $file) : void
  • -
  • dontSeeThemeFileFound(string $file) : void
  • -
  • dontSeeUploadedFileFound(string $file, string|int|null [$date]) : void
  • -
  • getBlogUploadsPath(int $blogId, string [$file], DateTimeImmutable|DateTime|string|null [$date]) : string
  • -
  • getUploadsPath(string [$file], mixed [$date]) : string
  • -
  • getWpRootFolder() : string
  • -
  • haveMuPlugin(string $filename, string $code) : void
  • -
  • havePlugin(string $path, string $code) : void
  • -
  • haveTheme(string $folder, string $indexFileCode, string [$functionsFileCode]) : void
  • -
  • makeUploadsDir(string $path) : string
  • -
  • openFile(string $filename) : void
  • -
  • openUploadedFile(string $filename, DateTime|string|int|null [$date]) : void
  • -
  • seeFileContentsEqual(string $text) : void
  • -
  • seeFileFound(string $filename, string [$path]) : void
  • -
  • seeInMuPluginFile(string $file, string $contents) : void
  • -
  • seeInPluginFile(string $file, string $contents) : void
  • -
  • seeInThemeFile(string $file, string $contents) : void
  • -
  • seeInThisFile(string $text) : void
  • -
  • seeInUploadedFile(string $file, string $contents, string|int|null [$date]) : void
  • -
  • seeMuPluginFileFound(string $file) : void
  • -
  • seeNumberNewLines(int $number) : void
  • -
  • seePluginFileFound(string $file) : void
  • -
  • seeThemeFileFound(string $file) : void
  • -
  • seeThisFileMatches(string $regex) : void
  • -
  • seeUploadedFileFound(string $filename, string|int|null [$date]) : void
  • -
  • writeToFile(string $filename, string $contents) : void
  • -
  • writeToMuPluginFile(string $file, string $data) : void
  • -
  • writeToPluginFile(string $file, string $data) : void
  • -
  • writeToThemeFile(string $file, string $data) : void
  • -
  • writeToUploadedFile(string $filename, string $data, DateTime|string|int|null [$date]) : string
  • -
-

Read more in Codeception documentation.

- - - - - - -
-
- - -
- -
- - - -
-
-
-
- - - - - - - - - \ No newline at end of file diff --git a/docs/public/modules/WPLoader/index.html b/docs/public/modules/WPLoader/index.html deleted file mode 100644 index e561a58c8..000000000 --- a/docs/public/modules/WPLoader/index.html +++ /dev/null @@ -1,571 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - WPLoader - wp-browser docs - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
- - - - - - -
- - -
- -
- - - - - - -
-
- - - -
-
-
- - - - -
-
-
- - - -
-
-
- - - -
-
-
- - - -
-
- - - - - - - -

WPLoader

- -

WPLoader module

-

A module to load WordPress and make its code available in tests.

-

Depending on the value of the loadOnly configuration parameter, the module will behave differently:

-
    -
  • loadOnly: false - The module will load WordPress like the Core PHPUnit suite does to run integration tests in a - controlled environment. Use the module in this mode with test cases generated - using the generate:wpunit command.
  • -
  • loadOnly: true - The module will load WordPress to make it available in the context of tests. Use the module in this - mode in Cest, Cept and Codeception unit test cases.
  • -
-

Configuration with loadOnly: false

-

The module will load WordPress like the Core PHPUnit suite does to run integration tests in a controlled -environment.
-Together with the test case generated by the generate:wpunit command the module -will:

-
    -
  • take care of running any test method in a database transaction rolled back after each test
  • -
  • manage and clean up the global environment and context between tests
  • -
-

When used in this mode, the module supports the following configuration parameters:

-
    -
  • loadOnly - false to load WordPress and run tests in a controlled environment.
  • -
  • wpRootFolder - required; the path to the WordPress installation root folder. This can be a relative path to the - codeception root directory, or an absolute path to the WordPress installation directory. The WordPress installation - directory is the directory that contains the wp-load.php file.
  • -
  • dbUrl - required; the URL to the database to use to run tests. The URL must be in the form - mysql://username:password@host:port/database to use a MySQL database, or in the form sqlite://path/to/database to - use a SQLite database. Alternatively, you can use the dbName, dbUser, dbPassword, dbHost configuration - parameters to specify the database connection details.
  • -
  • dump - the path to a database dump, or a set of database dumps, to load before running tests. The dump will be - loaded only once, after the tests run.
  • -
  • tablePrefix - the database table prefix to use when loading WordPress, defaults to wp_.
  • -
  • multisite - a boolean value to indicate if WordPress should be loaded and initialized in multisite mode.
  • -
  • dbCharset - the database charset to use when loading WordPress.
  • -
  • dbCollate - the database collate to use when loading WordPress.
  • -
  • domain - the domain to use when loading WordPress. Equivalent to defining the WP_TESTS_DOMAIN constant.
  • -
  • adminEmail - the administrator email to use when loading WordPress. Equivalent to defining the WP_TESTS_EMAIL - constant.
  • -
  • title - the site title to use when loading WordPress. Equivalent to defining the WP_TESTS_TITLE constant.
  • -
  • phpBinary - the path to the PHP binary to use to run tests. Defaults to the WP_PHP_BINARY constant.
  • -
  • language - the language to use when loading WordPress. Equivalent to defining the WPLANG constant.
  • -
  • configFile - a configuration file, or a set of configuration files, to load before the tests to further customize - and control the WordPress testing environment.
  • -
  • pluginsFolder - the path to the plugins folder to use when loading WordPress. Equivalent to defining the - WP_PLUGIN_DIR constant.
  • -
  • plugins - a list of plugins to activate and load in the WordPress installation. Each plugin must be specified in a - format like hello.php or my-plugin/my-plugin.php format.
  • -
  • bootstrapActions - a list of actions or callbacks to call after WordPress is loaded and before the tests run.
  • -
  • theme - the theme to activate and load in the WordPress installation. The theme must be specified in slug format - like - twentytwentythree.
  • -
  • AUTH_KEY - the AUTH_KEY constant value to use when loading WordPress. If the wpRootFolder path points at a - configured installation, containing the wp-config.php file, then the value of the constant in the configuration file - will be used, else it will be randomly generated.
  • -
  • SECURE_AUTH_KEY - the SECURE_AUTH_KEY constant value to use when loading WordPress. If the wpRootFolder path - points at a configured installation, containing the wp-config.php file, then the value of the constant in the - configuration file will be used, else it will be randomly generated.
  • -
  • LOGGED_IN_KEY - the LOGGED_IN_KEY constant value to use when loading WordPress. If the wpRootFolder path points - at a configured installation, containing the wp-config.php file, then the value of the constant in the configuration - file will be used, else it will be randomly generated.
  • -
  • NONCE_KEY - the NONCE_KEY constant value to use when loading WordPress. If the wpRootFolder path points at a - configured installation, containing the wp-config.php file, then the value of the constant in the configuration file - will be used, else it will be randomly generated.
  • -
  • AUTH_SALT - the AUTH_SALT constant value to use when loading WordPress. If the wpRootFolder path points at a - configured installation, containing the wp-config.php file, then the value of the constant in the configuration file - will be used, else it will be randomly generated.
  • -
  • SECURE_AUTH_SALT - the SECURE_AUTH_SALT constant value to use when loading WordPress. If the wpRootFolder path - points at a configured installation, containing the wp-config.php file, then the value of the constant in the - configuration file will be used, else it will be randomly generated.
  • -
  • LOGGED_IN_SALT - the LOGGED_IN_SALT constant value to use when loading WordPress. If the wpRootFolder path - points at a configured installation, containing the wp-config.php file, then the value of the constant in the - configuration file will be used, else it will be randomly generated.
  • -
  • NONCE_SALT - the NONCE_SALT constant value to use when loading WordPress. If the wpRootFolder path points at a - configured installation, containing the wp-config.php file, then the value of the constant in the configuration file - will be used, else it will be randomly generated.
  • -
  • AUTOMATIC_UPDATER_DISABLED - the AUTOMATIC_UPDATER_DISABLED constant value to use when loading WordPress. If - the wpRootFolder path points at a configured installation, containing the wp-config.php file, then the value of - the constant in the configuration file will be used, else it will be randomly generated.
  • -
  • WP_HTTP_BLOCK_EXTERNAL - the WP_HTTP_BLOCK_EXTERNAL constant value to use when loading WordPress. If - the wpRootFolder path points at a configured installation, containing the wp-config.php file, then the value of - the constant in the configuration file will be used, else it will be randomly generated.
  • -
-

This is an example of an integration suite configured to use the module:

-
actor: IntegrationTester
-bootstrap: _bootstrap.php
-modules:
-  enabled:
-    - \Helper\Integration
-    - lucatume\WPBrowser\Module\WPLoader:
-        wpRootFolder: /var/wordpress
-        dbUrl: mysql://root:root@mysql:3306/wordpress
-        tablePrefix: test_
-        domain: wordpress.test
-        adminEmail: admin@wordpress.test
-        title: 'Integration Tests'
-        plugins:
-          - hello.php
-          - woocommerce/woocommerce.php
-          - my-plugin/my-plugin.php
-        theme: twentytwentythree
-
-

The following configuration uses dynamic configuration parameters to set the module configuration:

-
actor: IntegrationTester
-bootstrap: _bootstrap.php
-modules:
-  enabled:
-    - \Helper\Integration
-    - lucatume\WPBrowser\Module\WPLoader:
-        wpRootFolder: '%WP_ROOT_FOLDER%'
-        dbUrl: '%WP_DB_URL%'
-        tablePrefix: '%WP_TABLE_PREFIX%'
-        domain: '%WP_DOMAIN%'
-        adminEmail: '%WP_ADMIN_EMAIL%'
-        title: '%WP_TITLE%'
-        plugins:
-          - hello.php
-          - woocommerce/woocommerce.php
-          - my-plugin/my-plugin.php
-        theme: twentytwentythree
-
-

The following example configuration uses a SQLite database and loads a database fixture before the tests run:

-
actor: IntegrationTester
-bootstrap: _bootstrap.php
-modules:
-  enabled:
-    - \Helper\Integration
-    - lucatume\WPBrowser\Module\WPLoader:
-        wpRootFolder: /var/wordpress
-        dbUrl: sqlite:///var/wordpress/wp-tests.sqlite
-        dump:
-          - tests/_data/products.sql
-          - tests/_data/users.sql
-          - tests/_data/orders.sql
-        tablePrefix: test_
-        domain: wordpress.test
-        adminEmail: admin@wordpress.test
-        title: 'Integration Tests'
-        plugins:
-          - hello.php
-          - woocommerce/woocommerce.php
-          - my-plugin/my-plugin.php
-        theme: twentytwentythree
-
-

Handling a custom site structure

-

If you're working on a site project using a custom file structure, e.g. [Bedrock][4], you should -use a custom configuration and, together with that, configure the WPLoader module to -load WordPress, plugins and themes code from the correct locations. -Take care to point the wpRootFolder parameter to the directory containing the wp-load.php file, -the /var/my-site/web/wp one in the following example, and the module will read the project configuration file to load -the WordPress code from the correct location.

-

Here's an example of how the module should be configured to run integration tests on a Bedrock installation:

-
actor: IntegrationTester
-bootstrap: _bootstrap.php
-modules:
-  enabled:
-    - \Helper\Integration
-    - lucatume\WPBrowser\Module\WPLoader:
-        wpRootFolder: /var/my-site/web/wp
-        dbUrl: mysql://root:root@mysql:3306/wordpress
-        tablePrefix: test_
-        domain: my-project.test
-        adminEmail: admin@my-project.test
-        title: 'Integration Tests'
-        plugins:
-          - hello.php
-          - woocommerce/woocommerce.php
-          - my-plugin/my-plugin.php
-        theme: twentytwentythree
-
-

In general, pointing the wpRootFolder parameter to the directory containing the wp-load.php file should take care of -loading WordPress code from the correct location. -Should that not be the case, use the configFile parameter to point the module to the project test configuration file: -a PHP file defining the constants and environment variables to use to load WordPress, plugins and themes correctly.

-

Configuration with loadOnly: true

-

The module will load WordPress from the location specified by the wpRootFodler parameter, relying -on the WPDb module to manage the database state.

-

When used in this mode, the module supports the following configuration parameters:

-
    -
  • loadOnly - true to load WordPress and make it available in the context of tests.
  • -
  • wpRootFolder - required; the path to the WordPress installation root folder. This can be a relative path to the - codeception root directory, or an absolute path to the WordPress installation directory. The WordPress installation - directory is the directory that contains the wp-load.php file.
  • -
  • dbUrl - required; the URL to the database to use to run tests. The URL must be in the form - mysql://username:password@host:port/database to use a MySQL database, or in the form sqlite://path/to/database to - use a SQLite database. Alternatively, you can use the dbName, dbUser, dbPassword, dbHost configuration - parameters to specify the database connection details.
  • -
  • domain - the domain to use when loading WordPress. Equivalent to defining the WP_TESTS_DOMAIN constant.
  • -
-

The following is an example of the module configuration to run end-to-end tests on the site served -at http://localhost:8080 URL and served from the /var/wordpress directory:

-
actor: EndToEndTester
-bootstrap: _bootstrap.php
-modules:
-  enabled:
-    - \Helper\Integration
-    - lucatume\WPBrowser\Module\WPDb:
-        dbUrl: 'mysql://root:password@localhost:3306/wordpress'
-        url: 'http://localhost:8080'
-        tablePrefix: 'wp_'
-        dump: 'tests/_data/dump.sql'
-        populate: true
-        cleanup: true
-        reconnect: false
-        urlReplacement: true
-        originalUrl: http://wordpress.test
-        waitlock: 10
-        createIfNotExists: true
-    - lucatume\WPBrowser\Module\WPLoader:
-        loadOnly: true
-        wpRootFolder: /var/wordpress
-        dbUrl: sqlite:///var/wordpress/wp-tests.sqlite
-        domain: wordpress.test
-
-

Methods

-

The module provides the following methods:

-
    -
  • factory() : lucatume\WPBrowser\Module\WPLoader\FactoryStore
  • -
  • getContentFolder(string [$path]) : string
  • -
  • getInstallation() : lucatume\WPBrowser\WordPress\Installation
  • -
  • getPluginsFolder(string [$path]) : string
  • -
  • getThemesFolder(string [$path]) : string
  • -
  • getWpRootFolder(?string [$path]) : string
  • -
-

[4]:

- - - - - - -
-
- - -
- -
- - - -
-
-
-
- - - - - - - - - \ No newline at end of file diff --git a/docs/public/modules/WPQueries/index.html b/docs/public/modules/WPQueries/index.html deleted file mode 100644 index 8c2480237..000000000 --- a/docs/public/modules/WPQueries/index.html +++ /dev/null @@ -1,369 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - WPQueries - wp-browser docs - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
- - - - - - -
- - -
- -
- - - - - - -
-
- - - -
-
-
- - - - -
-
-
- - - -
-
-
- - - -
-
-
- - - -
-
- - - - - - - -

WPQueries

- -

WPQueries module

-

This module provides assertions for WordPress queries.

-

This module can be used in any test context where the global $wpdb variable is defined, this usually means in any -suite where [the WPLoader module] is used.

-

Configuration

-

The method does not require configuration.

-

Methods

-

The module provides the following methods:

-
    -
  • assertCountQueries(int $n, string [$message]) : void
  • -
  • assertNotQueries(string [$message]) : void
  • -
  • assertNotQueriesByAction(string $action, string [$message]) : void
  • -
  • assertNotQueriesByFilter(string $filter, string [$message]) : void
  • -
  • assertNotQueriesByFunction(string $function, string [$message]) : void
  • -
  • assertNotQueriesByMethod(string $class, string $method, string [$message]) : void
  • -
  • assertNotQueriesByStatement(string $statement, string [$message]) : void
  • -
  • assertNotQueriesByStatementAndAction(string $statement, string $action, string [$message]) : void
  • -
  • assertNotQueriesByStatementAndFilter(string $statement, string $filter, string [$message]) : void
  • -
  • assertNotQueriesByStatementAndFunction(string $statement, string $function, string [$message]) : void
  • -
  • assertNotQueriesByStatementAndMethod(string $statement, string $class, string $method, string [$message]) : void
  • -
  • assertQueries(string [$message]) : void
  • -
  • assertQueriesByAction(string $action, string [$message]) : void
  • -
  • assertQueriesByFilter(string $filter, string [$message]) : void
  • -
  • assertQueriesByFunction(string $function, string [$message]) : void
  • -
  • assertQueriesByMethod(string $class, string $method, string [$message]) : void
  • -
  • assertQueriesByStatement(string $statement, string [$message]) : void
  • -
  • assertQueriesByStatementAndAction(string $statement, string $action, string [$message]) : void
  • -
  • assertQueriesByStatementAndFilter(string $statement, string $filter, string [$message]) : void
  • -
  • assertQueriesByStatementAndFunction(string $statement, string $function, string [$message]) : void
  • -
  • assertQueriesByStatementAndMethod(string $statement, string $class, string $method, string [$message]) : void
  • -
  • assertQueriesCountByAction(int $n, string $action, string [$message]) : void
  • -
  • assertQueriesCountByFilter(int $n, string $filter, string [$message]) : void
  • -
  • assertQueriesCountByFunction(int $n, string $function, string [$message]) : void
  • -
  • assertQueriesCountByMethod(int $n, string $class, string $method, string [$message]) : void
  • -
  • assertQueriesCountByStatement(int $n, string $statement, string [$message]) : void
  • -
  • assertQueriesCountByStatementAndAction(int $n, string $statement, string $action, string [$message]) : void
  • -
  • assertQueriesCountByStatementAndFilter(int $n, string $statement, string $filter, string [$message]) : void
  • -
  • assertQueriesCountByStatementAndFunction(int $n, string $statement, string $function, string [$message]) : void
  • -
  • assertQueriesCountByStatementAndMethod(int $n, string $statement, string $class, string $method, string [$message]) : void
  • -
  • countQueries(?wpdb [$wpdb]) : int
  • -
  • getQueries(?wpdb [$wpdb]) : array
  • -
- - - - - - -
-
- - -
- -
- - - -
-
-
-
- - - - - - - - - \ No newline at end of file diff --git a/docs/public/modules/WPWebDriver/index.html b/docs/public/modules/WPWebDriver/index.html deleted file mode 100644 index de2ac8657..000000000 --- a/docs/public/modules/WPWebDriver/index.html +++ /dev/null @@ -1,502 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - WPWebDriver - wp-browser docs - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
- - - - - - -
- - -
- -
- - - - - - -
-
- - - -
-
-
- - - - -
-
-
- - - -
-
-
- - - -
-
-
- - - -
-
- - - - - - - -

WPWebDriver

- -

WPWebDriver module

-

This module drives a browser using a solution like Selenium or Chromedriver to simulate user interactions with -the WordPress project.

-

The module has full Javascript support, differently from the WPBrowser module, and can be used to test -sites that use Javascript to render the page or to make assertions that require Javascript support.

-

The method extends the Codeception WebDriver module and is used in the context of Cest and Cept test -cases.

-

Configuration

-
    -
  • browser - the browser to use; e.g. 'chrome'
  • -
  • url - required; the start URL of your WordPress project.
  • -
  • adminUsername - required; the site administrator username to use in actions like loginAsAdmin.
  • -
  • adminPassword - required; the site administrator password to use in actions like loginAsAdmin.
  • -
  • adminPath - the path to the WordPress admin directory; defaults to /wp-admin.
  • -
-

More configuration options, and their explanation, are available in the Codeception WebDriver module documentation.

-

The following is an example of the module configuration to run tests on thehttp://localhost:8080 site:

-
modules:
-  enabled:
-    lucatume\WPBrowser\Module\WPBrowser:
-      url: 'http://localhost:8080'
-      adminUsername: 'admin'
-      adminPassword: 'password'
-      adminPath: '/wp-admin'
-      browser: chrome
-      host: 'localhost'
-      port: '4444'
-      window_size: false
-      capabilities:
-        chromeOptions:
-          args: [ "--headless", "--disable-gpu", "--proxy-server='direct://'", "--proxy-bypass-list=*", "--no-sandbox", "--disable-dev-shm-usage" ]
-
-

The following configuration uses dynamic configuration parameters to set the module configuration:

-
modules:
-  enabled:
-    lucatume\WPBrowser\Module\WPBrowser:
-      url: 'http://localhost:8080'
-      adminUsername: 'admin'
-      adminPassword: 'password'
-      adminPath: '/wp-admin'
-      browser: chrome
-      host: '%CHROME_HOST%'
-      port: '%CHROME_PORT%'
-      window_size: `1920,1080`
-      capabilities:
-        chromeOptions:
-          args: [ "--disable-gpu", "--proxy-server='direct://'", "--proxy-bypass-list=*", "--no-sandbox", "--disable-dev-shm-usage" ]
-
-

Furthermore, the above configuration will not run Chrome in headless mode: the browser window will be visible.

-

Methods

-

The module provides the following methods:

-
    -
  • acceptPopup() : void
  • -
  • activatePlugin(array|string $pluginSlug) : void
  • -
  • amEditingPostWithId(int $id) : void
  • -
  • amOnAdminAjaxPage(array|string|null [$queryVars]) : void
  • -
  • amOnAdminPage(string $page) : void
  • -
  • amOnCronPage(array|string|null [$queryVars]) : void
  • -
  • amOnPage($page) : void
  • -
  • amOnPagesPage() : void
  • -
  • amOnPluginsPage() : void
  • -
  • amOnSubdomain(string $subdomain) : void
  • -
  • amOnUrl($url) : void
  • -
  • appendField($field, string $value) : void
  • -
  • attachFile($field, string $filename) : void
  • -
  • cancelPopup() : void
  • -
  • checkOption($option) : void
  • -
  • clearField($field) : void
  • -
  • click($link, [$context]) : void
  • -
  • clickWithLeftButton([$cssOrXPath], ?int [$offsetX], ?int [$offsetY]) : void
  • -
  • clickWithRightButton([$cssOrXPath], ?int [$offsetX], ?int [$offsetY]) : void
  • -
  • closeTab() : void
  • -
  • deactivatePlugin(array|string $pluginSlug) : void
  • -
  • debugWebDriverLogs(?Codeception\TestInterface [$test]) : void
  • -
  • deleteSessionSnapshot($name) : void
  • -
  • dontSee($text, [$selector]) : void
  • -
  • dontSeeCheckboxIsChecked($checkbox) : void
  • -
  • dontSeeCookie($cookie, array [$params], bool [$showDebug]) : void
  • -
  • dontSeeCurrentUrlEquals(string $uri) : void
  • -
  • dontSeeCurrentUrlMatches(string $uri) : void
  • -
  • dontSeeElement($selector, array [$attributes]) : void
  • -
  • dontSeeElementInDOM($selector, array [$attributes]) : void
  • -
  • dontSeeInCurrentUrl(string $uri) : void
  • -
  • dontSeeInField($field, $value) : void
  • -
  • dontSeeInFormFields($formSelector, array $params) : void
  • -
  • dontSeeInPageSource(string $text) : void
  • -
  • dontSeeInPopup(string $text) : void
  • -
  • dontSeeInSource($raw) : void
  • -
  • dontSeeInTitle($title) : void
  • -
  • dontSeeLink(string $text, string [$url]) : void
  • -
  • dontSeeOptionIsSelected($selector, $optionText) : void
  • -
  • dontSeePluginInstalled(string $pluginSlug) : void
  • -
  • doubleClick($cssOrXPath) : void
  • -
  • dragAndDrop($source, $target) : void
  • -
  • executeAsyncJS(string $script, array [$arguments]) : void
  • -
  • executeInSelenium(Closure $function) : void
  • -
  • executeJS(string $script, array [$arguments]) : void
  • -
  • fillField($field, $value) : void
  • -
  • grabAttributeFrom($cssOrXpath, $attribute) : ?string
  • -
  • grabCookie($cookie, array [$params]) : mixed
  • -
  • grabCookiesWithPattern(string $cookiePattern) : ?array
  • -
  • grabFromCurrentUrl([$uri]) : mixed
  • -
  • grabFullUrl() : string
  • -
  • grabMultiple($cssOrXpath, [$attribute]) : array
  • -
  • grabPageSource() : string
  • -
  • grabTextFrom($cssOrXPathOrRegex) : mixed
  • -
  • grabValueFrom($field) : ?string
  • -
  • grabWordPressTestCookie(?string [$name]) : ?Symfony\Component\BrowserKit\Cookie
  • -
  • loadSessionSnapshot($name, bool [$showDebug]) : bool
  • -
  • logOut(string|bool [$redirectTo]) : void
  • -
  • loginAs(string $username, string $password, int [$timeout], int [$maxAttempts]) : void
  • -
  • loginAsAdmin(int [$timeout], int [$maxAttempts]) : void
  • -
  • makeElementScreenshot($selector, ?string [$name]) : void
  • -
  • makeHtmlSnapshot(?string [$name]) : void
  • -
  • makeScreenshot(?string [$name]) : void
  • -
  • maximizeWindow() : void
  • -
  • moveBack() : void
  • -
  • moveForward() : void
  • -
  • moveMouseOver([$cssOrXPath], ?int [$offsetX], ?int [$offsetY]) : void
  • -
  • openNewTab() : void
  • -
  • performOn($element, $actions, int [$timeout]) : void
  • -
  • pressKey($element, ...[$chars]) : void
  • -
  • reloadPage() : void
  • -
  • resetCookie($cookie, array [$params], bool [$showDebug]) : void
  • -
  • resizeWindow(int $width, int $height) : void
  • -
  • saveSessionSnapshot($name) : void
  • -
  • scrollTo($selector, ?int [$offsetX], ?int [$offsetY]) : void
  • -
  • see($text, [$selector]) : void
  • -
  • seeCheckboxIsChecked($checkbox) : void
  • -
  • seeCookie($cookie, array [$params], bool [$showDebug]) : void
  • -
  • seeCurrentUrlEquals(string $uri) : void
  • -
  • seeCurrentUrlMatches(string $uri) : void
  • -
  • seeElement($selector, array [$attributes]) : void
  • -
  • seeElementInDOM($selector, array [$attributes]) : void
  • -
  • seeErrorMessage(array|string [$classes]) : void
  • -
  • seeInCurrentUrl(string $uri) : void
  • -
  • seeInField($field, $value) : void
  • -
  • seeInFormFields($formSelector, array $params) : void
  • -
  • seeInPageSource(string $text) : void
  • -
  • seeInPopup(string $text) : void
  • -
  • seeInSource($raw) : void
  • -
  • seeInTitle($title) : void
  • -
  • seeLink(string $text, ?string [$url]) : void
  • -
  • seeMessage(array|string [$classes]) : void
  • -
  • seeNumberOfElements($selector, $expected) : void
  • -
  • seeNumberOfElementsInDOM($selector, $expected) : void
  • -
  • seeNumberOfTabs(int $number) : void
  • -
  • seeOptionIsSelected($selector, $optionText) : void
  • -
  • seePluginActivated(string $pluginSlug) : void
  • -
  • seePluginDeactivated(string $pluginSlug) : void
  • -
  • seePluginInstalled(string $pluginSlug) : void
  • -
  • seeWpDiePage() : void
  • -
  • selectOption($select, $option) : void
  • -
  • setCookie($name, $value, array [$params], [$showDebug]) : void
  • -
  • submitForm($selector, array $params, [$button]) : void
  • -
  • switchToFrame(?string [$locator]) : void
  • -
  • switchToIFrame(?string [$locator]) : void
  • -
  • switchToNextTab(int [$offset]) : void
  • -
  • switchToPreviousTab(int [$offset]) : void
  • -
  • switchToWindow(?string [$name]) : void
  • -
  • type(string $text, int [$delay]) : void
  • -
  • typeInPopup(string $keys) : void
  • -
  • uncheckOption($option) : void
  • -
  • unselectOption($select, $option) : void
  • -
  • wait($timeout) : void
  • -
  • waitForElement($element, int [$timeout]) : void
  • -
  • waitForElementChange($element, Closure $callback, int [$timeout]) : void
  • -
  • waitForElementClickable($element, int [$timeout]) : void
  • -
  • waitForElementNotVisible($element, int [$timeout]) : void
  • -
  • waitForElementVisible($element, int [$timeout]) : void
  • -
  • waitForJS(string $script, int [$timeout]) : void
  • -
  • waitForJqueryAjax(int [$time]) : void
  • -
  • waitForText(string $text, int [$timeout], [$selector]) : void
  • -
-

Read more in Codeception documentation.

- - - - - - -
-
- - -
- -
- - - -
-
-
-
- - - - - - - - - \ No newline at end of file diff --git a/docs/public/search/search_index.json b/docs/public/search/search_index.json deleted file mode 100644 index 6f0684aa1..000000000 --- a/docs/public/search/search_index.json +++ /dev/null @@ -1 +0,0 @@ -{"config":{"lang":["en"],"separator":"[\\s\\-]+","pipeline":["stopWordFilter"]},"docs":[{"location":"","title":"Start here","text":"

The wp-browser library provides a set of Codeception modules and middleware to enable the testing of WordPress sites, plugins and themes.

This is the documentation for version 4 of the project, the current version. Documentation for the previous version of the project, version 3, can be found here.

"},{"location":"#installation","title":"Installation","text":"

Add wp-browser to your project as a development dependency using Composer

cd my-wordrpess-project\ncomposer require --dev lucatume/wp-browser\n

Initialize wp-browser to quickly configured to suite your project and setup:

vendor/bin/codecept init wpbrowser\n

The command will set up your project to run integration and end-to-end tests using:

  • SQLite as the database engine, leveraging the SQLite Database Integration plugin
  • PHP built-in web server to serve the WordPress site on localhost (e.g. http://localhost:8080)
  • Chromedriver to drive the local version of Chrome installed on your machine

If you're working on a plugin or theme project, the default configuration will add some extra steps:

  • install the latest version of WordPress in the tests/_wordpress directory
  • create a tests/_plugins directory: any file or directory in this directory will be symlinked into the WordPress installation in tests/_wordpress/wp-content/plugins
  • create a tests/_themes directory: any file or directory in this directory will be symlinked into the WordPress installation in tests/_wordpress/wp-content/themes

For most projects this configuration will be enough to get started with testing.

You can run your tests immediately using the vendor/bin/codecept run command.

Read more about the commands provided by the library here.

"},{"location":"#using-a-custom-configuration","title":"Using a custom configuration","text":"

If you decide to skip the default configuration, you will be able to set up wp-browser to suit your needs and local setup by editing the tests/.env file. The inline documentation in the file will guide you through the configuration process.

Read more about using a custom configuration here.

"},{"location":"#getting-support-for-wp-browser-configuration-and-usage","title":"Getting support for wp-browser configuration and usage","text":"

The best place to get support for wp-browser is this documentation. Since this project builds on top of PHPUnit and Codeception, you can also refer to their documentation.

If you can't find the answer to your question here you can ask on the \"Issues\" section of the wp-browser repository taking care to provide as much information as possible.

Finally, you can contact me directly to set up a call to discuss your project needs and how wp-browser can help you.

Table of contents:

  • The default configuration
  • Using a custom configuration
  • Modules
    • WPBrowser
    • WPCLI
    • WPDb
    • WPFilesystem
    • WPLoader
    • WPQueries
    • WPWebDriver
  • Extensions
    • BuiltInServerController
    • ChromeDriverController
    • DockerComposeController
  • Commands
    • run and codeception:run
    • dev:start
    • dev:stop
    • dev:restart
    • wp:db:import
    • wp:db:export
    • chromedriver:update
    • generate:wpunit
"},{"location":"commands/","title":"Commands","text":""},{"location":"commands/#codeception-commands-provided-by-the-library","title":"Codeception commands provided by the library","text":"

The library provides some custom commands that can be added to the project Codeception configuration file ( either codeception.yml or codeception.dist.yml).

"},{"location":"commands/#run-and-codeceptionrun","title":"run and codeception:run","text":"

WordPress extensive use of global variables, constants and side effectes makes it difficult to run multiple test suites in the same process without running into conflicts due to leaking state and side effects. For this reason the project replaces Codeception run command with one that will run each suite in a separate process. You can invoke the original Codeception command using the codeception:run command. Just like the original, the run command accepts all the arguments and options of the original Codeception command.

Run all the suites, each one in a separate process:

vendor/bin/codecept run\n

Run only the Integration suite:

vendor/bin/codecept run Integration\n

Run a specific test file:

vendor/bin/codecept run Integration tests/Integration/MyTest.php\n

Run a specific test method:

vendor/bin/codecept run Integration tests/Integration/MyTest.php:testMyMethod\n

Read the Codeception documentation for more information about the run command.

"},{"location":"commands/#devstart","title":"dev:start","text":"

If not already running, start the services required to run the tests. The started services are read from the Codeception configuration file (either codeception.yml or codeception.dist.yml), from the extensions section, under the config key.

Given the following configuration:

extensions:\n  enabled:\n    - lucatume\\WPBrowser\\Extension\\ChromeDriverController\n    - lucatume\\WPBrowser\\Extension\\BuiltInServerController\n    - lucatume\\WPBrowser\\Extension\\DockerComposeController\n  config:\n    lucatume\\WPBrowser\\Extension\\ChromeDriverController:\n      port: '%CHROMEDRIVER_PORT%'\n    lucatume\\WPBrowser\\Extension\\BuiltInServerController:\n      docRoot: '%WORDPRESS_ROOT_DIR%'\n      workers: 5\n      port: '%BUILT_IN_SERVER_PORT%'\n    lucatume\\WPBrowser\\Extension\\DockerComposeController:\n      compose-file: 'tests/docker-compose.yml'\n      env-file: 'tests/.env'\n

Running the command will start ChromeDriver, the built-in PHP server and Docker Compose.

"},{"location":"commands/#devstop","title":"dev:stop","text":"

If running, stop the services required to run the tests. The stopped services are read from the Codeception configuration file (either codeception.yml or codeception.dist.yml), from the extensions section, under the config key.

Given the following configuration:

extensions:\n  enabled:\n    - lucatume\\WPBrowser\\Extension\\ChromeDriverController\n    - lucatume\\WPBrowser\\Extension\\BuiltInServerController\n    - lucatume\\WPBrowser\\Extension\\DockerComposeController\n  config:\n    lucatume\\WPBrowser\\Extension\\ChromeDriverController:\n      port: '%CHROMEDRIVER_PORT%'\n    lucatume\\WPBrowser\\Extension\\BuiltInServerController:\n      docRoot: '%WORDPRESS_ROOT_DIR%'\n      workers: 5\n      port: '%BUILT_IN_SERVER_PORT%'\n    lucatume\\WPBrowser\\Extension\\DockerComposeController:\n      compose-file: 'tests/docker-compose.yml'\n      env-file: 'tests/.env'\n

Running the command will stop ChromeDriver, the built-in PHP server and Docker Compose.

"},{"location":"commands/#devrestart","title":"dev:restart","text":"

This command is just a shortcut to run dev:stop and dev:start in sequence.

"},{"location":"commands/#devinfo","title":"dev:info","text":"

Provides information about the local testing stack managed by the DockerComposeController, BuiltInServerController and ChromeDriverController extensions.

"},{"location":"commands/#wpdbimport","title":"wp:db:import","text":"

You can use WP CLI to interact with your WordPress installation, but WP CLI does not support SQLite databases in the context of the wp db import command. This command fills that gap by providing a database dump file import command that will support MySQL and SQLite databases.

"},{"location":"commands/#wpdbexport","title":"wp:db:export","text":"

You can use WP CLI to interact with your WordPress installation, but WP CLI does not support SQLite databases in the context of the wp db export command. This command fills that gap by providing a database dump file export command that will support MySQL and SQLite databases.

"},{"location":"commands/#chromedriverupdate","title":"chromedriver:update","text":"

If you're using Chromedriver as a binary installed in the Composer vendor directory (vendor/bin by default), you can use this command to update it. This command will download the latest version of Chromedriver compatible with the Chrome version installed on your machine in the Composer vendor directory.

"},{"location":"commands/#generatewpunit","title":"generate:wpunit","text":"

Generate a test case extending the lucatume\\WPBrowser\\TestCase\\WPTestCase class. The class incorporates the WordPress test case from the wordpress-develop repository and adds some utility methods to make testing easier in the context of Codeception.

The lucatume\\WPBrowser\\TestCase\\WPTestCase class is the one that should be used when writing tests for WordPress code when using the WPLoader module.

Together with the WPLoader module, the WPTestCase class provides a number of functionalities to clean up the database after each test method and to reset the global state of WordPress.

"},{"location":"commands/#every-test-method-runs-in-a-transaction","title":"Every test method runs in a transaction","text":"

Database queries running in the context of test methods of a test case extending the WPTestCase class will run in a transaction that is rolled back after the test method is run. This means that any database change happening in the context of a test method will not appear in the database while the test is running and after the test is run.

"},{"location":"custom-configuration/","title":"Custom configuration","text":""},{"location":"custom-configuration/#custom-testing-configuration","title":"Custom testing configuration","text":"

Any non default configuration is considered a custom configuration. If your project requires a tailored set up, this is the configuration for you.

"},{"location":"custom-configuration/#using-a-custom-configuration-to-run-tests","title":"Using a custom configuration to run tests","text":"

If you decide to skip the default configuration, or are working on a project that cannot use the default configuration you will be able to set up wp-browser to suit your needs using a custom configuration.

Choose \"no\", to not use the default configuration, when running the vendor/bin/codecept init wpbrowser command.

The command will set up the file structure to be able to run integration and end-to-end tests and will leverage Codeception dynamic configuration using parameters to control the testing stack using the tests/.env file.

"},{"location":"custom-configuration/#walkthrough-of-the-testsenv-file","title":"Walkthrough of the tests/.env file","text":"
  • WORDPRESS_ROOT_DIR - the path to the root WordPress installation directory. This is the directory that contains WordPress files, like wp-load.php. This path can be absolute or relative to the root project directory; e.g. vendor/wordpress (relative) or /var/www/wordpress (absolute) will work.
  • WORDPRESS_URL - the URL of the WordPress installation. This is the URL that will be used by the browser to access the WordPress installation in the context of end-to-end tests; e.g. http://localhost:8080 or https://wordpress.local.
  • WORDPRESS_DOMAIN - the domain of the WordPress installation; this value should follow the WORDPRESS_URL value. E.g. if WORDPRESS_URL is http://localhost:8080 the WORDPRESS_DOMAIN value should be localhost:8080; if WORDPRESS_URL is https://wordpress.local the WORDPRESS_DOMAIN value should be wordpress.local.
  • WORDPRESS_DB_URL - the user, password, host, and name of the database used by the tests. If the database is a MySQL database, the value should be in the form mysql://user:password@host:port/database_name. If the database is a SQLite database, the value should be in the form sqlite://path/to/database/file.
  • WORDPRESS_TABLE_PREFIX - the database table prefix used by the WordPress installation, the one served at WORDPRESS_URL. This value is usually wp_ but can be different if the WordPress installation has been configured to use a different prefix.
  • TEST_TABLE_PREFIX - the database table prefix used by the WPLoader module to install WordPress and run the tests. This value is usually test_ and should be different from the WORDPRESS_TABLE_PREFIX value.
  • WORDPRESS_ADMIN_USER - the username of the WordPress administrator user. E.g. admin.
  • WORDPRESS_ADMIN_PASSWORD - the password of the WordPress administrator user. E.g. secret!password.
  • CHROMEDRIVER_HOST - the host of the Chromedriver server. This value is usually localhost if you're running Chromedriver on the same machine as the tests. If you're running your tests using a container stack, it will be the name of the container running Chromedriver, e.g. chromedriver.
  • CHROMEDRIVER_PORT - the port of the Chromedriver server. This value is usually 9515 if you're running Chromedriver on the same machine as the tests. If you're running your tests using a container stack, it will be the port exposed by the container running Chromedriver, e.g. 4444. Note the default configuration will set this value to a random port during set up to avoid conflicts with other services running on the same machine.
"},{"location":"custom-configuration/#handling-custom-file-structures","title":"Handling custom file structures","text":"

If your site uses a customized file structure to manage WordPress, you will need to further configure the WPLoader module to correctly look for the site content. Read more about setting up WPLoader to correctly load plugins and themes from custom locations here.

"},{"location":"default-configuration/","title":"Default configuration","text":""},{"location":"default-configuration/#default-testing-configuration","title":"Default testing configuration","text":"

The recommended configuration for most projects. It allows you to get into WordPress integration and end-to-end testing quickly and easily.

"},{"location":"default-configuration/#requirements","title":"Requirements","text":"

The default configuration will set up Codeception and wp-browser to use SQLite as the database engine, PHP built-in server to serve the test site on localhost and your local version of Chrome, driven by Chromedriver, to run end-to-end tests.

As such, the default configuration has the following requirements:

  • the sqlite3 PHP extension; you can check if if's installed by running php -m | grep sqlite3 in your terminal
  • the pdo_sqlite PHP extension; you can check if if's installed by running php -m | grep pdo_sqlite in your terminal
  • PHP built-in server can work with only one thread, but it will be faster using multiple threads; multiple threads are not supported on Windows, but they are supported on WSL.
  • the Chrome browser installed on your machine
"},{"location":"default-configuration/#overview-plugin-and-theme-project","title":"Overview - plugin and theme project","text":"

If you're configuring wp-browser for a plugin or theme project, the default configuration will install WordPress in the tests/_wordpress directory and configure the installation to run using SQLite as a database engine. The SQLite Database Integration plugin) will be placed in the installation must-use plugins directory.

If your plugin or theme project requires additional plugins or theme to work, you can place them in the tests/_worpdress/wp-content/plugins and tests/_wordpress/wp-content/themes directories respectively.

When adding, or removing, plugin and themes, remember to update the WPLoader module configuration to load the correct plugins and themes in your integration tests.

On the same note, update the database dump used by the WPDb module to reflect the changes in the dump loaded in the end-to-end tests. The easiest way to update the database fixture is to load the current database dump using the wp:db:import command, manually setting up the site interacting with it and then exporting the database dump using the wp:db:export command.

You can find out about the URL of the site served by the PHP built-in web server by running the dev:info command.

"},{"location":"default-configuration/#overview-site-project","title":"Overview - site project","text":"

If you're configuring wp-browser for a site project, the default configuration will use a combination of PHP built-in web server and the SQLite Database Integration plugin to run the tests and serve your site.

The router file used by the PHP built-in web server will force the site, when served on localhost, to use SQLite as database engine leaving your existing local MySQL database untouched.

Your existing WordPress installation will be picked up as it is, with all the plugins and themes found in the contents directory.

Existing plugins and themes are not added to WPLoader module configuration by wp-browser, you have to do that manually.

Similarly, the database dump used by the WPDb module is, by default, an empty WordPress installation where no plugins and themes are active. You have to update the database dump used by the module to reflect the state of your site. You can do that by loading the current database dump using the wp:db:import command, manually setting up the site interacting with it and then exporting the database dump using the wp:db:export command.

You can find out about the URL of the site served by the PHP built-in web server by running the dev:info command.

"},{"location":"default-configuration/#when-not-to-use-the-default-configuration","title":"When not to use the default configuration","text":"

The default configuration is the recommended one for most projects, but some projects might require you to use a custom configuration to make the most out of wp-browser.

"},{"location":"default-configuration/#database-drop-in","title":"Database drop-in","text":"

The default configuration will use the SQLite Database Integration plugin to use SQLite as the database engine. This requires placing a db.php drop-in file in the WordPress content directory.

If your project already requires a db.php drop-in file, you will have to use a custom configuration.

"},{"location":"default-configuration/#multisite-with-sub-domains","title":"Multisite with sub-domains","text":"

While Chrome will handle sub-domains correctly, even on localhost, WordPress will not. If you're testing a multisite installation with sub-domains, you will have to use a custom configuration.

"},{"location":"default-configuration/#custom-site-structure","title":"Custom site structure","text":"

If your site uses a customized file structure to manage WordPress, you will need to configure wp-browser using a custom configuration. This is usually true for some site projects, and will most likely not be an issue for plugin and theme projects.

Using a custom configuration is not that difficult though: read more about using a custom configuration here.

"},{"location":"extensions/","title":"Extensions","text":""},{"location":"extensions/#codeception-extensions-provided-by-the-library","title":"Codeception Extensions provided by the library","text":"

The library provides some custom Codeception extensions that can be added to the project Codeception configuration file, in the extensions section.

"},{"location":"extensions/#builtinservercontroller","title":"BuiltInServerController","text":"

This extension will start and stop the PHP built-in web server before and after the tests run.

The extension can be configured with the following parameters:

  • required
    • docRoot - the document root to use for the PHP Built-in server; it can be either an absolute path or a path relative to the Codeception root directory.
  • optional
    • suites - an array of Codeception suites to run the server for; if not set the server will be started for all the suites.
    • port - the port to use for the PHP Built-in server, if not set the server will use port 2389.
    • workers - the number of workers to use for the PHP Built-in server, if not set the server will use 5 workers. This is the equivalent of the PHP_CLI_SERVER_WORKERS environment variable.

Note: if you run PHP built-in server on Windows, the workers parameter will be ignored and the server will always run with a single worker. This limit is not present in WSL.

Example configuration starting the server for all suites:

extensions:\n  enabled:\n    - lucatume\\WPBrowser\\Extension\\BuiltInServerController\n  config:\n    lucatume\\WPBrowser\\Extension\\BuiltInServerController:\n      docRoot: /var/www/html\n      workers: 5\n

The extension can access environment variables defined in the tests configuration file:

extensions:\n  enabled:\n    - lucatume\\WPBrowser\\Extension\\BuiltInServerController\n  config:\n    lucatume\\WPBrowser\\Extension\\BuiltInServerController:\n      suites:\n        - EndToEnd\n        - WebApp\n      docRoot: '%WORDPRESS_ROOT_DIR%'\n      port: '%BUILT_IN_SERVER_PORT%'\n      workers: '%BUILT_IN_SERVER_WORKERS%'\n

This is a service extension that will be started and stopped by the dev:start and dev:stop commands.

"},{"location":"extensions/#chromedrivercontroller","title":"ChromeDriverController","text":"

This extension will start and stop the ChromeDriver before and after the tests are run.

The extension can be configured with the following parameters:

  • optional
    • suites - an array of Codeception suites to run the server for; if not set the server will be started for all the suites.
    • port - the port to use for the ChromeDriver, if not set the server will use port 9515.
    • binary - the path to the ChromeDriver binary, if not set the server will use the chromedriver binary in the Composer bin directory.

Example configuration starting the server for all suites:

extensions:\n  enabled:\n    - lucatume\\WPBrowser\\Extension\\ChromeDriverController\n  config:\n    lucatume\\WPBrowser\\Extension\\ChromeDriverController:\n      port: 4444\n      binary: /usr/local/bin/chromedriver\n

The extension can access environment variables defined in the tests configuration file:

extensions:\n  enabled:\n    - lucatume\\WPBrowser\\Extension\\ChromeDriverController\n  config:\n    suites:\n      - EndToEnd\n      - WebApp\n    lucatume\\WPBrowser\\Extension\\ChromeDriverController:\n      port: '%CHROMEDRIVER_PORT%'\n      binary: '%CHROMEDRIVER_BINARY%'\n

You can use the chromedriver:update command to download the latest version of ChromeDriver compatible with your Chrome browser version and place it in the Composer bin directory.

This is a service extension that will be started and stopped by the dev:start and dev:stop commands.

"},{"location":"extensions/#dockercomposecontroller","title":"DockerComposeController","text":"

This extension will start and stop a docker compose stack before and after the tests are run.

The extension can be configured with the following parameters:

  • required
    • compose-file - the path to the docker compose file to use; it can be either an absolute path or a path relative to the Codeception root directory.
  • optional
    • env-file- the path to the environment file to use; it can be either an absolute path or a path.

Example configuration starting the server for all suites:

extensions:\n  enabled:\n    - lucatume\\WPBrowser\\Extension\\DockerComposeController\n  config:\n    lucatume\\WPBrowser\\Extension\\DockerComposeController:\n      compose-file: /var/www/html/docker-compose.yml\n      env-file: /var/www/html/.env\n

The extension can access environment variables defined in the tests configuration file:

extensions:\n  enabled:\n    - lucatume\\WPBrowser\\Extension\\DockerComposeController\n  config:\n    suites:\n      - EndToEnd\n      - WebApp\n    lucatume\\WPBrowser\\Extension\\DockerComposeController:\n      compose-file: '%DOCKER_COMPOSE_FILE%'\n      env-file: '%DOCKER_COMPOSE_ENV_FILE%'\n

This is a service extension that will be started and stopped by the dev:start and wp:dev-stop commands.

"},{"location":"modules/WPBrowser/","title":"WPBrowser","text":""},{"location":"modules/WPBrowser/#wpbrowser-module","title":"WPBrowser module","text":"

Browse and test the site HTML with a fast browser without Javascript support.

This module trades the WPWebDriver module Javascript support for speed and stability. It is a good choice for testing sites that don't use Javascript or to make assertions that do not require Javascript support like:

  • testing HTTP return codes
  • testing HTML structure
  • testing JSON and XML responses from APIs

This module is used together with the WPDb module and the WPFilesystem module to control the site state, the database, and the site file structure.

This module is an extension of the Codeception PHPBrowser module, you can reference to the Codeception module documentation for more information on the module configuration and usage.

This module should be with Cest and Cept test cases.

"},{"location":"modules/WPBrowser/#configuration","title":"Configuration","text":"
  • url - required; the start URL of your WordPress project.
  • adminUsername - required; the site administrator username to use in actions like loginAsAdmin.
  • adminPassword - required; the site administrator password to use in actions like loginAsAdmin.
  • adminPath - the path to the WordPress admin directory; defaults to /wp-admin.

More Guzzle request options are available like:

headers - default headers are set before each test. cookies - default cookies are set before each test. auth - default authentication to be set before each test.

... and more.

The following is an example of the module configuration to run tests on thehttp://localhost:8080 site:

modules:\n  enabled:\n    lucatume\\WPBrowser\\Module\\WPBrowser:\n      url: 'http://localhost:8080'\n      adminUsername: 'admin'\n      adminPassword: 'password'\n      adminPath: '/wp-admin'\n      headers:\n        X_WPBROWSER_REQUEST: 1\n        X_TEST_REQUEST: 1\n        X_APM_REQUEST: 1\n

The following configuration uses dynamic configuration parameters to set the module configuration:

modules:\n  enabled:\n    lucatume\\WPBrowser\\Module\\WPBrowser:\n      url: '%WORDPRESS_URL%'\n      adminUsername: '%WORDPRESS_ADMIN_USER%'\n      adminPassword: '%WORDPRESS_ADMIN_PASSWORD%'\n      adminPath: '/wp-admin'\n      headers:\n        X_WPBROWSER_REQUEST: 1\n        X_TEST_REQUEST: 1\n        X_APM_REQUEST: 1\n
"},{"location":"modules/WPBrowser/#methods","title":"Methods","text":"

The module provides the following methods:

  • activatePlugin(array|string $pluginSlug) : void
  • amEditingPostWithId(int $id) : void
  • amHttpAuthenticated($username, $password) : void
  • amOnAdminAjaxPage(array|string|null [$queryVars]) : void
  • amOnAdminPage(string $page) : void
  • amOnCronPage(array|string|null [$queryVars]) : void
  • amOnPage(string $page) : void
  • amOnPagesPage() : void
  • amOnPluginsPage() : void
  • amOnSubdomain($subdomain) : void
  • amOnUrl($url) : void
  • attachFile($field, string $filename) : void
  • checkOption($option) : void
  • click($link, [$context]) : void
  • deactivatePlugin(array|string $pluginSlug) : void
  • deleteHeader(string $name) : void
  • dontSee(string $text, [$selector]) : void
  • dontSeeCheckboxIsChecked($checkbox) : void
  • dontSeeCookie($cookie, [$params]) : void
  • dontSeeCurrentUrlEquals(string $uri) : void
  • dontSeeCurrentUrlMatches(string $uri) : void
  • dontSeeElement($selector, array [$attributes]) : void
  • dontSeeInCurrentUrl(string $uri) : void
  • dontSeeInField($field, $value) : void
  • dontSeeInFormFields($formSelector, array $params) : void
  • dontSeeInSource(string $raw) : void
  • dontSeeInTitle($title) : void
  • dontSeeLink(string $text, string [$url]) : void
  • dontSeeOptionIsSelected($selector, $optionText) : void
  • dontSeePluginInstalled(string $pluginSlug) : void
  • dontSeeResponseCodeIs(int $code) : void
  • executeInGuzzle(Closure $function) : void
  • fillField($field, $value) : void
  • followRedirect() : void
  • grabAttributeFrom($cssOrXpath, string $attribute) : mixed
  • grabCookie(string $cookie, array [$params]) : mixed
  • grabCookiesWithPattern(string $cookiePattern) : ?array
  • grabFromCurrentUrl(?string [$uri]) : mixed
  • grabMultiple($cssOrXpath, ?string [$attribute]) : array
  • grabPageSource() : string
  • grabTextFrom($cssOrXPathOrRegex) : mixed
  • grabValueFrom($field) : mixed
  • grabWordPressTestCookie(?string [$name]) : ?Symfony\\Component\\BrowserKit\\Cookie
  • haveHttpHeader(string $name, string $value) : void
  • haveServerParameter(string $name, string $value) : void
  • logOut(string|bool [$redirectTo]) : void
  • loginAs(string $username, string $password) : void
  • loginAsAdmin() : void
  • makeHtmlSnapshot(?string [$name]) : void
  • moveBack(int [$numberOfSteps]) : void
  • resetCookie($cookie, [$params]) : void
  • see(string $text, [$selector]) : void
  • seeCheckboxIsChecked($checkbox) : void
  • seeCookie($cookie, [$params]) : void
  • seeCurrentUrlEquals(string $uri) : void
  • seeCurrentUrlMatches(string $uri) : void
  • seeElement($selector, array [$attributes]) : void
  • seeErrorMessage(array|string [$classes]) : void
  • seeInCurrentUrl(string $uri) : void
  • seeInField($field, $value) : void
  • seeInFormFields($formSelector, array $params) : void
  • seeInSource(string $raw) : void
  • seeInTitle($title) : void
  • seeLink(string $text, ?string [$url]) : void
  • seeMessage(array|string [$classes]) : void
  • seeNumberOfElements($selector, $expected) : void
  • seeOptionIsSelected($selector, $optionText) : void
  • seePageNotFound() : void
  • seePluginActivated(string $pluginSlug) : void
  • seePluginDeactivated(string $pluginSlug) : void
  • seePluginInstalled(string $pluginSlug) : void
  • seeResponseCodeIs(int $code) : void
  • seeResponseCodeIsBetween(int $from, int $to) : void
  • seeResponseCodeIsClientError() : void
  • seeResponseCodeIsRedirection() : void
  • seeResponseCodeIsServerError() : void
  • seeResponseCodeIsSuccessful() : void
  • seeWpDiePage() : void
  • selectOption($select, $option) : void
  • sendAjaxGetRequest(string $uri, array [$params]) : void
  • sendAjaxPostRequest(string $uri, array [$params]) : void
  • sendAjaxRequest(string $method, string $uri, array [$params]) : void
  • setCookie($name, $val, [$params]) : void
  • setHeader(string $name, string $value) : void
  • setMaxRedirects(int $maxRedirects) : void
  • setServerParameters(array $params) : void
  • startFollowingRedirects() : void
  • stopFollowingRedirects() : void
  • submitForm($selector, array $params, ?string [$button]) : void
  • switchToIframe(string $name) : void
  • uncheckOption($option) : void

Read more in Codeception documentation.

"},{"location":"modules/WPCLI/","title":"WPCLI","text":""},{"location":"modules/WPCLI/#wpcli-module","title":"WPCLI module","text":"

Use WP-CLI to interact with the WordPress installation under test and issue commands.

This module is used in the context of end-to-end testing, together with, or as a replacement for the WPDb module to manipulate the database and the WPFilesystem module to manipulate the site file structure.

This module should be with Cest and Cept test cases.

"},{"location":"modules/WPCLI/#configuration","title":"Configuration","text":"
  • path - required; the path to the WordPress installation under test. This can be a relative path to the codeception root directory, or an absolute path to the WordPress installation directory. The WordPress installation directory is the directory that contains the wp-load.php file.
  • url - the URL of the WordPress installation under test. Equivalent to the --url option of the wp command.
  • user - the user to use to run the wp command. Equivalent to the --user option of the wp command.
  • skip-plugins - a boolean value to indicate if the wp command should skip loading plugins. Equivalent to the --skip-plugins option of the wp command.
  • skip-themes - a boolean value to indicate if the wp command should skip loading themes. Equivalent to the --skip-themes option of the wp command.
  • skip-packages - a boolean value to indicate if the wp command should skip loading packages. Equivalent to the --skip-packages option of the wp command.
  • require - a list of PHP files to require before running the wp command. Equivalent to the --require option of the wp command.
  • exec - PHP code to execute before running the wp command. Equivalent to the --exec option of the wp command.
  • context - the context to use when running the wp command. Equivalent to the --context option of the wp command.
  • color - a boolean value to indicate if the wp command should output in color. Equivalent to the --color option of the wp command.
  • no-color - a boolean value to indicate if the wp command should not output in color. Equivalent to the --no-color option of the wp command.
  • debug - a boolean value to indicate if the wp command should output debug information. Equivalent to the --debug option of the wp command.
  • quiet - a boolean value to indicate if the wp command should suppress informational messages. Equivalent to the --quiet option of the wp command.
  • throw - a boolean value to indicate if the wp command should throw an exception if the command fails.
  • timeout - the timeout to use when running the wp command. When the timeout is reached the command will be terminated as a failure.
  • cache-dir - the directory to use to cache the files WPCLI might downloads. Equivalent to setting the WP_CLI_CACHE_DIR environment variable.
  • config-path - the path to the wp-cli.yml file to use. Equivalent to setting the WP_CLI_CONFIG_PATH environment variable.
  • custom-shell - the shell to use to run the wp command. Equivalent to setting the WP_CLI_SHELL environment variable.
  • packages-dir - the directory to use to store the packages downloaded by the wp package command. Equivalent to setting the WP_CLI_PACKAGES_DIR environment variable.

The following is an example of the module configuration to run WPCLI commands on the /var/wordpress directory:

modules:\n  enabled:\n    lucatume\\WPBrowser\\Module\\WPCLI:\n      path: /var/wordpress\n      throw: true\n

The following configuration uses dynamic configuration parameters to set the module configuration:

modules:\n  enabled:\n    lucatume\\WPBrowser\\Module\\WPCLI:\n      path: '%WP_ROOT_DIR%'\n      throw: true\n
"},{"location":"modules/WPCLI/#methods","title":"Methods","text":"

The module provides the following methods:

  • cli(array|string [$command], ?array [$env], mixed [$input]) : int
  • cliToArray(array $command, ?callable [$splitCallback], ?array [$env], mixed [$input]) : array
  • cliToString(array $command, ?array [$env], mixed [$input]) : string
  • dontSeeInShellOutput(string $text) : void
  • dontSeeShellOutputMatches(string $regex) : void
  • grabLastCliProcess() : lucatume\\WPBrowser\\WordPress\\CliProcess
  • grabLastShellErrorOutput() : string
  • grabLastShellOutput() : string
  • seeInShellOutput(string $text) : void
  • seeResultCodeIs(int $code) : void
  • seeResultCodeIsNot(int $code) : void
  • seeShellOutputMatches(string $regex) : void

Explore the WP-CLI documentation for more information on the available commands.

"},{"location":"modules/WPDb/","title":"WPDb","text":""},{"location":"modules/WPDb/#wpdb-module","title":"WPDb module","text":"

This module allows to manipulate the database of the WordPress installation under test directly, without using the WordPress API.

The module is used together with the WPBrowser module, WPWebDriver and WPFilesystem modules to control the site state, the database, and the site file structure.

Note about interaction with the WPLoader module: both this module and the WPLoader one can be used to control the state of the database before tests and set up fixtures: use either this or WPLoader, do not use both. This module should be used in end-to-end testing, the WPLoader module should be used in integration testing. If you're using this module to load a database dump before integration tests, use the WPLoader module dump configuration parameter instead.

This module should be with Cest and Cept test cases.

"},{"location":"modules/WPDb/#configuration","title":"Configuration","text":"

This module extends the Codeception Db module adding some configuration options and functions that are specific to WordPress.

  • dbUrl - required; the URL to use to connect to the database. The URL must be in the form mysql://user:password@host:port/database if you're using a MySQL database for your tests, or in the form sqlite://path/to/database/file if you're using a SQLite database for your tests ( like the default configuration does)
  • dsn - required; the DSN to use to connect to the database; required if not using the dbUrl parameter.
  • user - required; the user to use to connect to the database; required if not using the dbUrl parameter.
  • password - required; the password to use to connect to the database; required if not using the dbUrl parameter.
  • url - required;the URL of the WordPress installation under test. E.g. http://localhost:8080 or https://wordpress.test.
  • tablePrefix - the table prefix to use when interacting with the database; defaults to wp_.
  • dump - the path to a database dump file, or a set of database files, to load before running tests. The path can be relative to the project root directory, e.g. tests/_data/dump.sql, or absolute.
  • populate - a boolean value to indicate if the database should be populated importing the dump file(s) at the start of the suite.
  • cleanup - a boolean value to indicate if the database should be populated importing the dump file(s) before each test.
  • reconnect - a boolean value to indicate if the database connection should be re-established before each test.
  • populator - a command to use to populate the database instead of using PHP; read more on the Codeception documentation.
  • urlReplacement - a boolean value to indicate if the database dump file(s) should be searched for the siteurl and home options and replaced with the url parameter value. This is required since WordPress hard-codes URLs in the database, the original URL is inferred, if the originalUrl parameter is not provided.
  • originalUrl - if provided together with the urlReplacement parameter, the module will not try to infer the original URL from the database dump file(s) but use the provided value instead.
  • waitlock - the number of seconds to wait for a database lock to be released before failing the test. Defaults to 10 meaning that the test will fail if the database lock is not released after 10 seconds.
  • createIfNotExists - a boolean value to indicate if the database should be created if it does not exist. Defaults to false.

The following is an example of the module configuration to run tests on thehttp://localhost:8080 site:

modules:\n  enabled:\n    - lucatume\\WPBrowser\\Module\\WPDb:\n        dbUrl: 'mysql://root:password@localhost:3306/wordpress'\n        url: 'http://localhost:8080'\n        tablePrefix: 'wp_'\n        dump: 'tests/_data/dump.sql'\n        populate: true\n        cleanup: true\n        reconnect: false\n        urlReplacement: true\n        originalUrl: http://wordpress.test\n        waitlock: 10\n        createIfNotExists: true\n

The following configuration uses dynamic configuration parameters to set the module configuration:

modules:\n  enabled:\n    - lucatume\\WPBrowser\\Module\\WPDb:\n        dbUrl: '%DB_URL%'\n        url: '%WORDPRESS_URL%'\n        tablePrefix: '%WORDPRESS_TABLE_PREFIX%'\n        dump: '%DB_DUMP%'\n        populate: true\n        cleanup: true\n        reconnect: false\n        urlReplacement: true\n        originalUrl: '%WORDPRESS_ORIGINAL_URL%'\n        waitlock: 10\n        createIfNotExists: true\n

The following configuration uses a SQLite database:

modules:\n  enabled:\n    - lucatume\\WPBrowser\\Module\\WPDb:\n        dbUrl: 'sqlite://tests/database.sqlite'\n        url: 'http://localhost:8080'\n        tablePrefix: 'wp_'\n        dump: 'tests/_data/dump.sql'\n        populate: true\n        cleanup: true\n        reconnect: false\n        urlReplacement: true\n        originalUrl: http://wordpress.test\n        waitlock: 10\n        createIfNotExists: true\n
"},{"location":"modules/WPDb/#methods","title":"Methods","text":"

The module provides the following methods:

  • amConnectedToDatabase(string $databaseKey) : void
  • countRowsInDatabase(string $table, array [$criteria]) : int
  • dontHaveAttachmentFilesInDatabase(array|int $attachmentIds) : void
  • dontHaveAttachmentInDatabase(array $criteria, bool [$purgeMeta], bool [$removeFiles]) : void
  • dontHaveBlogInDatabase(array $criteria, bool [$removeTables], bool [$removeUploads]) : void
  • dontHaveCommentInDatabase(array $criteria, bool [$purgeMeta]) : void
  • dontHaveCommentMetaInDatabase(array $criteria) : void
  • dontHaveInDatabase(string $table, array $criteria) : void
  • dontHaveLinkInDatabase(array $criteria) : void
  • dontHaveOptionInDatabase(string $key, mixed [$value]) : void
  • dontHavePostInDatabase(array $criteria, bool [$purgeMeta]) : void
  • dontHavePostMetaInDatabase(array $criteria) : void
  • dontHavePostThumbnailInDatabase(int $postId) : void
  • dontHaveSiteOptionInDatabase(string $key, mixed [$value]) : void
  • dontHaveSiteTransientInDatabase(string $key) : void
  • dontHaveTableInDatabase(string $fullTableName) : void
  • dontHaveTermInDatabase(array $criteria, bool [$purgeMeta]) : void
  • dontHaveTermMetaInDatabase(array $criteria) : void
  • dontHaveTermRelationshipInDatabase(array $criteria) : void
  • dontHaveTermTaxonomyInDatabase(array $criteria) : void
  • dontHaveTransientInDatabase(string $transient) : void
  • dontHaveUserInDatabase(string|int $userIdOrLogin, bool [$purgeMeta]) : void
  • dontHaveUserInDatabaseWithEmail(string $userEmail, bool [$purgeMeta]) : array
  • dontHaveUserMetaInDatabase(array $criteria) : void
  • dontSeeAttachmentInDatabase(array $criteria) : void
  • dontSeeBlogInDatabase(array $criteria) : void
  • dontSeeCommentInDatabase(array $criteria) : void
  • dontSeeCommentMetaInDatabase(array $criteria) : void
  • dontSeeInDatabase(string $table, array [$criteria]) : void
  • dontSeeLinkInDatabase(array $criteria) : void
  • dontSeeOptionInDatabase(array|string $criteriaOrName, mixed [$value]) : void
  • dontSeePageInDatabase(array $criteria) : void
  • dontSeePostInDatabase(array $criteria) : void
  • dontSeePostMetaInDatabase(array $criteria) : void
  • dontSeePostWithTermInDatabase(int $post_id, int $term_taxonomy_id, ?int [$term_order], ?string [$taxonomy]) : void
  • dontSeeSiteOptionInDatabase(array|string $criteriaOrName, mixed [$value]) : void
  • dontSeeTableInDatabase(string $table) : void
  • dontSeeTermInDatabase(array $criteria) : void
  • dontSeeTermMetaInDatabase(array $criteria) : void
  • dontSeeTermTaxonomyInDatabase(array $criteria) : void
  • dontSeeUserInDatabase(array $criteria) : void
  • dontSeeUserMetaInDatabase(array $criteria) : void
  • getSiteDomain() : string
  • getUsersTableName() : string
  • grabAllFromDatabase(string $table, string $column, array $criteria) : array
  • grabAttachmentAttachedFile(int $attachmentPostId) : string
  • grabAttachmentMetadata(int $attachmentPostId) : array
  • grabBlogDomain(int $blogId) : string
  • grabBlogPath(int $blogId) : string
  • grabBlogTableName(int $blogId, string $table) : string
  • grabBlogTableNames(int $blogId) : array
  • grabBlogTablePrefix(int $blogId) : string
  • grabBlogVersionsTableName() : string
  • grabBlogsTableName() : string
  • grabColumnFromDatabase(string $table, string $column, array [$criteria]) : array
  • grabCommentmetaTableName() : string
  • grabCommentsTableName() : string
  • grabEntriesFromDatabase(string $table, array [$criteria]) : array
  • grabEntryFromDatabase(string $table, array [$criteria]) : array
  • grabFromDatabase(string $table, string $column, array [$criteria]) : void
  • grabLatestEntryByFromDatabase(string $tableName, string [$idColumn]) : int
  • grabLinksTableName() : string
  • grabNumRecords(string $table, array [$criteria]) : int
  • grabOptionFromDatabase(string $option_name) : mixed
  • grabPostFieldFromDatabase(int $postId, string $field) : mixed
  • grabPostMetaFromDatabase(int $postId, string $metaKey, bool [$single]) : mixed
  • grabPostmetaTableName() : string
  • grabPostsTableName() : string
  • grabPrefixedTableNameFor(string [$tableName]) : string
  • grabRegistrationLogTableName() : string
  • grabSignupsTableName() : string
  • grabSiteMetaFromDatabase(int $blogId, string $key, bool $single) : mixed
  • grabSiteMetaTableName() : string
  • grabSiteOptionFromDatabase(string $key) : mixed
  • grabSiteTableName() : string
  • grabSiteTransientFromDatabase(string $key) : mixed
  • grabSiteUrl(?string [$path]) : string
  • grabTablePrefix() : string
  • grabTermIdFromDatabase(array $criteria) : int|false
  • grabTermMetaTableName() : string
  • grabTermRelationshipsTableName() : string
  • grabTermTaxonomyIdFromDatabase(array $criteria) : int|false
  • grabTermTaxonomyTableName() : string
  • grabTermsTableName() : string
  • grabUserIdFromDatabase(string $userLogin) : int|false
  • grabUserMetaFromDatabase(int $userId, string $meta_key, bool [$single]) : mixed
  • grabUsermetaTableName() : string
  • grabUsersTableName() : string
  • haveAttachmentInDatabase(string $file, string|int [$date], array [$overrides], ?array [$imageSizes]) : int
  • haveBlogInDatabase(string $domainOrPath, array [$overrides], bool [$subdomain]) : int
  • haveCommentInDatabase(int $comment_post_ID, array [$data]) : int
  • haveCommentMetaInDatabase(int $comment_id, string $meta_key, mixed $meta_value) : int
  • haveInDatabase(string $table, array $data) : int
  • haveLinkInDatabase(array [$overrides]) : int
  • haveManyBlogsInDatabase(int $count, array [$overrides], bool [$subdomain]) : array
  • haveManyCommentsInDatabase(int $count, int $comment_post_ID, array [$overrides]) : array
  • haveManyLinksInDatabase(int $count, array [$overrides]) : array
  • haveManyPostsInDatabase(int $count, array [$overrides]) : array
  • haveManyTermsInDatabase(int $count, string $name, string $taxonomy, array [$overrides]) : array
  • haveManyUsersInDatabase(int $count, string $user_login, string [$role], array [$overrides]) : array
  • haveMenuInDatabase(string $slug, string $location, array [$overrides]) : array
  • haveMenuItemInDatabase(string $menuSlug, string $title, ?int [$menuOrder], array [$meta]) : int
  • haveOptionInDatabase(string $option_name, mixed $option_value, string [$autoload]) : int
  • havePageInDatabase(array [$overrides]) : int
  • havePostInDatabase(array [$data]) : int
  • havePostThumbnailInDatabase(int $postId, int $thumbnailId) : int
  • havePostmetaInDatabase(int $postId, string $meta_key, mixed $meta_value) : int
  • haveSiteMetaInDatabase(int $blogId, string $string, mixed $value) : int
  • haveSiteOptionInDatabase(string $key, mixed $value) : int
  • haveSiteTransientInDatabase(string $key, mixed $value) : int
  • haveTermInDatabase(string $name, string $taxonomy, array [$overrides]) : array
  • haveTermMetaInDatabase(int $term_id, string $meta_key, mixed $meta_value) : int
  • haveTermRelationshipInDatabase(int $object_id, int $term_taxonomy_id, int [$term_order]) : void
  • haveTransientInDatabase(string $transient, mixed $value) : int
  • haveUserCapabilitiesInDatabase(int $userId, array|string $role) : array
  • haveUserInDatabase(string $user_login, array|string [$role], array [$overrides]) : int
  • haveUserLevelsInDatabase(int $userId, array|string $role) : array
  • haveUserMetaInDatabase(int $userId, string $meta_key, mixed $meta_value) : array
  • importSql(array $sql) : void
  • importSqlDumpFile(?string [$dumpFile]) : void
  • performInDatabase($databaseKey, $actions) : void
  • seeAttachmentInDatabase(array $criteria) : void
  • seeBlogInDatabase(array $criteria) : void
  • seeCommentInDatabase(array $criteria) : void
  • seeCommentMetaInDatabase(array $criteria) : void
  • seeInDatabase(string $table, array [$criteria]) : void
  • seeLinkInDatabase(array $criteria) : void
  • seeNumRecords(int $expectedNumber, string $table, array [$criteria]) : void
  • seeOptionInDatabase(array|string $criteriaOrName, mixed [$value]) : void
  • seePageInDatabase(array $criteria) : void
  • seePostInDatabase(array $criteria) : void
  • seePostMetaInDatabase(array $criteria) : void
  • seePostWithTermInDatabase(int $post_id, int $term_taxonomy_id, ?int [$term_order], ?string [$taxonomy]) : void
  • seeSiteOptionInDatabase(array|string $criteriaOrName, mixed [$value]) : void
  • seeSiteSiteTransientInDatabase(string $key, mixed [$value]) : void
  • seeTableInDatabase(string $table) : void
  • seeTermInDatabase(array $criteria) : void
  • seeTermMetaInDatabase(array $criteria) : void
  • seeTermRelationshipInDatabase(array $criteria) : void
  • seeTermTaxonomyInDatabase(array $criteria) : void
  • seeUserInDatabase(array $criteria) : void
  • seeUserMetaInDatabase(array $criteria) : void
  • updateInDatabase(string $table, array $data, array [$criteria]) : void
  • useBlog(int [$blogId]) : void
  • useMainBlog() : void
  • useTheme(string $stylesheet, ?string [$template], ?string [$themeName]) : void

Read more in Codeception documentation for the Db module.

"},{"location":"modules/WPFilesystem/","title":"WPFilesystem","text":""},{"location":"modules/WPFilesystem/#wpfilesystem-module","title":"WPFilesystem module","text":"

Interact and make assertions on the WordPress file structure.

This module is used together with the WPDb module to manage the state of the WordPress installation in the context of end-to-end tests.

This module extends the Filesystem module from Codeception, you can reference to the Codeception documentation to find out more about the module configuration and usage.

This module should be with Cest and Cept test cases.

"},{"location":"modules/WPFilesystem/#configuration","title":"Configuration","text":"

wpRootFolder - required; the path to the WordPress installation root folder. This can be a relative path to the codeception root directory, or an absolute path to the WordPress installation directory. The WordPress installation directory is the directory that contains the wp-load.php file. themes - the path, relative to the path specified in the wpRootFolder parameter, to the themes directory. By default, it's /wp-content/themes. plugins - the path, relative to the path specified in the wpRootFolder parameter, to the plugins directory. By default, it's /wp-content/plugins. mu-plugins - the path, relative to the path specified in the wpRootFolder parameter, to the must-use plugins. By default, it's /wp-content/mu-plugins. directory. uploads - the path, relative to the path specified in the wpRootFolder parameter, to the uploads directory. By default, it's /wp-content/uploads.

The following is an example of the module configuration to run tests on the /var/wordpress site:

modules:\n  enabled:\n    lucatume\\WPBrowser\\Module\\WPFilesystem:\n      wpRootFolder: /var/wordpress\n      themes: wp-content/themes\n      plugins: wp-content/plugins\n      mu-plugins: wp-content/mu-plugins\n      uploads: wp-content/uploads\n

The following configuration uses dynamic configuration parameters to set the module configuration:

modules:\n  enabled:\n    lucatume\\WPBrowser\\Module\\WPFilesystem:\n      wpRootFolder: '%WP_ROOT_FOLDER%'\n
"},{"location":"modules/WPFilesystem/#methods","title":"Methods","text":"

The module provides the following methods:

  • amInMuPluginPath(string $path) : void
  • amInPath(string $path) : void
  • amInPluginPath(string $path) : void
  • amInThemePath(string $path) : void
  • amInUploadsPath(?string [$path]) : void
  • assertDirectoryExists(string $directory, string [$message]) : void
  • cleanDir(string $dirname) : void
  • cleanMuPluginDir(string $dir) : void
  • cleanPluginDir(string $dir) : void
  • cleanThemeDir(string $dir) : void
  • cleanUploadsDir(?string [$dir], DateTime|string|int|null [$date]) : void
  • copyDir(string $src, string $dst) : void
  • copyDirToMuPlugin(string $src, string $pluginDst) : void
  • copyDirToPlugin(string $src, string $pluginDst) : void
  • copyDirToTheme(string $src, string $themeDst) : void
  • copyDirToUploads(string $src, string $dst, DateTime|string|int|null [$date]) : void
  • deleteDir(string $dirname) : void
  • deleteFile(string $filename) : void
  • deleteMuPluginFile(string $file) : void
  • deletePluginFile(string $file) : void
  • deleteThemeFile(string $file) : void
  • deleteThisFile() : void
  • deleteUploadedDir(string $dir, DateTime|string|int|null [$date]) : void
  • deleteUploadedFile(string $file, string|int|null [$date]) : void
  • dontSeeFileFound(string $filename, string [$path]) : void
  • dontSeeInMuPluginFile(string $file, string $contents) : void
  • dontSeeInPluginFile(string $file, string $contents) : void
  • dontSeeInThemeFile(string $file, string $contents) : void
  • dontSeeInThisFile(string $text) : void
  • dontSeeInUploadedFile(string $file, string $contents, string|int|null [$date]) : void
  • dontSeeMuPluginFileFound(string $file) : void
  • dontSeePluginFileFound(string $file) : void
  • dontSeeThemeFileFound(string $file) : void
  • dontSeeUploadedFileFound(string $file, string|int|null [$date]) : void
  • getBlogUploadsPath(int $blogId, string [$file], DateTimeImmutable|DateTime|string|null [$date]) : string
  • getUploadsPath(string [$file], mixed [$date]) : string
  • getWpRootFolder() : string
  • haveMuPlugin(string $filename, string $code) : void
  • havePlugin(string $path, string $code) : void
  • haveTheme(string $folder, string $indexFileCode, string [$functionsFileCode]) : void
  • makeUploadsDir(string $path) : string
  • openFile(string $filename) : void
  • openUploadedFile(string $filename, DateTime|string|int|null [$date]) : void
  • seeFileContentsEqual(string $text) : void
  • seeFileFound(string $filename, string [$path]) : void
  • seeInMuPluginFile(string $file, string $contents) : void
  • seeInPluginFile(string $file, string $contents) : void
  • seeInThemeFile(string $file, string $contents) : void
  • seeInThisFile(string $text) : void
  • seeInUploadedFile(string $file, string $contents, string|int|null [$date]) : void
  • seeMuPluginFileFound(string $file) : void
  • seeNumberNewLines(int $number) : void
  • seePluginFileFound(string $file) : void
  • seeThemeFileFound(string $file) : void
  • seeThisFileMatches(string $regex) : void
  • seeUploadedFileFound(string $filename, string|int|null [$date]) : void
  • writeToFile(string $filename, string $contents) : void
  • writeToMuPluginFile(string $file, string $data) : void
  • writeToPluginFile(string $file, string $data) : void
  • writeToThemeFile(string $file, string $data) : void
  • writeToUploadedFile(string $filename, string $data, DateTime|string|int|null [$date]) : string

Read more in Codeception documentation.

"},{"location":"modules/WPLoader/","title":"WPLoader","text":""},{"location":"modules/WPLoader/#wploader-module","title":"WPLoader module","text":"

A module to load WordPress and make its code available in tests.

Depending on the value of the loadOnly configuration parameter, the module will behave differently:

  • loadOnly: false - The module will load WordPress like the Core PHPUnit suite does to run integration tests in a controlled environment. Use the module in this mode with test cases generated using the generate:wpunit command.
  • loadOnly: true - The module will load WordPress to make it available in the context of tests. Use the module in this mode in Cest, Cept and Codeception unit test cases.
"},{"location":"modules/WPLoader/#configuration-with-loadonly-false","title":"Configuration with loadOnly: false","text":"

The module will load WordPress like the Core PHPUnit suite does to run integration tests in a controlled environment. Together with the test case generated by the generate:wpunit command the module will:

  • take care of running any test method in a database transaction rolled back after each test
  • manage and clean up the global environment and context between tests

When used in this mode, the module supports the following configuration parameters:

  • loadOnly - false to load WordPress and run tests in a controlled environment.
  • wpRootFolder - required; the path to the WordPress installation root folder. This can be a relative path to the codeception root directory, or an absolute path to the WordPress installation directory. The WordPress installation directory is the directory that contains the wp-load.php file.
  • dbUrl - required; the URL to the database to use to run tests. The URL must be in the form mysql://username:password@host:port/database to use a MySQL database, or in the form sqlite://path/to/database to use a SQLite database. Alternatively, you can use the dbName, dbUser, dbPassword, dbHost configuration parameters to specify the database connection details.
  • dump - the path to a database dump, or a set of database dumps, to load before running tests. The dump will be loaded only once, after the tests run.
  • tablePrefix - the database table prefix to use when loading WordPress, defaults to wp_.
  • multisite - a boolean value to indicate if WordPress should be loaded and initialized in multisite mode.
  • dbCharset - the database charset to use when loading WordPress.
  • dbCollate - the database collate to use when loading WordPress.
  • domain - the domain to use when loading WordPress. Equivalent to defining the WP_TESTS_DOMAIN constant.
  • adminEmail - the administrator email to use when loading WordPress. Equivalent to defining the WP_TESTS_EMAIL constant.
  • title - the site title to use when loading WordPress. Equivalent to defining the WP_TESTS_TITLE constant.
  • phpBinary - the path to the PHP binary to use to run tests. Defaults to the WP_PHP_BINARY constant.
  • language - the language to use when loading WordPress. Equivalent to defining the WPLANG constant.
  • configFile - a configuration file, or a set of configuration files, to load before the tests to further customize and control the WordPress testing environment.
  • pluginsFolder - the path to the plugins folder to use when loading WordPress. Equivalent to defining the WP_PLUGIN_DIR constant.
  • plugins - a list of plugins to activate and load in the WordPress installation. Each plugin must be specified in a format like hello.php or my-plugin/my-plugin.php format.
  • bootstrapActions - a list of actions or callbacks to call after WordPress is loaded and before the tests run.
  • theme - the theme to activate and load in the WordPress installation. The theme must be specified in slug format like twentytwentythree.
  • AUTH_KEY - the AUTH_KEY constant value to use when loading WordPress. If the wpRootFolder path points at a configured installation, containing the wp-config.php file, then the value of the constant in the configuration file will be used, else it will be randomly generated.
  • SECURE_AUTH_KEY - the SECURE_AUTH_KEY constant value to use when loading WordPress. If the wpRootFolder path points at a configured installation, containing the wp-config.php file, then the value of the constant in the configuration file will be used, else it will be randomly generated.
  • LOGGED_IN_KEY - the LOGGED_IN_KEY constant value to use when loading WordPress. If the wpRootFolder path points at a configured installation, containing the wp-config.php file, then the value of the constant in the configuration file will be used, else it will be randomly generated.
  • NONCE_KEY - the NONCE_KEY constant value to use when loading WordPress. If the wpRootFolder path points at a configured installation, containing the wp-config.php file, then the value of the constant in the configuration file will be used, else it will be randomly generated.
  • AUTH_SALT - the AUTH_SALT constant value to use when loading WordPress. If the wpRootFolder path points at a configured installation, containing the wp-config.php file, then the value of the constant in the configuration file will be used, else it will be randomly generated.
  • SECURE_AUTH_SALT - the SECURE_AUTH_SALT constant value to use when loading WordPress. If the wpRootFolder path points at a configured installation, containing the wp-config.php file, then the value of the constant in the configuration file will be used, else it will be randomly generated.
  • LOGGED_IN_SALT - the LOGGED_IN_SALT constant value to use when loading WordPress. If the wpRootFolder path points at a configured installation, containing the wp-config.php file, then the value of the constant in the configuration file will be used, else it will be randomly generated.
  • NONCE_SALT - the NONCE_SALT constant value to use when loading WordPress. If the wpRootFolder path points at a configured installation, containing the wp-config.php file, then the value of the constant in the configuration file will be used, else it will be randomly generated.
  • AUTOMATIC_UPDATER_DISABLED - the AUTOMATIC_UPDATER_DISABLED constant value to use when loading WordPress. If the wpRootFolder path points at a configured installation, containing the wp-config.php file, then the value of the constant in the configuration file will be used, else it will be randomly generated.
  • WP_HTTP_BLOCK_EXTERNAL - the WP_HTTP_BLOCK_EXTERNAL constant value to use when loading WordPress. If the wpRootFolder path points at a configured installation, containing the wp-config.php file, then the value of the constant in the configuration file will be used, else it will be randomly generated.

This is an example of an integration suite configured to use the module:

actor: IntegrationTester\nbootstrap: _bootstrap.php\nmodules:\n  enabled:\n    - \\Helper\\Integration\n    - lucatume\\WPBrowser\\Module\\WPLoader:\n        wpRootFolder: /var/wordpress\n        dbUrl: mysql://root:root@mysql:3306/wordpress\n        tablePrefix: test_\n        domain: wordpress.test\n        adminEmail: admin@wordpress.test\n        title: 'Integration Tests'\n        plugins:\n          - hello.php\n          - woocommerce/woocommerce.php\n          - my-plugin/my-plugin.php\n        theme: twentytwentythree\n

The following configuration uses dynamic configuration parameters to set the module configuration:

actor: IntegrationTester\nbootstrap: _bootstrap.php\nmodules:\n  enabled:\n    - \\Helper\\Integration\n    - lucatume\\WPBrowser\\Module\\WPLoader:\n        wpRootFolder: '%WP_ROOT_FOLDER%'\n        dbUrl: '%WP_DB_URL%'\n        tablePrefix: '%WP_TABLE_PREFIX%'\n        domain: '%WP_DOMAIN%'\n        adminEmail: '%WP_ADMIN_EMAIL%'\n        title: '%WP_TITLE%'\n        plugins:\n          - hello.php\n          - woocommerce/woocommerce.php\n          - my-plugin/my-plugin.php\n        theme: twentytwentythree\n

The following example configuration uses a SQLite database and loads a database fixture before the tests run:

actor: IntegrationTester\nbootstrap: _bootstrap.php\nmodules:\n  enabled:\n    - \\Helper\\Integration\n    - lucatume\\WPBrowser\\Module\\WPLoader:\n        wpRootFolder: /var/wordpress\n        dbUrl: sqlite:///var/wordpress/wp-tests.sqlite\n        dump:\n          - tests/_data/products.sql\n          - tests/_data/users.sql\n          - tests/_data/orders.sql\n        tablePrefix: test_\n        domain: wordpress.test\n        adminEmail: admin@wordpress.test\n        title: 'Integration Tests'\n        plugins:\n          - hello.php\n          - woocommerce/woocommerce.php\n          - my-plugin/my-plugin.php\n        theme: twentytwentythree\n
"},{"location":"modules/WPLoader/#handling-a-custom-site-structure","title":"Handling a custom site structure","text":"

If you're working on a site project using a custom file structure, e.g. [Bedrock][4], you should use a custom configuration and, together with that, configure the WPLoader module to load WordPress, plugins and themes code from the correct locations. Take care to point the wpRootFolder parameter to the directory containing the wp-load.php file, the /var/my-site/web/wp one in the following example, and the module will read the project configuration file to load the WordPress code from the correct location.

Here's an example of how the module should be configured to run integration tests on a Bedrock installation:

actor: IntegrationTester\nbootstrap: _bootstrap.php\nmodules:\n  enabled:\n    - \\Helper\\Integration\n    - lucatume\\WPBrowser\\Module\\WPLoader:\n        wpRootFolder: /var/my-site/web/wp\n        dbUrl: mysql://root:root@mysql:3306/wordpress\n        tablePrefix: test_\n        domain: my-project.test\n        adminEmail: admin@my-project.test\n        title: 'Integration Tests'\n        plugins:\n          - hello.php\n          - woocommerce/woocommerce.php\n          - my-plugin/my-plugin.php\n        theme: twentytwentythree\n

In general, pointing the wpRootFolder parameter to the directory containing the wp-load.php file should take care of loading WordPress code from the correct location. Should that not be the case, use the configFile parameter to point the module to the project test configuration file: a PHP file defining the constants and environment variables to use to load WordPress, plugins and themes correctly.

"},{"location":"modules/WPLoader/#configuration-with-loadonly-true","title":"Configuration with loadOnly: true","text":"

The module will load WordPress from the location specified by the wpRootFodler parameter, relying on the WPDb module to manage the database state.

When used in this mode, the module supports the following configuration parameters:

  • loadOnly - true to load WordPress and make it available in the context of tests.
  • wpRootFolder - required; the path to the WordPress installation root folder. This can be a relative path to the codeception root directory, or an absolute path to the WordPress installation directory. The WordPress installation directory is the directory that contains the wp-load.php file.
  • dbUrl - required; the URL to the database to use to run tests. The URL must be in the form mysql://username:password@host:port/database to use a MySQL database, or in the form sqlite://path/to/database to use a SQLite database. Alternatively, you can use the dbName, dbUser, dbPassword, dbHost configuration parameters to specify the database connection details.
  • domain - the domain to use when loading WordPress. Equivalent to defining the WP_TESTS_DOMAIN constant.

The following is an example of the module configuration to run end-to-end tests on the site served at http://localhost:8080 URL and served from the /var/wordpress directory:

actor: EndToEndTester\nbootstrap: _bootstrap.php\nmodules:\n  enabled:\n    - \\Helper\\Integration\n    - lucatume\\WPBrowser\\Module\\WPDb:\n        dbUrl: 'mysql://root:password@localhost:3306/wordpress'\n        url: 'http://localhost:8080'\n        tablePrefix: 'wp_'\n        dump: 'tests/_data/dump.sql'\n        populate: true\n        cleanup: true\n        reconnect: false\n        urlReplacement: true\n        originalUrl: http://wordpress.test\n        waitlock: 10\n        createIfNotExists: true\n    - lucatume\\WPBrowser\\Module\\WPLoader:\n        loadOnly: true\n        wpRootFolder: /var/wordpress\n        dbUrl: sqlite:///var/wordpress/wp-tests.sqlite\n        domain: wordpress.test\n
"},{"location":"modules/WPLoader/#methods","title":"Methods","text":"

The module provides the following methods:

  • factory() : lucatume\\WPBrowser\\Module\\WPLoader\\FactoryStore
  • getContentFolder(string [$path]) : string
  • getInstallation() : lucatume\\WPBrowser\\WordPress\\Installation
  • getPluginsFolder(string [$path]) : string
  • getThemesFolder(string [$path]) : string
  • getWpRootFolder(?string [$path]) : string

[4]:

"},{"location":"modules/WPQueries/","title":"WPQueries","text":""},{"location":"modules/WPQueries/#wpqueries-module","title":"WPQueries module","text":"

This module provides assertions for WordPress queries.

This module can be used in any test context where the global $wpdb variable is defined, this usually means in any suite where [the WPLoader module] is used.

"},{"location":"modules/WPQueries/#configuration","title":"Configuration","text":"

The method does not require configuration.

"},{"location":"modules/WPQueries/#methods","title":"Methods","text":"

The module provides the following methods:

  • assertCountQueries(int $n, string [$message]) : void
  • assertNotQueries(string [$message]) : void
  • assertNotQueriesByAction(string $action, string [$message]) : void
  • assertNotQueriesByFilter(string $filter, string [$message]) : void
  • assertNotQueriesByFunction(string $function, string [$message]) : void
  • assertNotQueriesByMethod(string $class, string $method, string [$message]) : void
  • assertNotQueriesByStatement(string $statement, string [$message]) : void
  • assertNotQueriesByStatementAndAction(string $statement, string $action, string [$message]) : void
  • assertNotQueriesByStatementAndFilter(string $statement, string $filter, string [$message]) : void
  • assertNotQueriesByStatementAndFunction(string $statement, string $function, string [$message]) : void
  • assertNotQueriesByStatementAndMethod(string $statement, string $class, string $method, string [$message]) : void
  • assertQueries(string [$message]) : void
  • assertQueriesByAction(string $action, string [$message]) : void
  • assertQueriesByFilter(string $filter, string [$message]) : void
  • assertQueriesByFunction(string $function, string [$message]) : void
  • assertQueriesByMethod(string $class, string $method, string [$message]) : void
  • assertQueriesByStatement(string $statement, string [$message]) : void
  • assertQueriesByStatementAndAction(string $statement, string $action, string [$message]) : void
  • assertQueriesByStatementAndFilter(string $statement, string $filter, string [$message]) : void
  • assertQueriesByStatementAndFunction(string $statement, string $function, string [$message]) : void
  • assertQueriesByStatementAndMethod(string $statement, string $class, string $method, string [$message]) : void
  • assertQueriesCountByAction(int $n, string $action, string [$message]) : void
  • assertQueriesCountByFilter(int $n, string $filter, string [$message]) : void
  • assertQueriesCountByFunction(int $n, string $function, string [$message]) : void
  • assertQueriesCountByMethod(int $n, string $class, string $method, string [$message]) : void
  • assertQueriesCountByStatement(int $n, string $statement, string [$message]) : void
  • assertQueriesCountByStatementAndAction(int $n, string $statement, string $action, string [$message]) : void
  • assertQueriesCountByStatementAndFilter(int $n, string $statement, string $filter, string [$message]) : void
  • assertQueriesCountByStatementAndFunction(int $n, string $statement, string $function, string [$message]) : void
  • assertQueriesCountByStatementAndMethod(int $n, string $statement, string $class, string $method, string [$message]) : void
  • countQueries(?wpdb [$wpdb]) : int
  • getQueries(?wpdb [$wpdb]) : array
"},{"location":"modules/WPWebDriver/","title":"WPWebDriver","text":""},{"location":"modules/WPWebDriver/#wpwebdriver-module","title":"WPWebDriver module","text":"

This module drives a browser using a solution like Selenium or Chromedriver to simulate user interactions with the WordPress project.

The module has full Javascript support, differently from the WPBrowser module, and can be used to test sites that use Javascript to render the page or to make assertions that require Javascript support.

The method extends the Codeception WebDriver module and is used in the context of Cest and Cept test cases.

"},{"location":"modules/WPWebDriver/#configuration","title":"Configuration","text":"
  • browser - the browser to use; e.g. 'chrome'
  • url - required; the start URL of your WordPress project.
  • adminUsername - required; the site administrator username to use in actions like loginAsAdmin.
  • adminPassword - required; the site administrator password to use in actions like loginAsAdmin.
  • adminPath - the path to the WordPress admin directory; defaults to /wp-admin.

More configuration options, and their explanation, are available in the Codeception WebDriver module documentation.

The following is an example of the module configuration to run tests on thehttp://localhost:8080 site:

modules:\n  enabled:\n    lucatume\\WPBrowser\\Module\\WPBrowser:\n      url: 'http://localhost:8080'\n      adminUsername: 'admin'\n      adminPassword: 'password'\n      adminPath: '/wp-admin'\n      browser: chrome\n      host: 'localhost'\n      port: '4444'\n      window_size: false\n      capabilities:\n        chromeOptions:\n          args: [ \"--headless\", \"--disable-gpu\", \"--proxy-server='direct://'\", \"--proxy-bypass-list=*\", \"--no-sandbox\", \"--disable-dev-shm-usage\" ]\n

The following configuration uses dynamic configuration parameters to set the module configuration:

modules:\n  enabled:\n    lucatume\\WPBrowser\\Module\\WPBrowser:\n      url: 'http://localhost:8080'\n      adminUsername: 'admin'\n      adminPassword: 'password'\n      adminPath: '/wp-admin'\n      browser: chrome\n      host: '%CHROME_HOST%'\n      port: '%CHROME_PORT%'\n      window_size: `1920,1080`\n      capabilities:\n        chromeOptions:\n          args: [ \"--disable-gpu\", \"--proxy-server='direct://'\", \"--proxy-bypass-list=*\", \"--no-sandbox\", \"--disable-dev-shm-usage\" ]\n

Furthermore, the above configuration will not run Chrome in headless mode: the browser window will be visible.

"},{"location":"modules/WPWebDriver/#methods","title":"Methods","text":"

The module provides the following methods:

  • acceptPopup() : void
  • activatePlugin(array|string $pluginSlug) : void
  • amEditingPostWithId(int $id) : void
  • amOnAdminAjaxPage(array|string|null [$queryVars]) : void
  • amOnAdminPage(string $page) : void
  • amOnCronPage(array|string|null [$queryVars]) : void
  • amOnPage($page) : void
  • amOnPagesPage() : void
  • amOnPluginsPage() : void
  • amOnSubdomain(string $subdomain) : void
  • amOnUrl($url) : void
  • appendField($field, string $value) : void
  • attachFile($field, string $filename) : void
  • cancelPopup() : void
  • checkOption($option) : void
  • clearField($field) : void
  • click($link, [$context]) : void
  • clickWithLeftButton([$cssOrXPath], ?int [$offsetX], ?int [$offsetY]) : void
  • clickWithRightButton([$cssOrXPath], ?int [$offsetX], ?int [$offsetY]) : void
  • closeTab() : void
  • deactivatePlugin(array|string $pluginSlug) : void
  • debugWebDriverLogs(?Codeception\\TestInterface [$test]) : void
  • deleteSessionSnapshot($name) : void
  • dontSee($text, [$selector]) : void
  • dontSeeCheckboxIsChecked($checkbox) : void
  • dontSeeCookie($cookie, array [$params], bool [$showDebug]) : void
  • dontSeeCurrentUrlEquals(string $uri) : void
  • dontSeeCurrentUrlMatches(string $uri) : void
  • dontSeeElement($selector, array [$attributes]) : void
  • dontSeeElementInDOM($selector, array [$attributes]) : void
  • dontSeeInCurrentUrl(string $uri) : void
  • dontSeeInField($field, $value) : void
  • dontSeeInFormFields($formSelector, array $params) : void
  • dontSeeInPageSource(string $text) : void
  • dontSeeInPopup(string $text) : void
  • dontSeeInSource($raw) : void
  • dontSeeInTitle($title) : void
  • dontSeeLink(string $text, string [$url]) : void
  • dontSeeOptionIsSelected($selector, $optionText) : void
  • dontSeePluginInstalled(string $pluginSlug) : void
  • doubleClick($cssOrXPath) : void
  • dragAndDrop($source, $target) : void
  • executeAsyncJS(string $script, array [$arguments]) : void
  • executeInSelenium(Closure $function) : void
  • executeJS(string $script, array [$arguments]) : void
  • fillField($field, $value) : void
  • grabAttributeFrom($cssOrXpath, $attribute) : ?string
  • grabCookie($cookie, array [$params]) : mixed
  • grabCookiesWithPattern(string $cookiePattern) : ?array
  • grabFromCurrentUrl([$uri]) : mixed
  • grabFullUrl() : string
  • grabMultiple($cssOrXpath, [$attribute]) : array
  • grabPageSource() : string
  • grabTextFrom($cssOrXPathOrRegex) : mixed
  • grabValueFrom($field) : ?string
  • grabWordPressTestCookie(?string [$name]) : ?Symfony\\Component\\BrowserKit\\Cookie
  • loadSessionSnapshot($name, bool [$showDebug]) : bool
  • logOut(string|bool [$redirectTo]) : void
  • loginAs(string $username, string $password, int [$timeout], int [$maxAttempts]) : void
  • loginAsAdmin(int [$timeout], int [$maxAttempts]) : void
  • makeElementScreenshot($selector, ?string [$name]) : void
  • makeHtmlSnapshot(?string [$name]) : void
  • makeScreenshot(?string [$name]) : void
  • maximizeWindow() : void
  • moveBack() : void
  • moveForward() : void
  • moveMouseOver([$cssOrXPath], ?int [$offsetX], ?int [$offsetY]) : void
  • openNewTab() : void
  • performOn($element, $actions, int [$timeout]) : void
  • pressKey($element, ...[$chars]) : void
  • reloadPage() : void
  • resetCookie($cookie, array [$params], bool [$showDebug]) : void
  • resizeWindow(int $width, int $height) : void
  • saveSessionSnapshot($name) : void
  • scrollTo($selector, ?int [$offsetX], ?int [$offsetY]) : void
  • see($text, [$selector]) : void
  • seeCheckboxIsChecked($checkbox) : void
  • seeCookie($cookie, array [$params], bool [$showDebug]) : void
  • seeCurrentUrlEquals(string $uri) : void
  • seeCurrentUrlMatches(string $uri) : void
  • seeElement($selector, array [$attributes]) : void
  • seeElementInDOM($selector, array [$attributes]) : void
  • seeErrorMessage(array|string [$classes]) : void
  • seeInCurrentUrl(string $uri) : void
  • seeInField($field, $value) : void
  • seeInFormFields($formSelector, array $params) : void
  • seeInPageSource(string $text) : void
  • seeInPopup(string $text) : void
  • seeInSource($raw) : void
  • seeInTitle($title) : void
  • seeLink(string $text, ?string [$url]) : void
  • seeMessage(array|string [$classes]) : void
  • seeNumberOfElements($selector, $expected) : void
  • seeNumberOfElementsInDOM($selector, $expected) : void
  • seeNumberOfTabs(int $number) : void
  • seeOptionIsSelected($selector, $optionText) : void
  • seePluginActivated(string $pluginSlug) : void
  • seePluginDeactivated(string $pluginSlug) : void
  • seePluginInstalled(string $pluginSlug) : void
  • seeWpDiePage() : void
  • selectOption($select, $option) : void
  • setCookie($name, $value, array [$params], [$showDebug]) : void
  • submitForm($selector, array $params, [$button]) : void
  • switchToFrame(?string [$locator]) : void
  • switchToIFrame(?string [$locator]) : void
  • switchToNextTab(int [$offset]) : void
  • switchToPreviousTab(int [$offset]) : void
  • switchToWindow(?string [$name]) : void
  • type(string $text, int [$delay]) : void
  • typeInPopup(string $keys) : void
  • uncheckOption($option) : void
  • unselectOption($select, $option) : void
  • wait($timeout) : void
  • waitForElement($element, int [$timeout]) : void
  • waitForElementChange($element, Closure $callback, int [$timeout]) : void
  • waitForElementClickable($element, int [$timeout]) : void
  • waitForElementNotVisible($element, int [$timeout]) : void
  • waitForElementVisible($element, int [$timeout]) : void
  • waitForJS(string $script, int [$timeout]) : void
  • waitForJqueryAjax(int [$time]) : void
  • waitForText(string $text, int [$timeout], [$selector]) : void

Read more in Codeception documentation.

"},{"location":"v3/","title":"Index","text":"

This is the documentation for version 3 of the project. The current version is version 4 and the documentation can be found here.

The wp-browser project provides a Codeception based solution to test WordPress plugins, themes and whole sites at all levels of testing.

The purpose of this documentation is to help you set up, run and iterate over your project and test code using the powerful APIs provided by Codeception while trying to alleviate the pains of setting it up for WordPress projects.

Throughout the documentation you will find references to test terminology: I've tried to condense those into small, digestable chunks to provide a rough idea without and a limited context; where required I tried to provide links to dive deeper into the subjects.

Happy testing!

"},{"location":"v3/#table-of-contents","title":"Table of contents","text":"
  • Welcome
    • Frequently asked questions
    • Codeception, PHPUnit and wp-browser
  • Using wp-browser with Codeception 4.0
  • Migration guides
    • Version 2 to version 3
  • Levels of testing
  • Getting started
    • Requirements
    • Installation
    • Setting up a minimum WordPress installation
    • Configuration
  • Tutorials
    • Automatically change database during acceptance and functional tests
    • Setting up wp-browser on VVV to test a plugin
    • Setting up wp-browser on MAMP for Mac to test a plugin
    • Setting up wp-browser on WAMP for Windows to test a plugin
    • Setting up wp-browser on Local by Flywheel to test a plugin
  • Modules
    • WPBrowser
    • WPCLI
    • WPDb
    • WPFilesystem
    • WPLoader
    • WPQueries
    • WPWebDriver
  • Advanced Usage
    • Running tests in separate processes
  • Events API
  • Extensions
  • Commands
  • Contributing
  • Sponsors
  • Changelog
"},{"location":"v3/codeception-4-support/","title":"Codeception 4 support","text":""},{"location":"v3/codeception-4-support/#using-wp-browser-with-codeception-40","title":"Using wp-browser with Codeception 4.0","text":"

Codeception version 4.0 introduced a number of new features to the framework and it's the version of wp-browser that will be maintained from now on.

I've made an effort to keep wp-browser compatible with PHP 5.6 and Codeception versions from 2.5 up.

One the biggest changes of Codeception version 4.0 is that modules have been broken out into separate packages. To use wp-browser with Codeception 4.0 all you need to do is to add this to your project composer.json file:

{\n  \"require-dev\": {\n    \"lucatume/wp-browser\": \"^2.4\",\n    \"codeception/module-asserts\": \"^1.0\",\n    \"codeception/module-phpbrowser\": \"^1.0\",\n    \"codeception/module-webdriver\": \"^1.0\",\n    \"codeception/module-db\": \"^1.0\",\n    \"codeception/module-filesystem\": \"^1.0\",\n    \"codeception/module-cli\": \"^1.0\",\n    \"codeception/util-universalframework\": \"^1.0\"\n  }\n}\n

You might not need all the modules listed here, depending on the wp-browser modules you use in your test suites. This is a scheme of what Codeception modules you will need for which wp-browser module to help you choose only the required modules:

  • \"codeception/module-asserts\" - Required for Codeception 4.0 compatibility.
  • \"codeception/module-phpbrowser\" - Required by the WPBrowser module.
  • \"codeception/module-webdriver\" - Required by the WPWebDriver module.
  • \"codeception/module-db\" - Required by the WPDb module.
  • \"codeception/module-filesystem\" - Required by the WPFilesystem module.
  • \"codeception/module-cli\" - Required by the WPCLI module.
  • \"codeception/util-universalframework\" - Required by the WordPress framework module.
"},{"location":"v3/codeception-phpunit-and-wpbrowser/","title":"Codeception phpunit and wpbrowser","text":""},{"location":"v3/codeception-phpunit-and-wpbrowser/#the-wp-browser-stack","title":"The wp-browser stack","text":"

The wp-browser project is built leveraging the power of a number of open-source projects.

While I'm not listing all of them here it's worth mentioning those that will come up, again and again, in the documentation.

"},{"location":"v3/codeception-phpunit-and-wpbrowser/#wordpress","title":"WordPress","text":"

WordPress is open source software you can use to create a beautiful website, blog, or app.

The line is taken directly from WordPress.org site.

In the context of this documentation WordPress is the PHP and JavaScript framework websites and web applications can be built on, the one anyone can download from here.

"},{"location":"v3/codeception-phpunit-and-wpbrowser/#codeception","title":"Codeception","text":"

Codeception (home) is a modern, powerful PHP testing framework written in PHP.

It comes with a number of modules and extensions that are comparable to WordPress plugins and themes.

Modules and extensions are combined in suites to be able to run a specific type of test. Each suite will handle a specific type of test for a specific set of code.

wp-browser is none other than a collection of modules and extensions for Codeception made specifically to test WordPress applications.

"},{"location":"v3/codeception-phpunit-and-wpbrowser/#phpunit","title":"PHPUnit","text":"

PHPUnit is the most widely known PHP testing framework. As the name implies it was born to make unit testing of PHP code easier but its scope and power has grown well below that.

Codeception is based, and uses, PhpUnit to wrap some of its functionalities into an easy-to-use API. The two are so compatible one with the other that Codeception can run PHPUnit tests with little to no changes.

This documentation will not cover this subject and will only deal with Codeception-native test methods but you can find more information here.

"},{"location":"v3/commands/","title":"Custom commands provided by wp-browser","text":"

The project comes with its own set of custom Codeception commands.

The commands provide functionalities to quickly scaffold different types of tests. Any other codecept command remains intact and available.

"},{"location":"v3/commands/#adding-the-commands-to-an-existing-project","title":"Adding the commands to an existing project","text":"

The commands are added to the main Codeception configuration file, codeception.yml, when scaffolding a project via the codecept init wp-browser command.

They can be added to any existing project adding, or editing, the commands section of the configuration file:

extensions:\n    commands:\n        - \"Codeception\\\\Command\\\\GenerateWPUnit\"\n        - \"Codeception\\\\Command\\\\GenerateWPRestApi\"\n        - \"Codeception\\\\Command\\\\GenerateWPRestController\"\n        - \"Codeception\\\\Command\\\\GenerateWPRestPostTypeController\"\n        - \"Codeception\\\\Command\\\\GenerateWPAjax\"\n        - \"Codeception\\\\Command\\\\GenerateWPCanonical\"\n        - \"Codeception\\\\Command\\\\GenerateWPXMLRPC\"\n
"},{"location":"v3/commands/#generation-commands","title":"Generation commands","text":"

The library provides commands to quickly scaffold integration test cases for specific types of WordPress components, see levels of testing for more information.

The tests are almost identical to the ones you could write in a PHPUnit based Core suite with the exception of extending the Codeception\\TestCase\\WPTestCase test case.

"},{"location":"v3/commands/#generatewpunit","title":"generate:wpunit","text":"

Generates a test case extending the \\Codeception\\TestCase\\WPTestCase class using the

  codecept generate:wpunit suite SomeClass\n

The command will generate a skeleton test case like

<?php\n\nclass SomeClassTest extends \\Codeception\\TestCase\\WPTestCase\n{\n    public function setUp()\n    {\n      parent::setUp();\n    }\n\n    public function tearDown()\n    {\n      parent::tearDown();\n    }\n\n    // tests\n    public function testMe()\n    {\n    }\n\n}\n
"},{"location":"v3/commands/#generatewprest","title":"generate:wprest","text":"

Generates a test case extending the \\Codeception\\TestCase\\WPRestApiTestCase class using the

  codecept generate:wprest suite SomeClass\n

The command will generate a skeleton test case like

<?php\n\nclass SomeClassTest extends \\Codeception\\TestCase\\WPRestApiTestCase\n{\n    public function setUp()\n    {\n      parent::setUp();\n    }\n\n    public function tearDown()\n    {\n      parent::tearDown();\n    }\n\n    // tests\n    public function testMe()\n    {\n    }\n\n}\n
"},{"location":"v3/commands/#generatewprestcontroller","title":"generate:wprestcontroller","text":"

Generates a test case extending the \\Codeception\\TestCase\\WPRestControllerTestCase class using the

  codecept generate:wprest suite SomeClass\n

The command will generate a skeleton test case like

<?php\n\nclass SomeClassTest extends \\Codeception\\TestCase\\WPRestControllerTestCase\n{\n    public function setUp()\n    {\n      parent::setUp();\n    }\n\n    public function tearDown()\n    {\n      parent::tearDown();\n    }\n\n    // tests\n    public function testMe()\n    {\n    }\n\n}\n
"},{"location":"v3/commands/#generatewprestposttypecontroller","title":"generate:wprestposttypecontroller","text":"

Generates a test case extending the \\Codeception\\TestCase\\WPRestPostTypeControllerTestCase class using the

  codecept generate:wprest suite SomeClass\n

The command will generate a skeleton test case like

<?php\n\nclass SomeClassTest extends \\Codeception\\TestCase\\WPRestPostTypeControllerTestCase\n{\n    public function setUp()\n    {\n      parent::setUp();\n    }\n\n    public function tearDown()\n    {\n      parent::tearDown();\n    }\n\n    // tests\n    public function testMe()\n    {\n    }\n\n}\n
"},{"location":"v3/commands/#generatewpajax","title":"generate:wpajax","text":"

Generates a test case extending the \\Codeception\\TestCase\\WPAjaxTestCase class using the

  codecept generate:wpajax suite SomeClass\n

The command will generate a skeleton test case like

<?php\n\nclass SomeClassTest extends \\Codeception\\TestCase\\WPAjaxTestCase\n{\n    public function setUp()\n    {\n      parent::setUp();\n    }\n\n    public function tearDown()\n    {\n      parent::tearDown();\n    }\n\n    // tests\n    public function testMe()\n    {\n    }\n\n}\n
"},{"location":"v3/commands/#generatewpxmlrpc","title":"generate:wpxmlrpc","text":"

Generates a test case extending the \\Codeception\\TestCase\\WPXMLRPCTestCase class using the

  codecept generate:wpxmlrpc suite SomeClass\n

The command will generate a skeleton test case like

<?php\n\nclass SomeClassTest extends \\Codeception\\TestCase\\WPXMLRPCTestCase\n{\n    public function setUp()\n    {\n      parent::setUp();\n    }\n\n    public function tearDown()\n    {\n      parent::tearDown();\n    }\n\n    // tests\n    public function testMe()\n    {\n    }\n\n}\n
"},{"location":"v3/commands/#generatewpcanonical","title":"generate:wpcanonical","text":"

Generates a test case extending the \\Codeception\\TestCase\\WPCanonicalTestCase class using the

  codecept generate:wpcanonical suite SomeClass\n

The command will generate a skeleton test case like

<?php\n\nclass SomeClassTest extends \\Codeception\\TestCase\\WPCanonicalTestCase\n{\n    public function setUp()\n    {\n      parent::setUp();\n    }\n\n    public function tearDown()\n    {\n      parent::tearDown();\n    }\n\n    // tests\n    public function testMe()\n    {\n    }\n\n}\n
"},{"location":"v3/configuration/","title":"Configuration","text":""},{"location":"v3/configuration/#initializing-wp-browser","title":"Initializing wp-browser","text":"

While wp-browser can be configured manually creating each file the fastest way to bootstrap its configuration is by using its initialization template.

Throughout the steps below I will use the WordPress setup I've prepared before From the root folder of the project, /Users/luca/Sites/wordpress/wp-content/plugins/acme-plugin in the example, run the command:

vendor/bin/codecept init wpbrowser\n

Composer installed Codeception binary (codecept) in the vendor folder of my project.

With the command above I'm telling Codeception to initialize a wp-browser project in the current folder. When I click enter I'm presented with a list of questions, each answer will be used to configure the wp-browser project for me; one by one.

In the screenshot the answers I've provided to each question, with reference to the setup above:

wp-browser will try to provide a brief explanation of what each question is but below is the long version.

"},{"location":"v3/configuration/#long-question-explanation","title":"Long question explanation","text":"

I've tried to condense as much clarity as possible in the questions the codecept init wpbrowser command will ask but, for sake of brevity and space, there's no way I could provide inline a deeper explanation of each.

Below is a longer explanation of each question:

  • How would you like the acceptance suite to be called?
  • How would you like the functional suite to be called?
  • How would you like the WordPress unit and integration suite to be called?
  • How would you like to call the env configuration file?
  • Where is WordPress installed?
  • What is the path, relative to WordPress root URL, of the admin area of the test site?
  • What is the name of the test database used by the test site?
  • What is the host of the test database used by the test site?
  • What is the user of the test database WPLoader should use?
  • What is the password of the test database WPLoader should use?
  • What is the table prefix of the test database WPLoader should use?
  • What is the URL the test site?
  • What is the email of the test site WordPress administrator?
  • What is the title of the test site?
  • What is the login of the administrator user of the test site?
  • What is the password of the administrator user of the test site?
  • Are you testing a plugin, a theme or a combination of both?
  • What is the folder/plugin.php name of the plugin?
  • Are you developing a child theme?
  • Are you using a child theme?
  • What is the slug of the parent theme?
  • What is the slug of the theme?
  • What is the slug of the theme you are using?
  • Does your project needs additional plugins to be activated to work?
"},{"location":"v3/configuration/#how-would-you-like-the-acceptance-suite-to-be-called","title":"How would you like the acceptance suite to be called?","text":"

With reference to the testing levels definition this question provides you with the possibility to change the name of the acceptance-like test suite.

Common, alternative, names are ui, rest and user.

"},{"location":"v3/configuration/#how-would-you-like-the-functional-suite-to-be-called","title":"How would you like the functional suite to be called?","text":"

With reference to the testing levels definition this question provides you with the possibility to change the name of the functional-like test suite.

A common alternative name is service.

"},{"location":"v3/configuration/#how-would-you-like-the-wordpress-unit-and-integration-suite-to-be-called","title":"How would you like the WordPress unit and integration suite to be called?","text":"

With reference to the testing levels definition this question provides you with the possibility to change the name of the suite dedicated to integration and \"WordPress unit\" tests.

A common alternative name is integration.

"},{"location":"v3/configuration/#how-would-you-like-to-call-the-env-configuration-file","title":"How would you like to call the env configuration file?","text":"

Instead of configuring each module in each suite with the same parameters over and over Codeception supports dynamic configuration via environment files.

wp-browser will scaffold such a configuration for you and will use, by default, a file called .env to store the configuration parameters.

The file name might not suit all setups especially and this question allows changing that file name; common, alternative, file names are .env.tests, .env.codeception and similar.

"},{"location":"v3/configuration/#where-is-wordpress-installed","title":"Where is WordPress installed?","text":"

During tests the test code will need to access WordPress code, precisely wp-browser requires being pointed to the folder that contains the wp-load.php file.

The answer can be an absolute path, like /Users/luca/Sites/wordrpress, or a path relative to the folder where Codeception is installed like vendor/wordpress.

This path should be accessible by the machine that is running the tests; if you're running the tests from your machine (e.g. your laptop) that's just the path to the folder where WordPress is installed, /Users/luca/Sites/wordpress in the example configuration above.

If you are, instead, running the tests from within a virtualized machine (e.g. Vagrant or Docker) then the path should be the one used by the virtualized machine.

To make an example:

  • on my machine WordPress is installed at /Users/luca/Sites/wordpress
  • I've created a Docker container using the official WordPress image and bound the above folder into the container
  • internally the container will put WordPress in the /var/www/html folder

If I run the tests from my host machine then WordPress root directory will be /Users/luca/Sites/wordpress, if I run the tests from within the Docker container then WordPress root folder will be /var/www/html.

Another example is Local by Flywheel:

  • in the host machine the path to the WordPress root folder will be /Users/luca/Local\\ Sites/wordpress/app/public
  • from within the Docker container managed by Local the path will be /app/public

If you need a solution that will work in both instances use a relative path: wp-browser will accept paths like ./../../../wordpress and will attempt to resolve them.

"},{"location":"v3/configuration/#what-is-the-path-relative-to-wordpress-root-url-of-the-admin-area-of-the-test-site","title":"What is the path, relative to WordPress root URL, of the admin area of the test site?","text":"

This is usually /wp-admin but you might have the web-server, or a plugin, redirect or hide requests for the administration area to another path.

Some examples are /admin, /login and the like.

Mind that this is not the path to the login page but the path to the administrationo area; this will be used by wp-browser to find to the administration area in acceptance and functional tests.

"},{"location":"v3/configuration/#what-is-the-name-of-the-test-database-used-by-the-test-site","title":"What is the name of the test database used by the test site?","text":"

In my example setup it's wordpress.

This is the name of the database that is storing the information used by the site I can reach at http://localhost:8080.

I want to underline the word \"test\". Any site and any database you use and expose to wp-browser should be intended for tests; this means that it does not contain any data you care about as it will be lost.

"},{"location":"v3/configuration/#what-is-the-host-of-the-test-database-used-by-the-test-site","title":"What is the host of the test database used by the test site?","text":"

In my example setup it's 127.0.0.1:3306.

Here the same principle valid for Where is WordPress installed? applies: the database host is relative to the machine that is running the tests.

In my example I'm hosting the database locally, on my laptop, and my machine can reach it at the localhost address (127.0.0.1) on MySQL default port (3306).

If I am using the database of a Local by Flywheel site from my host machine then it might be something like 192.168.92.100:4050 (from the site \"Database\" tab); the same principle applies if I am using a Vagrant-based or Docker-based solution.

If I am running the tests from within a virtualized machine (a Docker container, a Vagrant box et cetera) then it would probably be localhost or 1270.0.0.1.

This detail will be used in the context of acceptance and functional tests by the WPDb module.

"},{"location":"v3/configuration/#what-is-the-user-of-the-test-database-used-by-the-test-site","title":"What is the user of the test database used by the test site?","text":"

In my example setup it's root as I'm using MySQL server root user to access the database during tests.

Depending on your setup it might be different; since wp-browser will need to not only read but write too to the database make sure to use a user that has full access to the database specified in the answer to the What is the host of the test database used by the test site? question.

This detail will be used in the context of acceptance and functional tests by the WPDb module.

"},{"location":"v3/configuration/#what-is-the-password-of-the-test-database-used-by-the-test-site","title":"What is the password of the test database used by the test site?","text":"

In my example setup it's empty as I've not set any password for the root account.

In your case it might be different and it should be the password associated with the user specified in the answer to the What is the user of the test database used by the test site? question.

This detail will be used in the context of acceptance and functional tests by the WPDb module.

"},{"location":"v3/configuration/#what-is-the-table-prefix-of-the-test-database-used-by-the-test-site","title":"What is the table prefix of the test database used by the test site?","text":"

In my example setup it's wp_; that value is taken from the WordPress installation configuration file.

To have any influence on the site wp-browser will need to modify the same database tables WordPress is using; as I did you can take this value from the wp-config.php file directly: it's the value of the $table_prefix variable.

This detail will be used in the context of acceptance and functional tests by the WPDb module.

"},{"location":"v3/configuration/#what-is-the-name-of-the-test-database-wploader-should-use","title":"What is the name of the test database WPLoader should use?","text":"

In my example setup it's tests.

During integration, or WordPress \"unit\" tests, wp-loader will need to load WordPress code.

Since WordPress code is not meant to be \"modular\" it does not support auto-loading or loading just parts of it; it's either almost all or nothing.

One of the first things WordPress does, when loading, is trying to connect to a database: if that database is not available then WordPress will not load.

In the answer to the question Where is WordPress installed? I've told wp-browser where to find WordPress code, in this answer I'm telling wp-browser what database it should use to bootstrap WordPress.

This detail will be used by the WPLoader module to bootstrap WordPress. It's highly recommended to use a different database from the one used for functional and acceptance tests.

"},{"location":"v3/configuration/#what-is-the-host-of-the-test-database-wploader-should-use","title":"What is the host of the test database WPLoader should use?","text":"

In my example setup it's 127.0.0.1:3306.

As in the answer to the question What is the name of the test database WPLoader should use? we're providing connection details about the database that should be used to bootstrap WordPress during integration and WordPress \"unit\" tests.

Again the database host is in relation to the machine running the tests, all the considerations done for What is the host of the test database used by the test site? apply.

This detail will be used by the WPLoader module to bootstrap WordPress.

"},{"location":"v3/configuration/#what-is-the-user-of-the-test-database-wploader-should-use","title":"What is the user of the test database WPLoader should use?","text":"

In my example it's root.

Similar to the question What is the user of the test database used by the test site? but in relation to the database specified in the question What is the name of the test database WPLoader should use?.

This detail will be used by the WPLoader module to bootstrap WordPress.

"},{"location":"v3/configuration/#what-is-the-password-of-the-test-database-wploader-should-use","title":"What is the password of the test database WPLoader should use?","text":"

In my example setup it's empty as I've not set any password for the root account.

Similar to the question What is the password of the test database used by the test site? but in relation to the database specified in the question What is the name of the test database WPLoader should use?.

This detail will be used by the WPLoader module to bootstrap WordPress.

"},{"location":"v3/configuration/#what-is-the-table-prefix-of-the-test-database-wploader-should-use","title":"What is the table prefix of the test database WPLoader should use?","text":"

In my example setup it's wp_.

Similar to the question What is the table prefix of the test database used by the test site? but in relation to the database specified in the question What is the name of the test database WPLoader should use?.

This detail will be used by the WPLoader module to bootstrap WordPress.

"},{"location":"v3/configuration/#what-is-the-url-the-test-site","title":"What is the URL the test site?","text":"

In my example setup it's http://localhost:8080.

This is the full URL you would have to enter in the browser, on the machine that is running the tests, to reach the test WordPress site homepage.

"},{"location":"v3/configuration/#what-is-the-email-of-the-test-site-wordpress-administrator","title":"What is the email of the test site WordPress administrator?","text":"

In my example setup it's admin@wp.localhost.

This detail will be used by the WPLoader module to bootstrap WordPress and, while required, it's usually not relevant unless you're testing email communications.

"},{"location":"v3/configuration/#what-is-the-title-of-the-test-site","title":"What is the title of the test site?","text":"

In my example setup it's Acme Plugin Test Site.

This detail will be used by the WPLoader module to bootstrap WordPress and, while required, it's usually not relevant unless you're testing around the site title.

"},{"location":"v3/configuration/#what-is-the-login-of-the-administrator-user-of-the-test-site","title":"What is the login of the administrator user of the test site?","text":"

In my example setup it's admin.

This detail will be used by the WPBrowser or WPWebDriver modules to fill in the login details for the administrator user.

It should be the same as the one that allows you to access the site administration area in the WordPress test site, http://localhost:8080/wp-admin in my example.

"},{"location":"v3/configuration/#what-is-the-password-of-the-administrator-user-of-the-test-site","title":"What is the password of the administrator user of the test site?","text":"

In my example setup it's password.

This detail will be used by the WPBrowser or WPWebDriver modules to fill in the login details for the administrator user.

It should be the same as the one that allows you to access the site administration area in the WordPress test site, http://localhost:8080/wp-admin in my example.

"},{"location":"v3/configuration/#are-you-testing-a-plugin-a-theme-or-a-combination-of-both","title":"Are you testing a plugin, a theme or a combination of both?","text":"

Depending on the answer the WPLoader module will load, during integration or WordPress \"unit\" tests, your WordPress plugin or theme.

If you replied with both (for \"a combination of both\") then you'll be able to choose the plugins and theme to load in integration and WordPress \"unit\" tests in the following questions.

"},{"location":"v3/configuration/#what-is-the-folderpluginphp-name-of-the-plugin","title":"What is the folder/plugin.php name of the plugin?","text":"

This question will be asked only if you replied plugin to the question Are you testing a plugin, a theme or a combination of both?. In my example setup it's acme-plugin/plugin.php.

This is the <folder>/<main-plugin-file>.php path, relative to the WordPress installation plugins folder, to the plugin you are testing.

The main plugin file is the one that contains the plugin header.

This detail will be used by the WPLoader module to bootstrap WordPress and load your plugin or theme in integration and WordPress \"unit\" tests.

"},{"location":"v3/configuration/#are-you-developing-a-child-theme","title":"Are you developing a child theme?","text":"

This question will be asked only if you replied theme to the question Are you testing a plugin, a theme or a combination of both?. Enter yes if you are developing a child theme.

This detail will be used by the WPLoader module to bootstrap WordPress and load a parent theme along with your theme in integration and WordPress \"unit\" tests.

Please note that wp-browser will not download and install the parent theme in the WordPress installation for you.

"},{"location":"v3/configuration/#are-you-using-a-child-theme","title":"Are you using a child theme?","text":"

This question will be asked only if you replied both to the question Are you testing a plugin, a theme or a combination of both?. Enter yes if you are using a child theme.

This detail will be used by the WPLoader module to bootstrap WordPress and load a parent theme along with your theme in integration and WordPress \"unit\" tests.

Please note that wp-browser will not download and install the parent theme in the WordPress installation for you.

"},{"location":"v3/configuration/#what-is-the-slug-of-the-parent-theme","title":"What is the slug of the parent theme?","text":"

This question will be asked only if you replied yes to the question Are you developing a child theme?.

Reply with the slug of the parent theme, that's usually the name of the folder the parent theme lives in, e.g. twentyseventeen.

This detail will be used by the WPLoader module to bootstrap WordPress and load a parent theme along with your theme in integration and WordPress \"unit\" tests.

Please note that wp-browser will not download and install the parent theme in the WordPress installation for you.

"},{"location":"v3/configuration/#what-is-the-slug-of-the-theme","title":"What is the slug of the theme?","text":"

This question will be asked only if you replied theme to the question Are you testing a plugin, a theme or a combination of both?. Reply with the slug of the theme, that's usually the name of the folder the theme lives in, e.g. twentyseventeen.

This detail will be used by the WPLoader module to bootstrap WordPress and load your theme in integration and WordPress \"unit\" tests.

"},{"location":"v3/configuration/#what-is-the-slug-of-the-theme-you-are-using","title":"What is the slug of the theme you are using?","text":"

This question will be asked only if you replied both to the question Are you testing a plugin, a theme or a combination of both?. Reply with the slug of the theme you are using, that's usually the name of the folder the theme lives in, e.g. twentyseventeen.

This detail will be used by the WPLoader module to bootstrap WordPress and load the theme integration and WordPress \"unit\" tests.

"},{"location":"v3/configuration/#does-your-project-needs-additional-plugins-to-be-activated-to-work","title":"Does your project needs additional plugins to be activated to work?","text":"

Whether you're testing a plugin, a theme or a combination of both you might need some additional plugins to run your tests.

As an example if I'm testing a WooCommerce extension I need the WooCommerce plugin to test it; this is the place where I can define it.

The required plugins follow the same format as the one used in the question What is the folder/plugin.php name of the plugin?: <plugin-folder>/<plugin-main-file>.php; in the case of WooCommerce it would be woocommerce/woocommerce.php.

This detail will be used by the WPLoader module to bootstrap WordPress and load the required plugins in integration and WordPress \"unit\" tests.

Please note that wp-browser will not download and install the required plugins in the WordPress installation for you.

"},{"location":"v3/configuration/#if-you-entered-a-wrong-value","title":"If you entered a wrong value","text":"

No worries, just correct the value in the environment file or in the suites configuration files.

The environment file will have the name you specified in the answer the question How would you like to call the env configuration file?.

The suites configuration files can be found in tests/<suite>.suite.yml; e.g. the wpunit suite configuration file will be tests/wpunit.suite.yml file.

"},{"location":"v3/configuration/#final-steps","title":"Final steps","text":"

To complete the setup I have removed any demo content from the site and activated my plugin in the plugins administration page.

In the tests/acceptance.suite.yml file and in the tests/functional.suite.yml file, the configuration file for the acceptance and functional suites respectively, the WPDb module configuration contains a dump configuration parameter:

class_name: AcceptanceTester\nmodules:\n    enabled:\n        - WPDb\n    config:\n        WPDb:\n            dump: 'tests/_data/dump.sql'\n

The dump parameter is inherited by the WPDb module from the Codeception Db module and defines the SQL dump file that should be loaded before, and between, tests to reset the testing environment to a base known state.

As for any other database-related operation wp-browser will not create the dump for me. I use MySQL binary to export the database state (a dump) with the command:

mysqldump -u root -h 127.0.0.1 -P 3306 wordpress > /Users/luca/Sites/wordpress/wp-content/plugins/acme-plugin/tests/_data/dump.sql\n

I could use any other combination of tools to produce the dump; using mysql binary is not a requirement.

Graphic interfaces like SequelPro, Adminer and the like would be perfectly fine.

"},{"location":"v3/configuration/#pre-flight-check","title":"Pre-flight check","text":"

There is one last check I need to make before jumping into the creation of tests: making sure all the paths and credentials I've configured wp-browser with are correct.

The bootstrap process generated four suites for me: acceptance, functional, integration and unit. If you have modified the default suite names during the setup your suites names might differ though.

To test the setup I will run each suite and make sure it can run correctly empty of any test. To run a suite of tests I will use the codecept run command:

codecept run acceptance\ncodecept run functional\ncodecept run integration\ncodecept run unit\n

How comes I'm not using the command codecept run (without specifying the suite names)? See the FAQ entry.

If you cannot run all the suites without issues then check your configuration settings again, read the errors and see If you entered a wrong value

"},{"location":"v3/contributing/","title":"Contributing to wp-browser","text":"

There are many ways you can contribute to the project and most of them do not involve having an intimate knowledge of Codeception or wp-browser internals.

"},{"location":"v3/contributing/#reporting-an-issue","title":"Reporting an issue","text":"

It can be done from here.

Whenever you find yourself struggling with something, anything, while using wp-browser, please report an issue.

If your issue is not a real issue it will be quickly closed but still provide two values:

  1. it will remain in the repository issues archive making it searchable for any other user having the same, or similar, issue
  2. it might shine a light on missing documentation, API or clarity in general. Take the time to fill in the issue template provided and provide as many details as you can.
"},{"location":"v3/contributing/#reporting-a-bug","title":"Reporting a bug","text":"

The project pulls a number of components together and will have bugs. If you run into one of them then provide as much detail as possible when opening the issue. Beside what the issue template will ask feel free to provide as much additional detail as you can.

"},{"location":"v3/contributing/#requesting-documentation","title":"Requesting documentation","text":"

If you feel the documentation is lacking or missing something entirely please report it. No documentation can possibly cover any case ever but there's a good chance you're not alone with the feeling that something is amiss.

"},{"location":"v3/contributing/#requesting-new-features","title":"Requesting new features","text":"

I've not used all the tools, environments and possible setups wp-browser could cover.

If you feel wp-browser is missing a feature open an issue and try to provide as many details as possible:

  • What problem would the new feature solve?
  • Is it possible to do what you would like the new feature to do with the existing API?
  • Could you provide an example of the API/configuration you would like to be able to use? A new feature can be as small as a new module method or as large as a new module entirely: do not be afraid to ask.
"},{"location":"v3/contributing/#pull-requests","title":"Pull requests","text":"

If you encounter any of the issues above and have a proposed fix for it then open a pull request alongside an issue.

Any pull-request has to pass tests before being merged and I might add code to your pull request to add tests or update them; I will work with you on the pull request if required.

Just know it's really appreciated.

"},{"location":"v3/events-api/","title":"Events api","text":""},{"location":"v3/events-api/#events-api","title":"Events API","text":"

Codeception comes with a set of events modules and extensions can subscribe to.

Codeception Events API is, but, only available to Modules and Extensions, and while that might be good for most cases, it might not cover a number of edge cases.

Similarly to WordPress add_action function, wp-browser provides the tad\\WPBrowser\\addListener function:

function addListener($eventName, callable $listener, $priority = 0);\n

The priority works the reverse way as it does in WordPress: highest number will be processed first!

Again similarly to WordPress do_action function, the tad\\WPBrowser\\dispatch function:

function dispatch($eventName, $origin = null, array $context = []);\n

This is the kind of API that is better shown with an example, though.

"},{"location":"v3/events-api/#example","title":"Example","text":"

In this example I'm writing acceptance tests and would like to avoid the performance hit that the cleanup configuration parameter of the Db, or WPDb, module implies. The cleanup parameter will trigger the drop of all tables in the test database and the re-import of the SQL dump file, or files, between each test. This will ensure a clean starting fixture between tests, but for larger setup fixtures this might be a long operation that wastes precious seconds when, say, the only change is the addition of 3 posts, as in this example.

The Events API allows implementing a tailored clean-up procedure that can avoid costly clean ups between tests.

In the suite bootstrap file, e.g. tests/acceptance/_bootstrap.php, I add a listener on the my-plugin-test/setup-posts event. The event will contain information about what post IDs I've set up in the tests and will provide an instance of the tester object to handle database manipulation. With that information, the costly cleanup procedure can be avoided.

<?php\n\n$registerPostsCleanup = static function (tad\\WPBrowser\\Events\\WpbrowserEvent $event) {\n    $ids = $event->get('ids', []);\n    /** @var \\EventsTester $db */\n    $db = $event->get('db');\n\n    // When tests are done, then remove all the posts we've created at the start of the test, if any.\n    tad\\WPBrowser\\addListener(\n        Codeception\\Events::TEST_AFTER,\n        static function () use ($ids, $db) {\n            foreach ($ids as $id) {\n                $db->dontHavePostInDatabase([ 'ID' => $id ], true);\n                // Ensure the clean up did happen correctly.\n                $db->dontSeePostInDatabase([ 'ID' => $id ]);\n                $db->dontSeePostMetaInDatabase([ 'post_id' => $id ]);\n            }\n        }\n    );\n};\n\n// Listen for this event to register the posts to remove, along with their custom fields, after the test.\ntad\\WPBrowser\\addListener('test-event-1/setup-posts', $registerPostsCleanup);\n

In this simple test I'm adding 3 posts [using the factory provided by the WPLoader module in loadOnly mode][2] and want to make sure those, and the relative meta, are removed at the end of the tests. The WPDb module, extending the Db module from Codeception, will remove the inserted rows, but will not take care of modified rows, or rows not inserted by the WPDb module.

Mirroring the requirement of the clean up function I've defined above, I'm passing the post IDs of the posts I've created and the current tester to provide the clean up function with database handling capabilities.

<?php\n/** @var Codeception\\Scenario $scenario */\n$I = new AcceptanceTester($scenario);\n$I->wantTo('add posts and clean them up using the Events API');\n\n/*\n * Use WordPress methods, thanks to the `WPLoader` module, to use WordPress, or our own, API to insert posts.\n * This will prevent, but, `WPDb` from removing the inserted rows and clean up, so we remove the posts and meta\n * with an event and our custom clean-up function.\n */\n$ids = $I->factory()->post->create_many(3, [ 'post_type' => 'some_post_type' ]);\n\ntad\\WPBrowser\\dispatch('test-event-1/setup-posts', __FILE__, [\n    'ids' => $ids,\n    'db'  => $I\n]);\n
"},{"location":"v3/extensions/","title":"Extensions","text":"

The Codeception testing framework can be extended in a number of ways.

The one this project leverages the most are modules but [extensions are another way].

Modules extend the functionality of Codeception in the context of the tests, while extensions extend its interaction capacities; this is by no means a strict rule but that's usually the case.

The package contains two additional extensions to facilitate testers' life.

"},{"location":"v3/extensions/#symlinker","title":"Symlinker","text":"

The tad\\WPBrowser\\Extension\\Symlinker extension provides an automation to have the Codeception root directory symbolically linked in a WordPress local installation.

Since version 3.9 WordPress supports this feature (with some precautions) and the extension takes charge of:

  • symbolically linking a plugin or theme folder in the specified destination before any suite boots up
  • unlinking that symbolic link after all of the suites did run

It's the equivalent of doing something like this from the command line (on a Mac):

ln -s /my/central/plugin/folder/my-plugin /my/local/wordpress/installation/wp-content/plugins/my-plugin\n/my/central/plugin/folder/my-plugin/vendor/bin/codecept run\nrm -rf /my/local/wordpress/installation/wp-content/plugins/my-plugin\n\n

The extension needs small configuration in the codeception.yml file:

extensions:\n    enabled:\n        - tad\\WPBrowser\\Extension\\Symlinker\n    config:\n        tad\\WPBrowser\\Extension\\Symlinker:\n            mode: plugin\n            destination: /my/local/wordpress/installation/wp-content/plugins\n            rootFolder: /some/plugin/folder\n

The arguments are:

  • mode - can be plugin or theme and indicates whether the current Codeception root folder being symlinked is a plugin or a theme one
  • destination - the absolute path to the WordPress local installation plugins or themes folder; to take the never ending variety of possible setups into account the extension will make no checks on the nature of the destination: could be any folder.
  • rootFolder - optional absolute path to the WordPress plugin or theme to be symlinked root folder; will default to the Codeception root folder
"},{"location":"v3/extensions/#copier","title":"Copier","text":"

The tad\\WPBrowser\\Extension\\Copier extension provides an automation to have specific files and folders copied to specified destination files and folders before the suites run.

While WordPress handles symbolic linking pretty well there are some cases, like themes and drop-ins, where there is a need for \"real\" files to be put in place.

One of such cases is, currently, one where Docker is used to to host and serve the code under test: symbolically linked files cannot be bound inside a container and Docker containers will fail to start in this case.

The extension follows the standard Codeception extension activation and has one configuration parameter only:

extensions:\n    enabled:\n        - tad\\WPBrowser\\Extension\\Copier\n    config:\n        tad\\WPBrowser\\Extension\\Copier:\n            files:\n                tests/_data/required-drop-in.php: /var/www/wordpress/wp-content/drop-in.php\n                tests/_data/themes/dummy: /var/www/wordpress/wp-content/themes/dummy\n                /Users/Me/Repos/required-plugin: /var/www/wordpress/wp-content/plugins/required-plugin.php\n                /Users/Me/Repos/mu-plugin.php: ../../../../wp-content/mu-plugins/mu-plugin.php\n

The extension will handle absolute and relative paths for sources and destinations and will resolve relative paths from the project root folder.

When copying directories the extension will only create the destination folder and not the folder tree required; in the example configuration above the last entry specifies that a mu-plugin.php file should be copied to the mu-plugins folder: that mu-plugins folder must be there already.

"},{"location":"v3/extensions/#environments-support","title":"Environments support","text":"

Being able to symlink a plugin or theme folder into a WordPress installation for testing purposes could make sense when trying to test, as an example, a plugin in a single site and in multi site environment.

Codeception supports environments and the extension does as well specifying a destination for each.

As an example the acceptance.suite.yml file might be configured to support single and multisite environments:

env:\n    single:\n        modules:\n            config:\n                WPBrowser:\n                    url: 'http://wp.dev'\n                WPDb:\n                    dsn: 'mysql:host=127.0.0.1;dbname=wp'\n    multisite:\n        modules:\n            config:\n                WPBrowser:\n                    url: 'http://mu.dev'\n                WPDb:\n                    dsn: 'mysql:host=127.0.0.1;dbname=mu'\n

In the codeception.yml file specifying a destination for each supported environment will tell the extension to symbolically link the plugin or theme file to different locations according to the current environment:

extensions:\n    enabled:\n        - tad\\WPBrowser\\Extension\\Symlinker\n    config:\n        tad\\WPBrowser\\Extension\\Symlinker:\n            mode: plugin\n            destination:\n                single: /var/www/wp/wp-content/plugins\n                multisite: /var/www/mu/wp-content/plugins\n

If no destination is specified for the current environment the extension will fallback to the first specified one.

A default destination can be specified to override this behaviour.

extensions:\n    enabled:\n        - tad\\WPBrowser\\Extension\\Symlinker\n    config:\n        tad\\WPBrowser\\Extension\\Symlinker:\n            mode: plugin\n            destination:\n                default: /var/www/default/wp-content/plugins\n                single: /var/www/wp/wp-content/plugins\n                multisite: /var/www/mu/wp-content/plugins\n

When running a suite specifying more than one environment like

codecept run acceptance --env foo,baz,multisite\n

Then the extension will use the first matched one, in the case above the multisite destination will be used.

The rootFolder parameter too can be set to be environment-aware and it will follow the same logic as the destination:

extensions:\n    enabled:\n        - tad\\WPBrowser\\Extension\\Symlinker\n    config:\n        tad\\WPBrowser\\Extension\\Symlinker:\n            mode: plugin\n            rootFolder:\n                dev: /\n                dist: /dist\n                default: /\n            destination:\n                default: /var/www/dev/wp-content/plugins\n                dev: /var/www/dev/wp-content/plugins\n                dist: /var/www/dist/wp-content/plugins\n

When running a suite specifying more than one environment like

codecept run acceptance --env dist\n

Then the extension will symlink the files from /dist into the /var/www/dist/wp-content/plugins folder.

"},{"location":"v3/extensions/#events","title":"Events","text":"

Due to some internal changes in Codeception 4.0, the internal API (really a collection of low-level hacks on my part) that allowed wp-browser to dispatch, and listen for, events in the modules has been removed.

If you want to leverage [the event system wp-browser provides] with Codeception default events (e.g. suite.init or test.before), then you will need to use this extension.

You will not need this extension if you're not using Codeception version 4.0.

You will need to enable it in your Codeception main configuration file (e.g. codeception.dist.yml).

extensions:\n    enabled:\n        - tad\\WPBrowser\\Extension\\Events\n    config:\n      tad\\WPBrowser\\Extension\\Events:\n        suites: ['acceptance']\n

The extension only configuration is the suites parameter that allows specifying the suites the extension should apply to. If the suites parameter is not specified, then the extension will apply to all suites.

"},{"location":"v3/faq/","title":"Faq","text":""},{"location":"v3/faq/#some-common-questions","title":"Some common questions","text":"

There are questions I keep receiving via email, GitHub or in person at conferences.

I tried to address some of them here.

"},{"location":"v3/faq/#is-codeceptionwp-browser-php-52-compatible","title":"Is Codeception/wp-browser PHP 5.2 compatible?","text":"

No, Codeception, and wp-browser by extension, will require PHP 5.6 minimum.

This does not mean your code cannot be PHP 5.2 compatible: you can test your code using all the possibilities of newer PHP versions and still keep it PHP 5.2 compatible.

Just because you can doesn't mean you should though: this documentation will assume a minimum PHP version, for the example and test code, of PHP 5.6.

"},{"location":"v3/faq/#can-i-run-unit-tests-with-wp-browsercodeception","title":"Can I run unit tests with wp-browser/Codeception?","text":"

Yes, with some distinctions.

In the WordPress ecosystem there's a tendency to call any kind of test a \"unit test\". Under that definition will fall tests that are not \"unit\" tests at all.

Without drowning into a long and painful battle for definitions this guide will use the following definitions for different levels of testing.

The next section will detail the conventions this documentation uses to define different levels of testing in more detail.

"},{"location":"v3/faq/#isnt-wordpress-untestable","title":"Isn't WordPress untestable?","text":"

No; it's sometimes difficult to test and not as straightforward as other PHP frameworks but it's definitely not untestable.

You are writing code that runs on WordPress, not the Core code for WordPress so the question should really be: will you write testable code?

It's up to you to decide at what level you want to make your code testable and how much you want to test it.

"},{"location":"v3/faq/#do-i-need-to-use-a-specific-local-development-environment-to-use-wp-browser","title":"Do I need to use a specific local development environment to use wp-browser?","text":"

No. I've started using wp-browser on a vanilla PHP built-in server to, then, move to MAMP (or XAMP) and, from there, to other solutions.

I've configured and used wp-browser on Docker, Vagrant, VVV, Valet and various CI solutions.

To this day I keep using different setups on different machines and personally prefer Docker for its portability.

"},{"location":"v3/faq/#can-i-only-test-plugins-with-wp-browser","title":"Can I only test plugins with wp-browser?","text":"

No, you can test any kind of WordPress application.

With \"application\" I mean any PHP software built on top of WordPress: plugins, themes, whole sites.

"},{"location":"v3/faq/#if-im-testing-a-site-do-i-have-to-use-the-default-wordpress-file-structure","title":"If I'm testing a site do I have to use the default WordPress file structure?","text":"

No, you can use any file structure you want.

Some wp-browser modules will need a little help to find your code but, so far, I've never been unable to set it up.

"},{"location":"v3/faq/#can-i-use-wp-browser-even-if-my-wordpress-application-doesnt-use-composer","title":"Can I use wp-browser even if my WordPress application doesn't use Composer?","text":"

Yes, although wp-browser, as a development tool, cannot be installed without Composer.

"},{"location":"v3/faq/#should-i-use-wp-browser-to-test-my-production-servers","title":"Should I use wp-browser to test my production servers?","text":"

No. Unless you know very well what you're doing that's a dangerous idea that might leave you with a broken site and an empty database.

As almost any testing tool, wp-browser should be used locally on local installations of WordPress that do not contain any valuable information.

"},{"location":"v3/faq/#how-can-i-avoid-the-wpdb-module-from-replacing-the-contents-of-my-database","title":"How can I avoid the WPDb module from replacing the contents of my database?","text":"

You should always backup any database that contains any information you care about before running any test.

You can read the answer to this question in the WPDb module documentation.

"},{"location":"v3/faq/#can-i-run-all-my-tests-with-one-command","title":"Can I run all my tests with one command?","text":"

Theoretically: yes, in practice: no.

When you use codecept run Codeception will run all the tests from all the suites.

This, done in the context of other frameworks, will generally not create any problem but, in the context of WordPress it will.

While handling a single HTTP request WordPress will set, and use, a number of constants and globals and, likewise, will do plugins and themes that follow WordPress standards.

This means that the global context (variable scope) will be left \"dirty\" and contain \"left-over\" constants and globals from the previous tests.

An example is one where a test for the handling of Ajax requests sets the DOING_AJAX constant: this will be now set for any test after the one that set it thus breaking, or worse altering, all the following ones.

So, in short, run each suite separately.

"},{"location":"v3/faq/#can-i-have-more-than-one-suite-of-one-kind","title":"Can I have more than one suite of one kind?","text":"

Yes, you should.

As an example you might have a frontend suite running acceptance tests on the site frontend and a backend suite running acceptance tests on the site backend.

Think of suites as a tool to organize your tests: there's a good measure between too organized and not organized at all.

"},{"location":"v3/faq/#ive-used-phpunit-before-for-my-unit-tests-can-i-reuse-that-knowledge-and-code-with-wp-browser","title":"I've used PHPUnit before for my unit tests, can I reuse that knowledge and code with wp-browser?","text":"

Yes.

Codeception uses PHPUnit as one of its main components and can run PHPUnit tests with little or no modification.

As such you can just move your existing PHPUnit tests in a dedicated suite and be ready to run in minutes.

"},{"location":"v3/faq/#ive-already-set-up-my-tests-to-run-using-the-core-phpunit-based-test-suite-can-i-keep-using-my-tests","title":"I've already set up my tests to run using the Core PHPUnit-based test suite, can I keep using my tests?","text":"

Yes.

Codeception uses PHPUnit as one of its main components and can run PHPUnit tests with little or no modification.

One of the goals of wp-browser was to make it easier to test WordPress application at an integration level (or \"WordPress unit\" level).

As such migrating those tests could be a matter of minutes requiring no modification to the tests if not for moving some files and creating a dedicated suite.

"},{"location":"v3/faq/#why-is-the-project-called-wp-browser","title":"Why is the project called wp-browser?","text":"

When I started working with Codeception to run my acceptance tests I kept creating steps that I would reuse over and over in my projects.

I packed them in a module extending the PHPBrowser module.

Being a natural talent in naming things I've called the module WPBrowser and published it. As I started relying on Codeception more and more I kept adding modules but the name remained.

"},{"location":"v3/installation/","title":"Installation","text":""},{"location":"v3/installation/#installation","title":"Installation","text":""},{"location":"v3/installation/#where-should-i-install-wp-browser","title":"Where should I install wp-browser?","text":"

As a rule-of-thumb wp-browser should be installed in the root folder of your project.

If your project is a plugin then it should be installed in the root folder of your plugin; if your project is a theme it should be installed in the root folder of your theme.

If your project is a site I'd, personally install it in the site root folder.

The purpose of installing wp-browser in the root folder of a project is to keep the code and its tests under version control together.

Exceptions apply but, for most projects, that's what I would do.

"},{"location":"v3/installation/#initializing-the-composer-project","title":"Initializing the Composer project","text":"

Since Composer is a requirement of wp-browser and the only way to install it you should, first thing, initialize the Composer project.

If you've already initialized the Composer project you can skip this section.

Once you've decided where to install wp-browser navigate to that folder using the terminal and type:

composer init\n

Composer will take you through a number of questions to setup some meta information about your project.

Do not install any dependency yet when asked (unless you know what you're doing) and, as a suggestion, set wordpress-plugin as \"Package Type\".

Also, since WordPress is licensed under the GPL-2.0+ you might want to set the \"License\" of your project to GPL-2.0-or-later.

"},{"location":"v3/installation/#installing-wp-browser-as-a-development-dependency","title":"Installing wp-browser as a development dependency","text":"

Once you've initialized the Composer project it's time to require wp-browser ; you can read more about the usage of the require command on the Composer documentation.

wp-browser is a testing tool and, as such, should be installed as a project development dependency, not as a normal (production) one.

From the terminal type:

composer require --dev lucatume/wp-browser\n

This will install the latest stable version of wp-browser and, along with it, Codeception and PHPUnit in the vendor folder of your project.

Once that's done it's time to move to the setup and configuration of wp-browser.

"},{"location":"v3/levels-of-testing/","title":"Levels of testing","text":""},{"location":"v3/levels-of-testing/#what-is-a-unit-test-an-acceptance-test","title":"What is a unit test? An acceptance test?","text":"

This page has no pretense to be THE source of truth about what is called how in the context of tests; the purpose of this page is to lay out the terminology that I'll use in the documentation to define the levels and component of testing. Wikipedia, forums and other documents online will offer alternate, and equally valid, definitions.

"},{"location":"v3/levels-of-testing/#the-signup-page-example","title":"The signup page example","text":"

Let's assume I'm testing a WordPress plugin that adds mailing list management and subscription functionalities to a site.

The plugin provides a number of functions and, among them, it will add a sign-up page to receive users applications.

"},{"location":"v3/levels-of-testing/#acceptance-tests","title":"Acceptance tests","text":"

In brief: make assertions as a user would.

The user might be tech-savvy as much as I want her to be but still make assertions only on what feedback the site provides.

The code below tests a user can subscribe to the mailing list:

<?php\n// UserSuccessfulSignupTest.php\n\n// Add a page that contains the shortcode that will render the signup form.\n$I->havePageInDatabase( [\n    'post_name' => 'signup',\n    'post_content'=> 'Sign-up for our awesome thing! [signup]',\n] );\n\n// Go to the page.\n$I->amOnPage( '/signup' );\n\n// Submit the form as a user would submit it. \n$I->submitForm( '#signup-form', [\n  'name' => 'Luca',\n  'email' => 'luca@theAverageDev.com',\n] );\n\n// Make sure I see a confirmation message. \n$I->waitForElement( '#signup-confirmation' );\n
"},{"location":"v3/levels-of-testing/#functional-tests","title":"Functional tests","text":"

In brief: make assertions as a developer would.

The test code below asserts front-end submissions are correctly processed from the developer perspective:

<?php\n// file tests/functional/SignupSubmissionCest.php\n\nclass SignupSubmissionCest {\n\n    public function _before( FunctionalTester $I ) {\n        // Add a page that contains the shortcode that will render the signup form.\n        $I->havePageInDatabase( [\n            'post_name' => 'signup',\n            'post_content'=> 'Sign-up for our awesome thing! [signup]',\n        ] );\n\n        $I->amOnPage( '/signup' );\n    }\n\n    public function test_good_signup( FunctionalTester $I ) {\n        $I->sendAjaxPostRequest( '/wp-json/acme/v1/signup', [\n          '_wpnonce' => $I->grabAttributeFrom( '#signup-nonce', 'value' ),\n          'name' => 'Luca',\n          'email' => 'luca@theAverageDev.com',\n        ] );\n\n        $I->seeResponseCodeIsSuccessful();\n        $I->seeUserInDatabase( [ 'user_login' => 'luca', 'user_email' => 'luca@theaveragedev.com' ] );\n    }\n\n    public function test_bad_email_signup( FunctionalTester $I ) {\n        $I->sendAjaxPostRequest( '/wp-json/acme/v1/signup', [\n          '_wpnonce' => $I->grabAttributeFrom( '#signup-nonce', 'value' ),\n          'name' => 'Luca',\n          'email' => 'not-really-an-email',\n        ] );\n\n        $I->seeResponseCodeIs( 400 );\n        $I->dontSeeUserInDatabase( [ 'user_login' => 'luca', 'user_email' => 'not-really-an-email' ] );\n    }\n}\n

The code looks, initially, like an acceptance test, but differs in its action and assertion phase: in place of filling a form and clicking \"Submit\" it sends a POST request to a REST API endpoint and checks the effect of the submission in the database.

All of these actions fall squarely into what a developer would do, not into what a user could/should be able to do.

Furthermore, the format of the test is not the same as the one used in the acceptance test.

The acceptance test is written in the most eloquent testing format supported by Codeception, the Cept format, this test uses a more PHPUnit-like format, the Cest format.

While the first is easier to skim for non-developers the second harnesses the power of a re-using pieces of code, the page creation and navigation in the example, to optimize the test code.

"},{"location":"v3/levels-of-testing/#integration-tests","title":"Integration tests","text":"

In brief: test code modules in the context of a WordPress website.

In this type of test the WordPress, and additional plugins code, is loaded in the same variable scope as the tests; this is why in the example below I'm using classes (WP_REST_Request, WP_REST_Response) and methods (register_rest_route) defined by WordPress, not the plugin code.

The REST API request sent by the application form will be handled by a class, Acme\\Signup\\SubmissionHandler, that's been attached to the /wp-json/acme/v1/signup path:

<?php\n// file src/rest.php\n\nadd_action( 'rest_api_init', function () {\n    register_rest_route( 'acme/v1', '/signup', array(\n        'methods' => 'POST',\n        'callback' => function( WP_Rest_Request $request ) {\n            $email_validator = new Acme\\Signup\\EmailValidator();\n            $handler = new Acme\\Signup\\SubmissionHandler( $email_validator );\n\n            return $handler->handle( $request );\n        },\n    ) );\n} );\n

I want to test the chain of classes and methods that's handling such a request in the context of a WordPress installation.

Integration is usually about testing \"modules\" of code: groups of classes and functions working together to provide a service or complete a task.

In the context of integration testing the class dependencies and/or the context are not mocked.

<?php\n// file tests/integration/SubmissionHandlingTest.php\n\nclass SubmissionHandlingTest extends \\Codeception\\TestCase\\WPTestCase {\n    public function test_good_request() {\n        $request = new WP_Rest_Request();\n        $request->set_body_params( [ 'name' => 'luca', 'email' => 'luca@theaveragedev.com' ] );\n        $handler = new  Acme\\Signup\\SubmissionHandler();\n\n        $response = $handler->handle( $request );\n\n        $this->assertIntsanceOf( WP_REST_Response::class, $response );\n        $this->assertEquals( 200, $response->get_status() );\n        $this->assertInstanceOf( Acme\\Signup\\Submission_Good::class, $handler->last_submission() );\n        $this->assertEquals( 'luca', $handler->last_submission()->name() );\n        $this->assertEquals( 'luca@theaveragedev.com', $handler->last_submission()->email() );\n    }\n\n    public function test_bad_email_request() {\n        $request = new WP_Rest_Request();\n        $request->set_body_params( [ 'name' => 'luca', 'email' => 'not-a-valid-email' ] );\n        $handler = new  Acme\\Signup\\SubmissionHandler();\n\n        $response = $handler->handle( $request );\n\n        $this->assertIntsanceOf( WP_REST_Response::class, $response );\n        $this->assertEquals( 400, $response->get_status() );\n        $this->assertInstanceOf( Acme\\Signup\\Submission_Bad::class, $handler->last_submission() );\n        $this->assertEquals( 'luca', $handler->last_submission()->name() );\n        $this->assertEquals( 'not-a-valid-email', $handler->last_submission()->email() );\n    }\n}\n

The test format used is the familiar PhpUnit one; the only difference is the base test class that's being extended (\\Codeception\\TestCase\\WPTestCase) is one provided by wp-browser.

In the context of WordPress \"integration\" might also mean testing that filters used by the code have the expected effect.

"},{"location":"v3/levels-of-testing/#unit-tests","title":"Unit tests","text":"

In brief: test single classes or functions in isolation.

The email address is validated by the Acme\\Signup\\EmailValidator class.

In the test code below I want to make sure the validation works as intended.

<?php\n// file tests/unit/EmailValidatorTest.php\n\nclass EmailValidatorTest extends Codeception\\Test\\Test {\n    public function test_good_email_validation() {\n        $validator = new Acme\\Signup\\EmailValidator();\n\n        $this->assertTrue( $validator->validate( 'luca@theaveragedev.com' ) ); \n    }\n\n    public function test_bad_email_validation(){\n        $validator = new Acme\\Signup\\EmailValidator();\n\n        $this->assertTrue( $validator->validate( 'not-an-email' ) );\n    }\n\n    public function test_tricky_email_validation() {\n        $validator = new Acme\\Signup\\EmailValidator();\n\n        $this->assertTrue( $validator->validate( 'luca+signup@theaveragedev.com' ) ); \n    }\n\n    public function test_validation_with_service(){\n        // Stub the validation service.\n        $validation_service = $this->prophesize( Acme\\Signup\\ValidationService::class );\n        $validation_service->validate( 'luca@theaveragedev.com' )->willReturn( true );\n        $validation_service->validate( 'lucas@theaveragedev.com' )->willReturn( false );\n        // Build the validator and set it to use the mock validation service.\n        $validator = new Acme\\Signup\\EmailValidator();\n        $validator->use_service( $validation_service->reveal() );\n\n        $this->assertTrue( $validator->validate( 'luca@theaveragedev.com' ) );\n        $this->assertFalse( $validator->validate( 'lucas@theaveragedev.com' ) );\n    }\n}\n

Unit tests is where stubbing/mocking/spying of dependencies is used to gain total control over the input and context the class is using.

In the last test method I'm doing exactly that testing the email validator with an external validation service.

In the example I'm using the Prophecy mock engine that comes with PHPUnit along with its own mocking/stubbing/spying solutions.

There are other mocking engines (e.g Mockery) that could be used.

"},{"location":"v3/levels-of-testing/#wordpress-unit-tests","title":"WordPress \"unit\" tests","text":"

In brief: test single classes or functions that require WordPress code in as much isolation as possible.

This is what most people referring to \"unit tests\" in the context of WordPress is talking about.

The purpose of this kind of tests is to test one class of a WordPress application, or one function, that requires a WordPress-defined function or class with a unit testing approach.

In the example below I'm testing the Acme\\Signup\\SubmissionHandler class on a \"unit\" level making sure it will mark a request as bad if the email is not a valid one.

<?php\n// file tests/unit/SubmissionHandlerTest.php\nclass SubmissionHandlerTest extends Codeception\\Test\\Test {\n    protected  $request;\n    protected $validator;\n\n    public function setUp() {\n        // Mock the request.\n        $this->request = $this->prophesize( WP_REST_Request::class );\n        // Spy on the validator.\n        $this->validator = $this->prophesize( Acme\\Signup\\EmailValidator::class );\n    }\n\n    public function test_email_is_validated_by_default() {\n        $this->request->get_param( 'name' )->willReturn( 'luca' );\n        $this->request->get_param( 'email' )->willReturn( 'luca@theaveragedev.com' );\n\n        $handler = new Acme\\Signup\\SubmissionHandler( $this->validator->reveal() );\n        $handler->set_validator( $this->validator );\n        $response = $handler->handle( $this->request->reveal() );\n\n        $this->assertInstanceOf( WP_REST_Response::class, $response );\n        // Verify on the validator spy.\n        $this->validator->validate( 'luca@theaveragedev.com' )->shouldHaveBeenCalled();\n    }\n\n    public function test_will_not_validate_email_if_missing() {\n        $this->request->get_param( 'name' )->willReturn( 'luca' );\n        $this->request->get_param( 'email' )->willReturn( '' );\n\n        $handler = new Acme\\Signup\\SubmissionHandler( $this->validator->reveal() );\n        $handler->set_validator( $this->validator );\n        $response = $handler->handle( $this->request->reveal() );\n\n        $this->assertInstanceOf( WP_REST_Response::class, $response );\n        // Verify on the validator spy.\n        $this->validator->validate( Argument::any() )->shouldNotHaveBeenCalled();\n    }\n}\n

The class uses the WP_REST_Request and WP_Rest_Response classes as input and output and will probably, internally, use more functions defined by WordPress.

One solution to avoid loading WordPress, could be to rewrite test versions of each and all the WordPress functions and classes needed by all the classes I want to unit test; this would require updating each time the classes requirements change.

Furthermore internationalization (e.g. __()) and filtering (e.g apply_filters) functions would not need to be mocked if not in specific cases and would pretty much be copy and paste versions of the WordPres ones.

Loading single pieces of WordPress is a dangerous and brittle endeavour and it's not supported by the framework.

To avoid all this WordPress \"unit tests\" pay the price of having to bootstrap WordPress, thus requiring a database connection.

This kind of test setup and level is the one you can see in the PHPUnit Core suite of WordPress itself.

"},{"location":"v3/requirements/","title":"Requirements","text":""},{"location":"v3/requirements/#requirements","title":"Requirements","text":"

wp-browser has some requirements your development environment will need to fulfill for it to work correctly.

"},{"location":"v3/requirements/#php","title":"PHP","text":"

The minimum supported version of PHP supported by wp-browser is 5.6.

This requirement does not reflect on the minimum PHP version your plugin might require; see the FAQs for more information.

"},{"location":"v3/requirements/#composer","title":"Composer","text":"

There is no phar version of wp-browser and it can only be installed using Composer.

See Composer installation guide for more information.

"},{"location":"v3/requirements/#wordpress-mysql-apachenginx","title":"WordPress, MySQL, Apache/Nginx","text":"

wp-browser will not download, install and configure WordPress for you.

It will also not download, install and setup MySQL, Apache, Nginx or any other technology required by a fully functional WordPress installation for you.

You need to set up a local WordPress installation on your own; you can use your preferred solution to do it.

In the documentation I will show automated ways to do this but, for most projects, that's not the best solution.

"},{"location":"v3/setting-up-minimum-wordpress-installation/","title":"Setting up minimum wordpress installation","text":""},{"location":"v3/setting-up-minimum-wordpress-installation/#setting-up-a-minimum-wordpress-installation","title":"Setting up a minimum WordPress installation","text":"

As mentioned in Installation section wp-browser will not download, configure and install WordPress for you.

On a high level, once WordPress is installed and configured, whatever local development environment solution you've used, there are some information you'll need to gather before moving into wp-browser configuration.

While there will be a section dedicated to different environments and setups I will outline below the example setup I will use, in the next section, to configure wp-browser:

  • WordPress is installed, on my machine, at /Users/luca/Sites/wordpress.
  • I'm running MySQL server locally; I can connect to the MySQL server with the command mysql -u root -h 127.0.0.1 -P 3306; there is no password.
  • I've created two databases, wordpress and tests, with the command: bash mysql -u root -h 127.0.0.1 -P 3306 -e \"create database if not exists wordpress; create database if not exists tests\"
  • I've configured the /Users/luca/Sites/wordpress/wp-config.php file like below (redacted for brevity): ```php <?php define( 'DB_NAME', 'wordpress' ); define( 'DB_USER', 'root' ); define( 'DB_PASSWORD', '' ); define( 'DB_HOST', '127.0.0.1' ); define( 'DB_CHARSET', 'utf8' ); define( 'DB_COLLATE', '' );

    $table_prefix = 'wp_';

    if ( ! defined( 'ABSPATH' ) ) define( 'ABSPATH', dirname( FILE ) . '/' );

    require_once ABSPATH . 'wp-settings.php'; * To serve the site I'm using PHP built-in server with the command:bash (cd /Users/luca/Sites/wordpress; php -S localhost:8080) `` * I can access the WordPress homepage athttp://localhost:8080and the administration area athttp://localhost:8080/wp-admin. * I've installed WordPress via its UI (http://localhost:8080/wp-admin), the administrator username isadmin, the administrator password ispassword. * I'm testing a plugin and that plugin is in the folder, relative to the WordPress root folder,wp-content/plugins/acme-plugin`.

With all the steps above done I can now move into the actual wp-browser configuration phase.

"},{"location":"v3/sponsors/","title":"Sponsors","text":"

I maintain the wp-browser project while working full-time as a freelance and dedicating my spare time to it. I do it with passion and for \"love of the craft,\" but it can become a chore at times.

Appreciation, the most common form of support, goes a long way but does not pay the bills. I want to dedicate more structured time to the project, and that would mean turning down some freelance work offers. To that end, I've applied for GitHub sponsorship system.

"},{"location":"v3/sponsors/#current-sponsors","title":"Current Sponsors","text":"

My sincere thanks to my sponsors: you make the above easier.

  • @BenBornschein
  • @Borlabs
  • @TimothyBJacobs
  • @bordoni
  • @borkweb
  • @dingo-d
  • @francescamarano
  • @jerclarke
  • @johnbillion
  • @joppuyo
  • @kkarpieszuk
  • @pods-framework
  • @roborourke
  • @wp-staging
  • @zackkatz
"},{"location":"v3/advanced/run-in-separate-process/","title":"Run in separate process","text":""},{"location":"v3/advanced/run-in-separate-process/#running-tests-in-separate-processes","title":"Running tests in separate processes","text":"

PHPUnit offers the possibility to run tests in a separate PHP process; Codeception does not officially support the option as of version 4.0.

The wp-browser project tries to fill that gap by supporting the @runInSeparateProcess annotation. This support comes with some caveats, though:

  1. The support is only for test cases extending the Codeception\\TestCase\\WPTestCase class (the base test case for integration or \"WordPress unit\" tests)
  2. The support wp-browser provides only supports the @preserveGlobalState annotation with the disabled value; this means there is no support for preserving global state between tests.

Read more about what this means in PHPUnit documentation.

"},{"location":"v3/advanced/run-in-separate-process/#why-run-tests-in-a-separate-php-process","title":"Why run tests in a separate PHP process?","text":"

One main reason: isolation.

What does \"isolation\" means?

Before answering that question, it's essential to understand, via an example, why a lack of isolation might be an issue.

I want to test the get_api function. The function will return the correct singleton instance of an API handling class: an instance of Api when the function is called in non-admin context, and an instance of AdminApi when the function is called in admin context. The get_api function is acting as a service locator.

<?php\nfunction get_api(){\n    static $api;\n\n    if(null !== $api){\n        return $api;\n    }\n\n    if( is_admin() ) {\n        $api = new Admin_Api();\n    } else {\n        $api = new Api();\n    }\n\n    return $api;\n}\n

There are two challenges to testing this function:

  1. The is_admin function, defined by WordPress, looks up a WP_ADMIN constant to know if the context of the current request is an administration UI one or not.
  2. The get_api function will check for the context and resolve and build the correct instance only once, the first time it's called in the context of a request.

There are some possible solutions to this problem:

a. Refactor the get_api function into a method of an Api_Factory object taking the context as a dependency, thus allowing injection of the \"context\" (which implies the creation of a Context adapter that will proxy its is_admin method to the is_admin function). You can find the code for such refactoring in the OOP refactoring of get_api section. b. Refactor the get_api function to accept the current is_admin value as an input argument, get_api( $is_admin ), this refactoring moves part of the complexity of getting hold of the correct instance of the API handler on the client code. Adding more build condition and checks, e.g., if the current request is a REST request or not or some tests on the user authorizations, then, requires adding more input arguments to the get_api function: the knowledge of the implementation of the get_api method will \"leak\" to the client code having to replicate complexity throughout the system.

I want to layout possible solutions to the problem to show there is always a design alternative to make code testable that might or might not fit the current time or scope constraint.

In this example, I've inherited the get_api function from the existing code, and it cannot be changed, yet I want to test it dealing with the two problems outlined above.

"},{"location":"v3/advanced/run-in-separate-process/#running-tests-in-separate-php-processes","title":"Running tests in separate PHP processes","text":"

To test the get_api function shown above I've created a new wpunit type of test:

vendor/bin/codecept g:wpunit integration \"api\"\n

The command scaffolds a test/integration/apiTest.php file that I've modified to ensure full coverage of the get_api function:

<?php\n\nclass apiTest extends \\Codeception\\TestCase\\WPTestCase\n{\n    public function test_get_api_exists()\n    {\n        $this->assertTrue(function_exists('get_api'));\n    }\n\n    public function test_get_api_will_cache()\n    {\n        $this->assertSame(get_api(), get_api());\n    }\n\n    /**\n     * @runInSeparateProcess\n     * @preserveGlobalState disabled\n     */\n    public function test_get_api_will_return_api_if_not_admin()\n    {\n        // Let's make sure we're NOT in admin context.\n        define('WP_ADMIN', false);\n\n        $api = get_api();\n\n        $this->assertInstanceOf(Api::class, $api);\n    }\n\n    /**\n     * @runInSeparateProcess\n     * @preserveGlobalState disabled\n     */\n    public function test_get_api_will_cache_api_if_not_admin()\n    {\n        // Let's make sure we're NOT in admin context.\n        define('WP_ADMIN', false);\n\n        $api = get_api();\n\n        $this->assertSame(get_api(), $api);\n    }\n\n    /**\n     * @runInSeparateProcess\n     * @preserveGlobalState disabled\n     */\n    public function test_get_api_will_return_api_if_is_admin()\n    {\n        // Let's make sure we're NOT in admin context.\n        define('WP_ADMIN', true);\n\n        $api = get_api();\n\n        $this->assertInstanceOf(AdminApi::class, $api);\n    }\n\n    /**\n     * @runInSeparateProcess\n     * @preserveGlobalState disabled\n     */\n    public function test_get_api_will_cache_api_if_is_admin()\n    {\n        // Let's make sure we're NOT in admin context.\n        define('WP_ADMIN', true);\n\n        $api = get_api();\n\n        $this->assertSame(get_api(), $api);\n    }\n}\n

Some pieces of this code are worth pointing out:

  1. There are two test methods, test_get_api_exists and test_get_api_will_cache that are not running in a separate process. Running tests in a separate process provide isolation at the cost of speed, only tests that require isolation should run in a separate PHP process.
  2. I instruct the Codeception and PHPUnit test runner to run a test method in a different process by adding two annotations that are both required precisely as shown: ```php /**
    • @runInSeparateProcess
    • @preserveGlobalState disabled */ ```
  3. The isolation part of this testing approach shines through when I define, in the last four tests, the WP_ADMIN constant multiple times. If I try to do that in test code running in the same PHP process, then the second define call would cause a fatal error.
  4. The isolation has also taken care of the second issue where the get_api function caches the $api instance after its first resolution in a static variable: since each test happens in a self-contained, dedicated PHP process, the static $api variable will be null at the start of each test.
"},{"location":"v3/advanced/run-in-separate-process/#can-i-run-some-tests-in-the-same-process-and-some-in-a-separate-process","title":"Can I run some tests in the same process and some in a separate process?","text":"

Yes. In the example test code in the previous section, the test_get_api_exists and test_get_api_will_cache test methods are not running in separate processes.

In your test cases extending the Codeception\\TestCase\\WPTestCase, you can mix test methods running in the primary PHP process and those running in a separate PHP process without issues.

"},{"location":"v3/advanced/run-in-separate-process/#oop-refactoring-of-get_api","title":"OOP refactoring of get_api","text":"

In the Why run tests in a separate PHP process? section I've outlined a possible refactoring of the get_api function to make it testable without requiring the use of separate PHP processes.

I'm providing this refactoring code below for the sake of completeness, the judgment of which approach is \"better\" is up to the reader.

<?php\n\nclass Context_Adapter{\n\n    public function is_admin(){\n        return \\is_admin();\n    }\n\n}\n\nclass Api_Factory{\n\n    private $api;\n    private $context;\n\n    public function __construct(Context_Adapter $context){\n        $this->context = $context;\n    }\n\n    public function getApi(){\n        if(null !== $this->api){\n            return $this->api;    \n        }\n\n        if($this->context->is_admin()){\n            $api = new Admin_Api;\n        } else {\n            $api = new Api;\n        }\n\n        return $api;\n    }\n}\n

Now the Api_Factory class can be injected by injecting a mocked Context_Adapter class, modifying the return value of the Context_Adapter::is_admin method.

Due to the supposed requirement of the API instance being a singleton, this solution will also require some container or service-locator to ensure at most only one instance of the Api_Factory exists at any given time in the context of a request.

"},{"location":"v3/migration/from-version-2-to-version-3/","title":"From version 2 to version 3","text":""},{"location":"v3/migration/from-version-2-to-version-3/#migrating-projects-from-version-2-of-wp-browser-to-version-3","title":"Migrating projects from version 2 of wp-browser to version 3","text":"

Version 3 of wp-browser removed, to allow for broader compatibility with PHP and Composer versions, some of its dependencies and modified some of its methods. Here is a list of changes and the suggested courses of action:

  • Removed symfony/process to launch and manage external processes; re-add it your project development requirements using composer require --dev symfony/process.
  • Removed the wp-cli/wp-cli-bundle dependency; if you were relying on non-core packages, then re-add it to your project development requirements using composer require --dev wp-cli/wp-cli-bundle.
  • Removed the WithWpCli::executeBackgroundWpCliCommand trait method, and, as a consequence, the WPCLI::executeBackgroundWpCliCommand module method; you could have used the latter, if this was the case, then require the symfony/process as explained above and launch processes in background using its API; find out more.
  • Refactored the WPCLI module to build and escape string command lines differently; the handling of command-line arguments for the WPCLI module has been modified to make it a bit more consistent and robust; as a consequence, you might experience some breakages in string commands that used to work correctly before; should this be the case then either modify your code to provide the command in array format (taking care of the correct escaping in your code), or make sure to pass a correctly structured command string to the WPCLI module.
"},{"location":"v3/modules/WPBrowser/","title":"WPBrowser module","text":"

This module should be used in acceptance and functional tests, see levels of testing for more information.

This module extends the PHPBrowser module adding WordPress-specific configuration parameters and methods.

The module simulates a user interaction with the site without Javascript support; if you need to test your project with Javascript support use the WPWebDriver module.

"},{"location":"v3/modules/WPBrowser/#module-requirements-for-codeception-40","title":"Module requirements for Codeception 4.0+","text":"

This module requires the codeception/module-phpbrowser Composer package to work when wp-browser is used with Codeception 4.0.

To install the package run:

composer require --dev codeception/module-phpbrowser:^1.0\n
"},{"location":"v3/modules/WPBrowser/#configuration","title":"Configuration","text":"

Since this module extends the PHPBrowser module provided by Codeception, please refer to the PHPBrowser configuration section for more information about the base configuration parameters.

  • url required - Start URL of your WordPress project, e.g. http://wp.test.
  • headers - Default headers are set before each test; this might be useful to simulate a specific user agent during the tests or to identify the request source. Note that the headers defined in the config should be prefaced with HTTP_ in your wp-config.php file. This can be used to select which database to use.
  • handler (default: curl) - The Guzzle handler to use. By default curl is used, also possible to pass stream, or any valid class name as Handler.
  • middleware - The Guzzle middlewares to add. An array of valid callables is required; see here for more information.
  • curl - curl options; only applied if using the curl handler; more options are available.
  • adminUsername required - This is the login name, not the \"nice\" name, of the administrator user of the WordPress test site. This will be used to fill the username field in WordPress login page.
  • adminPassword required - This is the the password of the administrator use of the WordPress test site. This will be used to fill the password in WordPress login page.
  • adminPath required - The path, relative to the WordPress test site home URL, to the administration area, usually /wp-admin.
"},{"location":"v3/modules/WPBrowser/#example-configuration","title":"Example configuration","text":"
  modules:\n      enabled:\n          - WPBrowser\n      config:\n          WPBrowser:\n              url: 'http://wordpress.localhost'\n              adminUsername: 'admin'\n              adminPassword: 'password'\n              adminPath: '/wp-admin'\n              headers:\n                X_TEST_REQUEST: 1\n                X_WPBROWSER_REQUEST: 1\n

Read here how to use the headers information to automatically change the database during acceptance and functional tests.

"},{"location":"v3/modules/WPBrowser/#public-api","title":"Public API","text":"
  • activatePlugin
  • amEditingPostWithId
  • amOnAdminAjaxPage
  • amOnAdminPage
  • amOnCronPage
  • amOnPagesPage
  • amOnPluginsPage
  • deactivatePlugin
  • dontSeePluginInstalled
  • grabCookiesWithPattern
  • grabWordPressTestCookie
  • logOut
  • loginAs
  • loginAsAdmin
  • seeErrorMessage
  • seeMessage
  • seePluginActivated
  • seePluginDeactivated
  • seePluginInstalled
  • seeWpDiePage
activatePlugin

In the plugin administration screen activates a plugin clicking the \"Activate\" link. The method will not handle authentication to the admin area.

// Activate a plugin.\n  $I->loginAsAdmin();\n  $I->amOnPluginsPage();\n  $I->activatePlugin('hello-dolly');\n  // Activate a list of plugins.\n  $I->loginAsAdmin();\n  $I->amOnPluginsPage();\n  $I->activatePlugin(['hello-dolly','another-plugin']);\n
Parameters
  • string/\\Codeception\\Module\\array $pluginSlug - The plugin slug, like \"hello-dolly\" or a list of plugin slugs. amEditingPostWithId

    Go to the admin page to edit the post with the specified ID. The method will not handle authentication the admin area.

    $I->loginAsAdmin();\n  $postId = $I->havePostInDatabase();\n  $I->amEditingPostWithId($postId);\n  $I->fillField('post_title', 'Post title');\n
    Parameters
    • int $id - The post ID.
    amOnAdminAjaxPage

    Go to the admin-ajax.php page to start a synchronous, and blocking, GET AJAX request. The method will not handle authentication, nonces or authorization.

    $I->amOnAdminAjaxPage(['action' => 'my-action', 'data' => ['id' => 23], 'nonce' => $nonce]);\n
    Parameters
    • string/\\Codeception\\Module\\array $queryVars - A string or array of query variables to append to the AJAX path. amOnAdminPage

      Go to a page in the admininstration area of the site. This method will not handle authentication to the administration area.

      $I->loginAs('user', 'password');\n  // Go to the plugins management screen.\n  $I->amOnAdminPage('/plugins.php');\n
      Parameters
      • string $page - The path, relative to the admin area URL, to the page.
      amOnCronPage

      Go to the cron page to start a synchronous, and blocking, GET request to the cron script.

      // Triggers the cron job with an optional query argument.\n  $I->amOnCronPage('/?some-query-var=some-value');\n
      Parameters
      • string/\\Codeception\\Module\\array $queryVars - A string or array of query variables to append to the AJAX path. amOnPagesPage

        Go the \"Pages\" administration screen. The method will not handle authentication.

        $I->loginAsAdmin();\n  $I->amOnPagesPage();\n  $I->see('Add New');\n
        amOnPluginsPage

        Go to the plugins administration screen. The method will not handle authentication.

        $I->loginAsAdmin();\n  $I->amOnPluginsPage();\n  $I->activatePlugin('hello-dolly');\n
        deactivatePlugin

        In the plugin administration screen deactivate a plugin clicking the \"Deactivate\" link. The method will not handle authentication and navigation to the plugins administration page.

        // Deactivate one plugin.\n  $I->loginAsAdmin();\n  $I->amOnPluginsPage();\n  $I->deactivatePlugin('hello-dolly');\n  // Deactivate a list of plugins.\n  $I->loginAsAdmin();\n  $I->amOnPluginsPage();\n  $I->deactivatePlugin(['hello-dolly', 'my-plugin']);\n
        Parameters
        • string/\\Codeception\\Module\\array $pluginSlug - The plugin slug, like \"hello-dolly\", or a list of plugin slugs. dontSeePluginInstalled

          Assert a plugin is not installed in the plugins administration screen. The method will not handle authentication and navigation to the plugin administration screen.

          $I->loginAsAdmin();\n  $I->amOnPluginsPage();\n  $I->dontSeePluginInstalled('my-plugin');\n
          Parameters
          • string $pluginSlug - The plugin slug, like \"hello-dolly\".
          grabCookiesWithPattern

          Returns all the cookies whose name matches a regex pattern.

          $I->loginAs('customer','password');\n  $I->amOnPage('/shop');\n  $cartCookies = $I->grabCookiesWithPattern(\"#^shop_cart\\\\.*#\");\n
          Parameters
          • string $cookiePattern - The regular expression pattern to use for the matching.
          grabWordPressTestCookie

          Returns WordPress default test cookie object if present.

          // Grab the default WordPress test cookie.\n  $wpTestCookie = $I->grabWordPressTestCookie();\n  // Grab a customized version of the test cookie.\n  $myTestCookie = $I->grabWordPressTestCookie('my_test_cookie');\n
          Parameters
          • string $name - Optional, overrides the default cookie name.
          logOut

          Navigate to the default WordPress logout page and click the logout link.

          // Log out using the `wp-login.php` form and return to the current page.\n  $I->logOut(true);\n  // Log out using the `wp-login.php` form and remain there.\n  $I->logOut(false);\n  // Log out using the `wp-login.php` form and move to another page.\n  $I->logOut('/some-other-page');\n
          Parameters
          • bool/bool/string $redirectTo - Whether to redirect to another (optionally specified) page after the logout.
          loginAs

          Login as the specified user. The method will not follow redirection, after the login, to any page.

          $I->loginAs('user', 'password');\n  $I->amOnAdminPage('/');\n  $I->see('Dashboard');\n
          Parameters
          • string $username - The user login name.
          • string $password - The user password in plain text.
          loginAsAdmin

          Login as the administrator user using the credentials specified in the module configuration. The method will not follow redirection, after the login, to any page.

          $I->loginAsAdmin();\n  $I->amOnAdminPage('/');\n  $I->see('Dashboard');\n
          seeErrorMessage

          In an administration screen look for an error admin notice. The check is class-based to decouple from internationalization. The method will not handle authentication and navigation the administration area. .notice.notice-error ones.

          $I->loginAsAdmin()\n  $I->amOnAdminPage('/');\n  $I->seeErrorMessage('.my-plugin');\n
          Parameters
          • string/string/\\Codeception\\Module\\array $classes - A list of classes the notice should have other than the seeMessage

            In an administration screen look for an admin notice. The check is class-based to decouple from internationalization. The method will not handle authentication and navigation the administration area.

            $I->loginAsAdmin()\n  $I->amOnAdminPage('/');\n  $I->seeMessage('.missing-api-token.my-plugin');\n
            Parameters
            • string/\\Codeception\\Module\\array/string $classes - A list of classes the message should have in addition to the .notice one. seePluginActivated

              Assert a plugin is activated in the plugin administration screen. The method will not handle authentication and navigation to the plugin administration screen.

              $I->loginAsAdmin();\n  $I->amOnPluginsPage();\n  $I->seePluginActivated('my-plugin');\n
              Parameters
              • string $pluginSlug - The plugin slug, like \"hello-dolly\".
              seePluginDeactivated

              Assert a plugin is not activated in the plugins administration screen. The method will not handle authentication and navigation to the plugin administration screen.

              $I->loginAsAdmin();\n  $I->amOnPluginsPage();\n  $I->seePluginDeactivated('my-plugin');\n
              Parameters
              • string $pluginSlug - The plugin slug, like \"hello-dolly\".
              seePluginInstalled

              Assert a plugin is installed, no matter its activation status, in the plugin administration screen. The method will not handle authentication and navigation to the plugin administration screen.

              $I->loginAsAdmin();\n  $I->amOnPluginsPage();\n  $I->seePluginInstalled('my-plugin');\n
              Parameters
              • string $pluginSlug - The plugin slug, like \"hello-dolly\".
              seeWpDiePage

              Checks that the current page is one generated by the wp_die function. The method will try to identify the page based on the default WordPress die page HTML attributes.

              $I->loginAs('user', 'password');\n  $I->amOnAdminPage('/forbidden');\n  $I->seeWpDiePage();\n

              This class extends \\Codeception\\Module\\PhpBrowser

              This class implements \\Codeception\\Lib\\Interfaces\\MultiSession, \\Codeception\\Lib\\Interfaces\\Remote, \\Codeception\\Lib\\Interfaces\\Web, \\Codeception\\Lib\\Interfaces\\PageSourceSaver, \\Codeception\\Lib\\Interfaces\\ElementLocator, \\Codeception\\Lib\\Interfaces\\ConflictsWithModule

              "},{"location":"v3/modules/WPCLI/","title":"WPCLI module","text":"

              This module should be used in acceptance and functional tests to setup, or verify, tests pre and post conditions using WP-CLI commands. This module allows invoking WP-CLI commands, refer to the official site for more information.

              The module will use its own version of WP-CLI, not the one installed in the machine running the tests!

              By default, wp-browser will only include the wp-cli/wp-cli package; this package contains the basic files to run WP-CLI and does not contain all the commands that come with a typical wp-cli installation. If, in your tests, you require all the commands that usually come installed with WP-CLI, then you should require the wp-cli/wp-cli-bundle package as a development dependency of your project, see below.

              "},{"location":"v3/modules/WPCLI/#fixing-not-a-registered-command-issue","title":"Fixing \"not a registered command\" issue","text":"

              To keep the conflicts at a manageable level, the wp-browser project does not include all the commands WP-CLI usually comes bundled with. Running, in the context of an automated test, a WP-CLI command that would work on your machine, e.g. wp plugin list --status=active, will not work on a default installation of wp-browser and you will get the following error message:

              [ModuleException] WPCLI: wp-cli terminated with status [1] and output [Error: 'plugin' is not a registered wp command. See 'wp help' for available commands.]\n

              To resolve the message just add the package you require as a development dependency or add the whole WP-CLI bundle:

              composer require --dev wp-cli/wp-cli-bundle\n

              The package will make all the default WP-CLI commands available to the WP-CLI version used in tests.

              "},{"location":"v3/modules/WPCLI/#module-requirements-for-codeception-40","title":"Module requirements for Codeception 4.0+","text":"

              This module requires the codeception/module-cli Composer package to work when wp-browser is used with Codeception 4.0.

              To install the package run:

              composer require --dev codeception/module-cli:^1.0\n
              "},{"location":"v3/modules/WPCLI/#detecting-requests-coming-from-this-module","title":"Detecting requests coming from this module","text":"

              When it runs this module will set the WPBROWSER_HOST_REQUEST environment variable. You can detect and use that information to, as an example, use the correct database in your test site wp-config.php file:

              <?php\nif ( \n    // Custom header.\n    isset( $_SERVER['HTTP_X_TESTING'] )\n    // Custom user agent.\n    || ( isset( $_SERVER['HTTP_USER_AGENT'] ) && $_SERVER['HTTP_USER_AGENT'] === 'wp-browser' )\n    // The env var set by the WPClIr or WordPress modules.\n    || getenv( 'WPBROWSER_HOST_REQUEST' )\n) {\n    // Use the test database if the request comes from a test.\n    define( 'DB_NAME', 'wordpress_test' );\n} else {\n    // Else use the default one.\n    define( 'DB_NAME', 'wordpress' );\n}\n
              "},{"location":"v3/modules/WPCLI/#configuration","title":"Configuration","text":"
              • path required - the absolute, or relative, path to the WordPress root folder. This will be mapped to the --path argument of the wp-cli binary.
              • throw - defaults to true to throw an exception when a wp-cli command does not return an exit status of 0; if set to false then the exit status of the commands will be returned as is.
              • timeout - defaults to 60 (seconds) to set each process execution timeout to a certain value; set to null, false or 0 to disable timeout completely.

              Additionally the module configuration will forward any configuration parameter to wp-cli as a flag or option. In the example configuration below the allow-root flag and the some-option option will be passed to wp-cli directly and prepended to the command as global options.

              Note: these extract configuration flags and options will be prepended to all commands executed by wp-cli!

              "},{"location":"v3/modules/WPCLI/#environment-configuration","title":"Environment configuration","text":"

              The wp-cli binary supports a set of environment variables to modify its behavior.

              These environment variables can be set on the commands ran by the WPCLI module using the optional env array in the module configuration. The example configuration below shows all of them with some example values. Most of the times you won't need any of these, but they are there for more fine-grained control over the module operations.

              The module is not validating the environment variables in any way! Those values will be evaluated by wp-cli at runtime and might generate errors if not correctly configured.

              "},{"location":"v3/modules/WPCLI/#example-configuration","title":"Example configuration","text":"
              modules:\n    enabled:\n        - WPCLI\n    config:\n        WPCLI:\n            path: /Users/Luca/Sites/wp\n            throw: true\n            timeout: 60\n            # This will be prepended to the command, `wp --allow-root <command>`.\n            allow-root: true\n            # This will be prepended to the command, `wp --some-option=some-value <command>`.\n            some-option: some-value\n            env:\n                # Any one of these, if provided, will be set as environment variable for the the cli command process. \n                # See https://make.wordpress.org/cli/handbook/config/#environment-variables for information.\n                # Equivalent to `WP_CLI_STRICT_ARGS_MODE=1 wp <command>'.\n                strict-args: true\n                # Equivalent to `WP_CLI_CACHE_DIR=/tmp/wp-cli-cache wp <command>'.\n                cache-dir: '/tmp/wp-cli-cache'\n                # Equivalent to `WP_CLI_CONFIG_PATH=/app/public wp <command>'.\n                config-path: '/app/public'\n                # Equivalent to `WP_CLI_CUSTOM_SHELL=/bin/zsh wp <command>'.\n                custom-shell: '/bin/zsh'\n                # Equivalent to `WP_CLI_DISABLE_AUTO_CHECK_UPDATE=1 wp <command>'.\n                disable-auto-update: true\n                # Equivalent to `WP_CLI_PACKAGES_DIR=/wp-cli/packages wp <command>'.\n                packages-dir: '/wp-cli/packages'\n                # Equivalent to `WP_CLI_PHP=/usr/local/bin/php/7.2/php wp <command>'.\n                php: '/usr/local/bin/php/7.2/php'\n                # Equivalent to `WP_CLI_PHP_ARGS='foo=bar some=23' wp <command>'.\n                php-args: 'foo=bar some=23'\n
              "},{"location":"v3/modules/WPCLI/#public-api","title":"Public API","text":"
              • buildFullCommand
              • cli
              • cliToArray
              • cliToString
              • dontSeeInShellOutput
              • seeInShellOutput
              • seeResultCodeIs
              • seeResultCodeIsNot
              • seeShellOutputMatches
              buildFullCommand

              Builds the full command to run including the PHP binary and the wp-cli boot file path.

              // This method is defined in the WithWpCli trait.\n  // Set the wp-cli path, `$this` is a test case.\n  $this->setUpWpCli( '/var/www/html' );\n  // Builds the full wp-cli command, including the `path` variable.\n  $fullCommand =  $this->buildFullCommand(['core', 'version']);\n  // The full command can then be used to run it with another process handler.\n  $wpCliProcess = new Process($fullCommand);\n  $wpCliProcess->run();\n
              Parameters
              • \\Codeception\\Module\\array/string $command - The command to run. cli

                Executes a wp-cli command targeting the test WordPress installation. minus wp. For back-compatibility purposes you can still pass the commandline as a string, but the array format is the preferred and supported method.

                // Activate a plugin via wp-cli in the test WordPress site.\n  $I->cli(['plugin', 'activate', 'my-plugin']);\n  // Change a user password.\n  $I->cli(['user', 'update', 'luca', '--user_pass=newpassword']);\n
                Parameters
                • string/string/\\Codeception\\Module\\array $userCommand - The string of command and parameters as it would be passed to wp-cli cliToArray

                  Returns the output of a wp-cli command as an array optionally allowing a callback to process the output. minus wp. For back-compatibility purposes you can still pass the commandline as a string, but the array format is the preferred and supported method.

                  // Return a list of inactive themes, like ['twentyfourteen', 'twentyfifteen'].\n  $inactiveThemes = $I->cliToArray(['theme', 'list', '--status=inactive', '--field=name']);\n  // Get the list of installed plugins and only keep the ones starting with \"foo\".\n  $fooPlugins = $I->cliToArray(['plugin', 'list', '--field=name'], function($output){\n  return array_filter(explode(PHP_EOL, $output), function($name){\n  return strpos(trim($name), 'foo') === 0;\n  });\n  });\n
                  Parameters
                  • string/string/\\Codeception\\Module\\array $userCommand - The string of command and parameters as it would be passed to wp-cli
                  • \\callable $splitCallback - An optional callback function to split the results array.
                  • cliToString

                    Returns the output of a wp-cli command as a string. minus wp. For back-compatibility purposes you can still pass the commandline as a string, but the array format is the preferred and supported method.

                    // Return the current site administrator email, using string command format.\n  $adminEmail = $I->cliToString('option get admin_email');\n  // Get the list of active plugins in JSON format, two ways.\n  $activePlugins = $I->cliToString(['plugin', 'list','--status=active', '--format=json']);\n  $activePlugins = $I->cliToString(['option', 'get', 'active_plugins' ,'--format=json']);\n
                    Parameters
                    • string/\\Codeception\\Module\\array $userCommand - The string of command and parameters as it would be passed to wp-cli dontSeeInShellOutput

                      Checks that output from last command doesn't contain text.

                      // Return the current site administrator email, using string command format.\n  $I->cli('plugin list --status=active');\n  $I->dontSeeInShellOutput('my-inactive/plugin.php');\n
                      Parameters
                      • string $text - The text to assert is not in the output.
                      seeInShellOutput

                      Checks that output from last command contains text.

                      // Return the current site administrator email, using string command format.\n  $I->cli('option get admin_email');\n
                      Parameters
                      • string $text - The text to assert is in the output.
                      seeResultCodeIs

                      Checks the result code from the last command.

                      // Return the current site administrator email, using string command format.\n  $I->cli('option get admin_email');\n  $I->seeResultCodeIs(0);\n
                      Parameters
                      • int $code - The desired result code.
                      seeResultCodeIsNot

                      Checks the result code from the last command.

                      // Return the current site administrator email, using string command format.\n  $I->cli('invalid command');\n  $I->seeResultCodeIsNot(0);\n
                      Parameters
                      • int $code - The result code the command should not have exited with.
                      seeShellOutputMatches

                      Checks that output from the last command matches a given regular expression.

                      // Return the current site administrator email, using string command format.\n  $I->cli('option get admin_email');\n
                      Parameters
                      • string $regex - The regex pattern, including delimiters, to assert the output matches against.

                      This class extends \\Codeception\\Module

                      "},{"location":"v3/modules/WPDb/","title":"WPDb module","text":"

                      This module should be used in acceptance and functional tests, see levels of testing for more information. This module extends the Db module adding WordPress-specific configuration parameters and methods. The module provides methods to read, write and update the WordPress database directly, without relying on WordPress methods, using WordPress functions or triggering WordPress filters.

                      "},{"location":"v3/modules/WPDb/#module-requirements-for-codeception-40","title":"Module requirements for Codeception 4.0+","text":"

                      This module requires the codeception/module-db Composer package to work when wp-browser is used with Codeception 4.0.

                      To install the package run:

                      composer require --dev codeception/module-db:^1.0\n
                      "},{"location":"v3/modules/WPDb/#backup-your-content","title":"Backup your content","text":"

                      This module, like the Codeception Db one it extends, by default will load a database dump in the database it's using. This means that the database contents will be replaced by the dump contents on each run of a suite using the module. You can set the populate and cleanup parameters to false to prevent this default behavior but it's usually not what you need in an automated test. Make a backup of any database you're using in tests that contains any information you care about before you run any test!

                      "},{"location":"v3/modules/WPDb/#change-the-database-used-depending-on-whether-your-running-tests-or-not","title":"Change the database used depending on whether you're running tests or not","text":"

                      The chore of having to plug different databases, or backup them, depending on whether you're manually testing the site or automatically testing can be mitigated switching them automatically depending on the browser user agent or request headers. This module was born to be used in acceptance and functional tests (see levels of testing for more information) and will often be coupled with modules like the WPBrowser one or the WPWebDriver one. Depending on which of the two modules is being used in the suite there are different ways to automate the \"database switching\".

                      "},{"location":"v3/modules/WPDb/#automatically-changing-database-based-on-the-browser-user-agent","title":"Automatically changing database based on the browser user agent","text":"

                      If you would like to automate the \"switching above\" below you will find an example setup. Update the test site wp-config.php file from this:

                      define( 'DB_NAME', 'wordpress' );\n

                      to this:

                      <?php\nif ( \n    // Custom header.\n    isset( $_SERVER['HTTP_X_TESTING'] )\n    // Custom user agent.\n    || ( isset( $_SERVER['HTTP_USER_AGENT'] ) && $_SERVER['HTTP_USER_AGENT'] === 'wp-browser' )\n    // The env var set by the WPClIr or WordPress modules.\n    || getenv( 'WPBROWSER_HOST_REQUEST' )\n) {\n    // Use the test database if the request comes from a test.\n    define( 'DB_NAME', 'wordpress_test' );\n} else {\n    // Else use the default one.\n    define( 'DB_NAME', 'wordpress' );\n}\n

                      If you're using the WPWebDriver module set the user agent in the browser, in this example I'm setting the user agent in Chromedriver:

                      class_name: AcceptanceTester\nmodules:\n    enabled:\n        - \\Helper\\Acceptance\n        - WPDb\n        - WPWebDriver\n    config:\n        WPDb:\n            dsn: 'mysql:host=%WP_DB_HOST%;dbname=%WP_DB_NAME%'\n            user: %WP_DB_USER%\n            password: %WP_DB_PASSWORD%\n            dump: tests/_data/dump.sql\n            populate: true\n            cleanup: false\n            url: '%WP_URL%'\n            tablePrefix: %WP_TABLE_PREFIX%\n            urlReplacement: true\n        WPWebDriver:\n            url: '%WP_URL%'\n            adminUsername: '%WP_ADMIN_USERNAME%'\n            adminPassword: '%WP_ADMIN_PASSWORD%'\n            adminPath: '%WP_ADMIN_PATH%'\n            browser: chrome\n            host: localhost\n            port: 4444\n            window_size: false\n            wait: 5\n            capabilities:\n                # Used in more recent releases of Selenium.\n                \"goog:chromeOptions\":\n                    args: [\"--no-sandbox\", \"--headless\", \"--disable-gpu\", \"--user-agent=wp-browser\"]\n                # Support the old format for back-compatibility purposes. \n                \"chromeOptions\":\n                    args: [\"--no-sandbox\", \"--headless\", \"--disable-gpu\", \"--user-agent=wp-browser\"]\n

                      If you're using the WPBrowser module send a specific header in the context of test requests:

                      class_name: AcceptanceTester\nmodules:\n    enabled:\n        - \\Helper\\Acceptance\n        - WPDb\n        - WPBrowser\n    config:\n        WPDb:\n              dsn: 'mysql:host=%DB_HOST%;dbname=%WP_DB_NAME%'\n              user: %WP_DB_USER%\n              password: %WP_DB_PASSWORD%\n              dump: 'tests/_data/dump.sql'\n              populate: true\n              cleanup: true\n              reconnect: false\n              url: '%WP_URL%'\n              tablePrefix: 'wp_'\n        WPBrowser:\n              url: '%WP_URL%'\n              adminUsername: 'admin'\n              adminPassword: 'admin'\n              adminPath: '/wp-admin'\n              headers: \n                X-Testing: 'wp-browser'\n
                      "},{"location":"v3/modules/WPDb/#configuration","title":"Configuration","text":"
                      • dsn required - the database POD DSN connection details; read more on PHP PDO documentation. If the database is accessible (as is the case on the latest version of [Local by Flywheel][http://localwp.com]) via unix socket, then the string to insert here should look like this mysql:unix_socket=/path/to/the/mysql.sock;dbname=wordpress.
                      • user required - the database user.
                      • password required - the database password.
                      • url required - the full URL, including the HTTP scheme, of the website whose database is being accessed. WordPress uses hard-codece URLs in the database, that URL will be set by this module when applying the SQL dump file during population or cleanup.
                      • dump required - defaults to null; sets the path, relative to the project root folder, or absolute to the SQL dump file that will be used to set the tests initial database fixture. If set to null then the populate, cleanup and populator parameters will be ignored.
                      • populate - defaults to true to empty the target database and import the SQL dump(s) specified in the dump argument before the test suite is started.
                      • cleanup - defaults to true empty the target database and import the SQL dump(s) specified in the dump argument before each test.
                      • urlReplacement - defaults to true to replace, while using the built-in, PHP-based, dump import solution the hard-coded WordPress URL in the database with the specified one.
                      • originalUrl - specifies the original URL hard-coded into the version controlled SQL dump files. This can help prevent some URL replacement issues when the urlReplacement configuration parameter is set to true.
                      • populator - defaults to null, if set to an executable shell command then that command will be used to populate the database in place of the built-in PHP solution; URL replacement will not apply in this case. Read more about this on Codeception documentation.
                      • reconnect - defaults to true to force the module to reconnect to the database before each test in place of only connecting at the start of the tests.
                      • waitlock - defaults to 10; wait lock (in seconds) that the database session should use for DDL statements.
                      • tablePrefix - defaults to wp_; sets the prefix of the tables that the module will manipulate.
                      • letAdminEmailVerification - defaults to an empty value to remove the Administrator Email Verification screen introduced in WordPress 5.3. Set to true to not remove the screen and show it when an administrator user first logs in.
                      • letCron - defaults to an empty value to avoid wp-cron from being spawned during tests. Setting this to true will let wp-cron requests to fire during tests.
                      "},{"location":"v3/modules/WPDb/#example-configuration","title":"Example configuration","text":"
                      modules:\n  enabled:\n      - WPDb\n  config:\n      WPDb:\n          dsn: 'mysql:host=localhost;dbname=wordpress'\n          user: 'root'\n          password: 'password'\n          dump: 'tests/_data/dump.sql'\n          populate: true\n          cleanup: true\n          waitlock: 10\n          url: 'http://wordpress.localhost'\n          urlReplacement: true\n          tablePrefix: 'wp_'\n
                      "},{"location":"v3/modules/WPDb/#using-the-module-with-the-wploader-one","title":"Using the module with the WPLoader one","text":"

                      This module is often used in conjunction with the WPLoader one to use WordPress-defined functions, classes and methods in acceptance or functional tests. The WPLoader module should be set to only load WordPress and this module should be listed, in the modules.enabled section of the suite configuration file before the WPLoader one:

                      modules:\n  enabled:\n      - WPDb # this before...\n      - WPLoader # ...this one.\n  config:\n      WPDb:\n        # ...\n      WPLoader:\n        loadOnly: true\n        # ... \n

                      This will avoid issues where the WPLoader module could exit, terminating the test run, due to an inconsistent database state.

                      "},{"location":"v3/modules/WPDb/#public-api","title":"Public API","text":"
                      • countRowsInDatabase
                      • dontHaveAttachmentFilesInDatabase
                      • dontHaveAttachmentInDatabase
                      • dontHaveBlogInDatabase
                      • dontHaveCommentInDatabase
                      • dontHaveCommentMetaInDatabase
                      • dontHaveInDatabase
                      • dontHaveLinkInDatabase
                      • dontHaveOptionInDatabase
                      • dontHavePostInDatabase
                      • dontHavePostMetaInDatabase
                      • dontHavePostThumbnailInDatabase
                      • dontHaveSiteOptionInDatabase
                      • dontHaveSiteTransientInDatabase
                      • dontHaveTableInDatabase
                      • dontHaveTermInDatabase
                      • dontHaveTermMetaInDatabase
                      • dontHaveTermRelationshipInDatabase
                      • dontHaveTermTaxonomyInDatabase
                      • dontHaveTransientInDatabase
                      • dontHaveUserInDatabase
                      • dontHaveUserInDatabaseWithEmail
                      • dontHaveUserMetaInDatabase
                      • dontSeeAttachmentInDatabase
                      • dontSeeBlogInDatabase
                      • dontSeeCommentInDatabase
                      • dontSeeCommentMetaInDatabase
                      • dontSeeLinkInDatabase
                      • dontSeeOptionInDatabase
                      • dontSeePageInDatabase
                      • dontSeePostInDatabase
                      • dontSeePostMetaInDatabase
                      • dontSeePostWithTermInDatabase
                      • dontSeeSiteOptionInDatabase
                      • dontSeeTableInDatabase
                      • dontSeeTermInDatabase
                      • dontSeeTermMetaInDatabase
                      • dontSeeTermTaxonomyInDatabase
                      • dontSeeUserInDatabase
                      • dontSeeUserMetaInDatabase
                      • getSiteDomain
                      • getUsersTableName
                      • grabAllFromDatabase
                      • grabAttachmentAttachedFile
                      • grabAttachmentMetadata
                      • grabBlogDomain
                      • grabBlogPath
                      • grabBlogTableName
                      • grabBlogTableNames
                      • grabBlogTablePrefix
                      • grabBlogVersionsTableName
                      • grabBlogsTableName
                      • grabCommentmetaTableName
                      • grabCommentsTableName
                      • grabLatestEntryByFromDatabase
                      • grabLinksTableName
                      • grabOptionFromDatabase
                      • grabPostMetaFromDatabase
                      • grabPostmetaTableName
                      • grabPostsTableName
                      • grabPrefixedTableNameFor
                      • grabRegistrationLogTableName
                      • grabSignupsTableName
                      • grabSiteMetaTableName
                      • grabSiteOptionFromDatabase
                      • grabSiteTableName
                      • grabSiteTransientFromDatabase
                      • grabSiteUrl
                      • grabTablePrefix
                      • grabTermIdFromDatabase
                      • grabTermMetaTableName
                      • grabTermRelationshipsTableName
                      • grabTermTaxonomyIdFromDatabase
                      • grabTermTaxonomyTableName
                      • grabTermsTableName
                      • grabUserIdFromDatabase
                      • grabUserMetaFromDatabase
                      • grabUsermetaTableName
                      • grabUsersTableName
                      • haveAttachmentInDatabase
                      • haveBlogInDatabase
                      • haveCommentInDatabase
                      • haveCommentMetaInDatabase
                      • haveLinkInDatabase
                      • haveManyBlogsInDatabase
                      • haveManyCommentsInDatabase
                      • haveManyLinksInDatabase
                      • haveManyPostsInDatabase
                      • haveManyTermsInDatabase
                      • haveManyUsersInDatabase
                      • haveMenuInDatabase
                      • haveMenuItemInDatabase
                      • haveOptionInDatabase
                      • havePageInDatabase
                      • havePostInDatabase
                      • havePostThumbnailInDatabase
                      • havePostmetaInDatabase
                      • haveSiteOptionInDatabase
                      • haveSiteTransientInDatabase
                      • haveTermInDatabase
                      • haveTermMetaInDatabase
                      • haveTermRelationshipInDatabase
                      • haveTransientInDatabase
                      • haveUserCapabilitiesInDatabase
                      • haveUserInDatabase
                      • haveUserLevelsInDatabase
                      • haveUserMetaInDatabase
                      • importSql
                      • importSqlDumpFile
                      • seeAttachmentInDatabase
                      • seeBlogInDatabase
                      • seeCommentInDatabase
                      • seeCommentMetaInDatabase
                      • seeLinkInDatabase
                      • seeOptionInDatabase
                      • seePageInDatabase
                      • seePostInDatabase
                      • seePostMetaInDatabase
                      • seePostWithTermInDatabase
                      • seeSiteOptionInDatabase
                      • seeSiteSiteTransientInDatabase
                      • seeTableInDatabase
                      • seeTermInDatabase
                      • seeTermMetaInDatabase
                      • seeTermRelationshipInDatabase
                      • seeTermTaxonomyInDatabase
                      • seeUserInDatabase
                      • seeUserMetaInDatabase
                      • useBlog
                      • useMainBlog
                      • useTheme
                      countRowsInDatabase

                      Returns the number of table rows matching a criteria.

                      $I->haveManyPostsInDatabase(3, ['post_status' => 'draft' ]);\n  $I->haveManyPostsInDatabase(3, ['post_status' => 'private' ]);\n  // Make sure there are now the expected number of draft posts.\n  $postsTable = $I->grabPostsTableName();\n  $draftsCount = $I->countRowsInDatabase($postsTable, ['post_status' => 'draft']);\n
                      Parameters
                      • string $table - The table to count the rows in.
                      • array/\\Codeception\\Module\\array/array $criteria - Search criteria, if empty all table rows will be counted. dontHaveAttachmentFilesInDatabase

                        Removes all the files attached with an attachment post, it will not remove the database entries. Requires the WPFilesystem module to be loaded in the suite.

                        $posts = $I->grabPostsTableName();\n  $attachmentIds = $I->grabColumnFromDatabase($posts, 'ID', ['post_type' => 'attachment']);\n  // This will only remove the files, not the database entries.\n  $I->dontHaveAttachmentFilesInDatabase($attachmentIds);\n
                        Parameters
                        • \\Codeception\\Module\\array/int $attachmentIds - An attachment post ID or an array of attachment post IDs. dontHaveAttachmentInDatabase

                          Removes an attachment from the posts table. table. the suite.

                          $postmeta = $I->grabpostmetatablename();\n  $thumbnailId = $I->grabFromDatabase($postmeta, 'meta_value', [\n  'post_id' => $id,\n  'meta_key'=>'thumbnail_id'\n  ]);\n  // Remove only the database entry (including postmeta) but not the files.\n  $I->dontHaveAttachmentInDatabase($thumbnailId);\n  // Remove the database entry (including postmeta) and the files.\n  $I->dontHaveAttachmentInDatabase($thumbnailId, true, true);\n
                          Parameters
                          • \\Codeception\\Module\\array/array $criteria - An array of search criteria to find the attachment post in the posts
                          • bool $purgeMeta - If set to true then the meta for the attachment will be purged too.
                          • bool $removeFiles - Remove all files too, requires the WPFilesystem module to be loaded in
                          • dontHaveBlogInDatabase

                            Removes one ore more blogs from the database.

                            // Remove the blog, all its tables and files.\n  $I->dontHaveBlogInDatabase(['path' => 'test/one']);\n  // Remove the blog entry, not the tables though.\n  $I->dontHaveBlogInDatabase(['blog_id' => $blogId]);\n  // Remove multiple blogs.\n  $I->dontHaveBlogInDatabase(['domain' => 'test']);\n
                            Parameters
                            • \\Codeception\\Module\\array/array $criteria - An array of search criteria to find the blog rows in the blogs table.
                            • bool $removeTables - Remove the blog tables.
                            • bool $removeUploads - Remove the blog uploads; requires the WPFilesystem module.
                            • dontHaveCommentInDatabase

                              Removes an entry from the comments table.

                              $I->dontHaveCommentInDatabase(['comment_post_ID' => 23, 'comment_url' => 'http://example.copm']);\n
                              Parameters
                              • \\Codeception\\Module\\array/array $criteria - An array of search criteria.
                              • bool $purgeMeta - If set to true then the meta for the comment will be purged too.
                              • dontHaveCommentMetaInDatabase

                                Removes a post comment meta from the database

                                // Remove all meta for the comment with an ID of 23.\n  $I->dontHaveCommentMetaInDatabase(['comment_id' => 23]);\n  // Remove the `count` comment meta for the comment with an ID of 23.\n  $I->dontHaveCommentMetaInDatabase(['comment_id' => 23, 'meta_key' => 'count']);\n
                                Parameters
                                • \\Codeception\\Module\\array/array $criteria - An array of search criteria. dontHaveInDatabase

                                  Deletes a database entry. criteria.

                                  $I->dontHaveInDatabase('custom_table', ['book_ID' => 23, 'book_genre' => 'fiction']);\n
                                  Parameters
                                  • string $table - The table name.
                                  • \\Codeception\\Module\\array/array $criteria - An associative array of the column names and values to use as deletion dontHaveLinkInDatabase

                                    Removes a link from the database.

                                    $I->dontHaveLinkInDatabase(['link_url' => 'http://example.com']);\n
                                    Parameters
                                    • \\Codeception\\Module\\array/array $criteria - An array of search criteria. dontHaveOptionInDatabase

                                      Removes an entry from the options table.

                                      // Remove the `foo` option.\n  $I->dontHaveOptionInDatabase('foo');\n  // Remove the 'bar' option only if it has the `baz` value.\n  $I->dontHaveOptionInDatabase('bar', 'baz');\n
                                      Parameters
                                      • string $key - The option name.
                                      • mixed/null $value - If set the option will only be removed if its value matches the passed one.
                                      dontHavePostInDatabase

                                      Removes an entry from the posts table.

                                      $posts = $I->haveManyPostsInDatabase(3, ['post_title' => 'Test {{n}}']);\n  $I->dontHavePostInDatabase(['post_title' => 'Test 2']);\n
                                      Parameters
                                      • \\Codeception\\Module\\array/array $criteria - An array of search criteria.
                                      • bool $purgeMeta - If set to true then the meta for the post will be purged too.
                                      • dontHavePostMetaInDatabase

                                        Removes an entry from the postmeta table.

                                        $postId = $I->havePostInDatabase(['meta_input' => ['rating' => 23]]);\n  $I->dontHavePostMetaInDatabase(['post_id' => $postId, 'meta_key' => 'rating']);\n
                                        Parameters
                                        • \\Codeception\\Module\\array/array $criteria - An array of search criteria. dontHavePostThumbnailInDatabase

                                          Remove the thumbnail (featured image) from a post, if any. Please note: the method will NOT remove the attachment post, post meta and file.

                                          $attachmentId = $I->haveAttachmentInDatabase(codecept_data_dir('some-image.png'));\n  $postId = $I->havePostInDatabase();\n  // Attach the thumbnail to the post.\n  $I->havePostThumbnailInDatabase($postId, $attachmentId);\n  // Remove the thumbnail from the post.\n  $I->dontHavePostThumbnailInDatabase($postId);\n
                                          Parameters
                                          • int $postId - The post ID to remove the thumbnail (featured image) from.
                                          dontHaveSiteOptionInDatabase

                                          Removes a site option from the database.

                                          // Remove the `foo_count` option.\n  $I->dontHaveSiteOptionInDatabase('foo_count');\n  // Remove the `foo_count` option only if its value is `23`.\n  $I->dontHaveSiteOptionInDatabase('foo_count', 23);\n
                                          Parameters
                                          • string $key - The option name.
                                          • mixed/null $value - If set the option will only be removed it its value matches the specified one.
                                          dontHaveSiteTransientInDatabase

                                          Removes a site transient from the database.

                                          $I->dontHaveSiteTransientInDatabase(['my_plugin_site_buffer']);\n
                                          Parameters
                                          • string $key - The name of the transient to delete.
                                          dontHaveTableInDatabase

                                          Removes a table from the database. The case where a table does not exist is handled without raising an error.

                                          $ordersTable = $I->grabPrefixedTableNameFor('orders');\n  $I->dontHaveTableInDatabase($ordersTable);\n
                                          Parameters
                                          • string $fullTableName - The full table name, including the table prefix.
                                          dontHaveTermInDatabase

                                          Removes a term from the database.

                                          $I->dontHaveTermInDatabase(['name' => 'romance']);\n  $I->dontHaveTermInDatabase(['slug' => 'genre--romance']);\n
                                          Parameters
                                          • \\Codeception\\Module\\array/array $criteria - An array of search criteria.
                                          • bool $purgeMeta - Whether the terms meta should be purged along side with the meta or not.
                                          • dontHaveTermMetaInDatabase

                                            Removes a term meta from the database.

                                            // Remove the \"karma\" key.\n  $I->dontHaveTermMetaInDatabase(['term_id' => $termId, 'meta_key' => 'karma']);\n  // Remove all meta for the term.\n  $I->dontHaveTermMetaInDatabase(['term_id' => $termId]);\n
                                            Parameters
                                            • \\Codeception\\Module\\array/array $criteria - An array of search criteria. dontHaveTermRelationshipInDatabase

                                              Removes an entry from the term_relationships table.

                                              // Remove the relation between a post and a category.\n  $I->dontHaveTermRelationshipInDatabase(['object_id' => $postId, 'term_taxonomy_id' => $ttaxId]);\n  // Remove all terms for a post.\n  $I->dontHaveTermMetaInDatabase(['object_id' => $postId]);\n
                                              Parameters
                                              • \\Codeception\\Module\\array/array $criteria - An array of search criteria. dontHaveTermTaxonomyInDatabase

                                                Removes an entry from the term_taxonomy table.

                                                // Remove a specific term from the genre taxonomy.\n  $I->dontHaveTermTaxonomyInDatabase(['term_id' => $postId, 'taxonomy' => 'genre']);\n  // Remove all terms for a taxonomy.\n  $I->dontHaveTermTaxonomyInDatabase(['taxonomy' => 'genre']);\n
                                                Parameters
                                                • \\Codeception\\Module\\array/array $criteria - An array of search criteria. dontHaveTransientInDatabase

                                                  Removes a transient from the database.

                                                  // Removes the `tweets` transient from the database, if set.\n  $I->dontHaveTransientInDatabase('tweets');\n
                                                  Parameters
                                                  • string $transient - The name of the transient to delete.
                                                  dontHaveUserInDatabase

                                                  Removes a user from the database.

                                                  $bob = $I->haveUserInDatabase('bob');\n  $alice = $I->haveUserInDatabase('alice');\n  // Remove Bob's user and meta.\n  $I->dontHaveUserInDatabase('bob');\n  // Remove Alice's user but not meta.\n  $I->dontHaveUserInDatabase($alice);\n
                                                  Parameters
                                                  • int/string $userIdOrLogin - The user ID or login name.
                                                  • bool $purgeMeta - Whether the user meta should be purged alongside the user or not.
                                                  dontHaveUserInDatabaseWithEmail

                                                  Removes a user(s) from the database using the user email address.

                                                  $luca = $I->haveUserInDatabase('luca', 'editor', ['user_email' => 'luca@example.org']);\n
                                                  Parameters
                                                  • string $userEmail - The email of the user to remove.
                                                  • bool $purgeMeta - Whether the user meta should be purged alongside the user or not.
                                                  dontHaveUserMetaInDatabase

                                                  Removes an entry from the usermeta table.

                                                  // Remove the `karma` user meta for a user.\n  $I->dontHaveUserMetaInDatabase(['user_id' => 23, 'meta_key' => 'karma']);\n  // Remove all the user meta for a user.\n  $I->dontHaveUserMetaInDatabase(['user_id' => 23]);\n
                                                  Parameters
                                                  • \\Codeception\\Module\\array/array $criteria - An array of search criteria. dontSeeAttachmentInDatabase

                                                    Checks that an attachment is not in the database.

                                                    $url = 'https://example.org/images/foo.png';\n  $I->dontSeeAttachmentInDatabase(['guid' => $url]);\n
                                                    Parameters
                                                    • \\Codeception\\Module\\array/array $criteria - An array of search criteria. dontSeeBlogInDatabase

                                                      Checks that a row is not present in the blogs table.

                                                      $I->haveManyBlogsInDatabase(2, ['path' => 'test-{{n}}'], false)\n  $I->dontSeeBlogInDatabase(['path' => '/test-3/'])\n
                                                      Parameters
                                                      • \\Codeception\\Module\\array/array $criteria - An array of search criteria. dontSeeCommentInDatabase

                                                        Checks that a comment is not in the database. Will look up the \"comments\" table.

                                                        // Checks for one comment.\n  $I->dontSeeCommentInDatabase(['comment_ID' => 23]);\n  // Checks for comments from a user.\n  $I->dontSeeCommentInDatabase(['user_id' => 89]);\n
                                                        Parameters
                                                        • \\Codeception\\Module\\array/array $criteria - The search criteria. dontSeeCommentMetaInDatabase

                                                          Checks that a comment meta value is not in the database. Will look up the \"commentmeta\" table.

                                                          // Delete a comment `karma` meta.\n  $I->dontSeeCommentMetaInDatabase(['comment_id' => 23, 'meta_key' => 'karma']);\n  // Delete all meta for a comment.\n  $I->dontSeeCommentMetaInDatabase(['comment_id' => 23]);\n
                                                          Parameters
                                                          • \\Codeception\\Module\\array/array $criteria - An array of search criteria. dontSeeLinkInDatabase

                                                            Checks that a link is not in the links database table.

                                                            $I->dontSeeLinkInDatabase(['link_url' => 'http://example.com']);\n  $I->dontSeeLinkInDatabase(['link_url' => 'http://example.com', 'link_name' => 'example']);\n
                                                            Parameters
                                                            • \\Codeception\\Module\\array/array $criteria - An array of search criteria. dontSeeOptionInDatabase

                                                              Checks that an option is not in the database for the current blog. If the value is an object or an array then the serialized option will be checked.

                                                              $I->dontHaveOptionInDatabase('posts_per_page');\n  $I->dontSeeOptionInDatabase('posts_per_page');\n  $I->dontSeeOptionInDatabase('posts_per_page', 23);\n  $I->dontSeeOptionInDatabase(['option_name' => 'posts_per_page']);\n  $I->dontSeeOptionInDatabase(['option_name' => 'posts_per_page', 'option_value' => 23]);\n
                                                              Parameters
                                                              • \\Codeception\\Module\\array/string $criteriaOrName - An array of search criteria or the option name.
                                                              • mixed/null $value - The optional value to try and match, only used if the option name is provided.
                                                              • dontSeePageInDatabase

                                                                Checks that a page is not in the database.

                                                                // Assert a page with an ID does not exist.\n  $I->dontSeePageInDatabase(['ID' => 23]);\n  // Assert a page with a slug and ID.\n  $I->dontSeePageInDatabase(['post_name' => 'test', 'ID' => 23]);\n
                                                                Parameters
                                                                • \\Codeception\\Module\\array/array $criteria - An array of search criteria. dontSeePostInDatabase

                                                                  Checks that a post is not in the database.

                                                                  // Asserts a post with title 'Test' is not in the database.\n  $I->dontSeePostInDatabase(['post_title' => 'Test']);\n  // Asserts a post with title 'Test' and content 'Test content' is not in the database.\n  $I->dontSeePostInDatabase(['post_title' => 'Test', 'post_content' => 'Test content']);\n
                                                                  Parameters
                                                                  • \\Codeception\\Module\\array/array $criteria - An array of search criteria. dontSeePostMetaInDatabase

                                                                    Checks that a post meta value does not exist. If the meta value is an object or an array then the check will be made on its serialized version.

                                                                    $postId = $I->havePostInDatabase(['meta_input' => ['foo' => 'bar']]);\n  $I->dontSeePostMetaInDatabase(['post_id' => $postId, 'meta_key' => 'woot']);\n
                                                                    Parameters
                                                                    • \\Codeception\\Module\\array/array $criteria - An array of search criteria. dontSeePostWithTermInDatabase

                                                                      Checks that a post to term relation does not exist in the database. The method will check the \"term_relationships\" table.

                                                                      $fiction = $I->haveTermInDatabase('fiction', 'genre');\n  $nonFiction = $I->haveTermInDatabase('non-fiction', 'genre');\n  $postId = $I->havePostInDatabase(['tax_input' => ['genre' => ['fiction']]]);\n  $I->dontSeePostWithTermInDatabase($postId, $nonFiction['term_taxonomy_id], );\n  passed this parameter will be interpreted as a `term_id`, else as a\n  the\n  term order.\n  to build a `taxonomy_term_id` from the `term_id`.\n
                                                                      Parameters
                                                                      • int $post_id - The post ID.
                                                                      • int $term_taxonomy_id - The term term_id or term_taxonomy_id; if the $taxonomy argument is
                                                                      • int/null $term_order - The order the term applies to the post, defaults to null to not use
                                                                      • string/null $taxonomy - The taxonomy the term_id is for; if passed this parameter will be used
                                                                      dontSeeSiteOptionInDatabase

                                                                      Checks that a site option is not in the database.

                                                                      // Check that the option is not set in the database.\n  $I->dontSeeSiteOptionInDatabase('foo_count');\n  // Check that the option is not set with a specific value.\n  $I->dontSeeSiteOptionInDatabase('foo_count', 23);\n  $I->dontSeeSiteOptionInDatabase(['option_name => 'foo_count', 'option_value' => 23]);\n
                                                                      Parameters
                                                                      • \\Codeception\\Module\\array/string $criteriaOrName - An array of search criteria or the option name.
                                                                      • mixed/null $value - The optional value to try and match, only used if the option name is provided.
                                                                      • dontSeeTableInDatabase

                                                                        Checks that a table is not in the database.

                                                                        $options = $I->grabPrefixedTableNameFor('options');\n  $I->dontHaveTableInDatabase($options)\n  $I->dontSeeTableInDatabase($options);\n
                                                                        Parameters
                                                                        • string $table - The full table name, including the table prefix.
                                                                        dontSeeTermInDatabase

                                                                        Makes sure a term is not in the database. Looks up both the terms table and the term_taxonomy tables. and the term_taxonomy tables.

                                                                        // Asserts a 'fiction' term is not in the database.\n  $I->dontSeeTermInDatabase(['name' => 'fiction']);\n  // Asserts a 'fiction' term with slug 'genre--fiction' is not in the database.\n  $I->dontSeeTermInDatabase(['name' => 'fiction', 'slug' => 'genre--fiction']);\n
                                                                        Parameters
                                                                        • \\Codeception\\Module\\array/array $criteria - An array of criteria to search for the term, can be columns from the terms dontSeeTermMetaInDatabase

                                                                          Checks that a term meta is not in the database.

                                                                          list($termId, $termTaxonomyId) = $I->haveTermInDatabase('fiction', 'genre');\n  $I->haveTermMetaInDatabase($termId, 'rating', 4);\n  $I->dontSeeTermMetaInDatabase(['term_id' => $termId,'meta_key' => 'average_review']);\n
                                                                          Parameters
                                                                          • \\Codeception\\Module\\array/array $criteria - An array of search criteria. dontSeeTermTaxonomyInDatabase

                                                                            Checks that a term taxonomy is not in the database.

                                                                            list($termId, $termTaxonomyId) = $I->haveTermInDatabase('fiction', 'genre');\n  $I->dontSeeTermTaxonomyInDatabase(['term_id' => $termId, 'taxonomy' => 'country']);\n
                                                                            Parameters
                                                                            • \\Codeception\\Module\\array/array $criteria - An array of search criteria. dontSeeUserInDatabase

                                                                              Checks that a user is not in the database.

                                                                              // Asserts a user does not exist in the database.\n  $I->dontSeeUserInDatabase(['user_login' => 'luca']);\n  // Asserts a user with email and login is not in the database.\n  $I->dontSeeUserInDatabase(['user_login' => 'luca', 'user_email' => 'luca@theaveragedev.com']);\n
                                                                              Parameters
                                                                              • \\Codeception\\Module\\array/array $criteria - An array of search criteria. dontSeeUserMetaInDatabase

                                                                                Check that a user meta value is not in the database.

                                                                                // Asserts a user does not have a 'karma' meta assigned.\n  $I->dontSeeUserMetaInDatabase(['user_id' => 23, 'meta_key' => 'karma']);\n  // Asserts no user has any 'karma' meta assigned.\n  $I->dontSeeUserMetaInDatabase(['meta_key' => 'karma']);\n
                                                                                Parameters
                                                                                • \\Codeception\\Module\\array/array $criteria - An array of search criteria. getSiteDomain

                                                                                  Returns the site domain inferred from the url set in the config.

                                                                                  $domain = $I->getSiteDomain();\n  // We should be redirected to the HTTPS version when visiting the HTTP version.\n  $I->amOnPage('http://' . $domain);\n  $I->seeCurrentUrlEquals('https://' . $domain);\n
                                                                                  getUsersTableName

                                                                                  Returns the prefixed users table name.

                                                                                  // Given a `wp_` table prefix returns `wp_users`.\n  $usersTable = $I->getUsersTableName();\n  // Given a `wp_` table prefix returns `wp_users`.\n  $I->useBlog(23);\n  $usersTable = $I->getUsersTableName();\n
                                                                                  grabAllFromDatabase

                                                                                  Returns all entries matching a criteria from the database.

                                                                                  $books = $I->grabPrefixedTableNameFor('books');\n  $I->grabAllFromDatabase($books, 'title', ['genre' => 'fiction']);\n
                                                                                  Parameters
                                                                                  • string $table - The table to grab the values from.
                                                                                  • string $column - The column to fetch.
                                                                                  • \\Codeception\\Module\\array $criteria - The search criteria. grabAttachmentAttachedFile

                                                                                    Returns the path, as stored in the database, of an attachment _wp_attached_file meta. The attached file is, usually, an attachment origal file.

                                                                                    $file = $I->grabAttachmentAttachedFile($attachmentId);\n  $fileInfo = new SplFileInfo($file);\n  $I->assertEquals('jpg', $fileInfo->getExtension());\n
                                                                                    Parameters
                                                                                    • int $attachmentPostId - The attachment post ID.
                                                                                    grabAttachmentMetadata

                                                                                    Returns the metadata array for an attachment post. This is the value of the _wp_attachment_metadata meta.

                                                                                    $metadata = $I->grabAttachmentMetadata($attachmentId);\n  $I->assertEquals(['thumbnail', 'medium', 'medium_large'], array_keys($metadata['sizes']);\n
                                                                                    Parameters
                                                                                    • int $attachmentPostId - The attachment post ID.
                                                                                    grabBlogDomain

                                                                                    Returns a blog domain given its ID.

                                                                                    $blogIds = $I->haveManyBlogsInDatabase(3);\n  $domains = array_map(function($blogId){\n  return $I->grabBlogDomain($blogId);\n  }, $blogIds);\n
                                                                                    Parameters
                                                                                    • int $blogId - The blog ID.
                                                                                    grabBlogPath

                                                                                    Grabs a blog domain from the blogs table.

                                                                                    $blogId = $I->haveBlogInDatabase('test');\n  $path = $I->grabBlogDomain($blogId);\n  $I->amOnSubdomain($path);\n  $I->amOnPage('/');\n
                                                                                    Parameters
                                                                                    • int $blogId - The blog ID.
                                                                                    grabBlogTableName

                                                                                    Returns the full name of a table for a blog from a multisite installation database.

                                                                                    $blogOptionTable = $I->grabBlogTableName($blogId, 'option');\n
                                                                                    Parameters
                                                                                    • int $blogId - The blog ID.
                                                                                    • string $table - The table name, without table prefix.
                                                                                    grabBlogTableNames

                                                                                    Returns a list of tables for a blog ID.

                                                                                    $blogId = $I->haveBlogInDatabase('test');\n  $tables = $I->grabBlogTableNames($blogId);\n  $options = array_filter($tables, function($tableName){\n  return str_pos($tableName, 'options') !== false;\n  });\n
                                                                                    Parameters
                                                                                    • int $blogId - The ID of the blog to fetch the tables for.
                                                                                    grabBlogTablePrefix

                                                                                    Returns the table prefix for a blog.

                                                                                    $blogId = $I->haveBlogInDatabase('test');\n  $blogTablePrefix = $I->getBlogTablePrefix($blogId);\n  $blogOrders = $I->blogTablePrefix . 'orders';\n
                                                                                    Parameters
                                                                                    • int $blogId - The blog ID.
                                                                                    grabBlogVersionsTableName

                                                                                    Gets the prefixed blog_versions table name.

                                                                                    // Assuming a `wp_` table prefix it will return `wp_blog_versions`.\n  $blogVersionsTable = $I->grabBlogVersionsTableName();\n  $I->useBlog(23);\n  // Assuming a `wp_` table prefix it will return `wp_blog_versions`.\n  $blogVersionsTable = $I->grabBlogVersionsTableName();\n
                                                                                    grabBlogsTableName

                                                                                    Gets the prefixed blogs table name.

                                                                                    // Assuming a `wp_` table prefix it will return `wp_blogs`.\n  $blogVersionsTable = $I->grabBlogsTableName();\n  $I->useBlog(23);\n  // Assuming a `wp_` table prefix it will return `wp_blogs`.\n  $blogVersionsTable = $I->grabBlogsTableName();\n
                                                                                    grabCommentmetaTableName

                                                                                    Returns the prefixed comment meta table name.

                                                                                    // Get all the values of 'karma' for all comments.\n  $commentMeta = $I->grabCommentmetaTableName();\n  $I->grabAllFromDatabase($commentMeta, 'meta_value', ['meta_key' => 'karma']);\n
                                                                                    grabCommentsTableName

                                                                                    Gets the comments table name.

                                                                                    // Will be `wp_comments`.\n  $comments = $I->grabCommentsTableName();\n  // Will be `wp_23_comments`.\n  $I->useBlog(23);\n  $comments = $I->grabCommentsTableName();\n
                                                                                    grabLatestEntryByFromDatabase

                                                                                    Returns the id value of the last table entry.

                                                                                    $I->haveManyPostsInDatabase();\n  $postsTable = $I->grabPostsTableName();\n  $last = $I->grabLatestEntryByFromDatabase($postsTable, 'ID');\n  items.\n
                                                                                    Parameters
                                                                                    • string $tableName - The table to fetch the last insertion for.
                                                                                    • string $idColumn - The column that is used, in the table, to uniquely identify
                                                                                    grabLinksTableName

                                                                                    Returns the prefixed links table name.

                                                                                    // Given a `wp_` table prefix returns `wp_links`.\n  $linksTable = $I->grabLinksTableName();\n  // Given a `wp_` table prefix returns `wp_23_links`.\n  $I->useBlog(23);\n  $linksTable = $I->grabLinksTableName();\n
                                                                                    grabOptionFromDatabase

                                                                                    Gets an option value from the database.

                                                                                    $count = $I->grabOptionFromDatabase('foo_count');\n
                                                                                    Parameters
                                                                                    • string $option_name - The name of the option to grab from the database.
                                                                                    grabPostMetaFromDatabase

                                                                                    Gets the value of one or more post meta values from the database.

                                                                                    $thumbnail_id = $I->grabPostMetaFromDatabase($postId, '_thumbnail_id', true);\n
                                                                                    Parameters
                                                                                    • int $postId - The post ID.
                                                                                    • string $metaKey - The key of the meta to retrieve.
                                                                                    • bool $single - Whether to return a single meta value or an array of all available meta values.
                                                                                    grabPostmetaTableName

                                                                                    Returns the prefixed post meta table name.

                                                                                    // Returns 'wp_postmeta'.\n  $I->grabPostmetaTableName();\n  // Returns 'wp_23_postmeta'.\n  $I->useBlog(23);\n  $I->grabPostmetaTableName();\n
                                                                                    grabPostsTableName

                                                                                    Gets the posts prefixed table name.

                                                                                    // Given a `wp_` table prefix returns `wp_posts`.\n  $postsTable = $I->grabPostsTableName();\n  // Given a `wp_` table prefix returns `wp_23_posts`.\n  $I->useBlog(23);\n  $postsTable = $I->grabPostsTableName();\n
                                                                                    grabPrefixedTableNameFor

                                                                                    Returns a prefixed table name for the current blog. If the table is not one to be prefixed (e.g. users) then the proper table name will be returned.

                                                                                    // Will return wp_users.\n  $usersTable = $I->grabPrefixedTableNameFor('users');\n  // Will return wp_options.\n  $optionsTable = $I->grabPrefixedTableNameFor('options');\n  // Use a different blog and get its options table.\n  $I->useBlog(2);\n  $blogOptionsTable = $I->grabPrefixedTableNameFor('options');\n
                                                                                    Parameters
                                                                                    • string $tableName - The table name, e.g. options.
                                                                                    grabRegistrationLogTableName

                                                                                    Gets the prefixed registration_log table name.

                                                                                    // Assuming a `wp_` table prefix it will return `wp_registration_log`.\n  $blogVersionsTable = $I->grabRegistrationLogTableName();\n  $I->useBlog(23);\n  // Assuming a `wp_` table prefix it will return `wp_registration_log`.\n  $blogVersionsTable = $I->grabRegistrationLogTableName();\n
                                                                                    grabSignupsTableName

                                                                                    Gets the prefixed signups table name.

                                                                                    // Assuming a `wp_` table prefix it will return `wp_signups`.\n  $blogVersionsTable = $I->grabSignupsTableName();\n  $I->useBlog(23);\n  // Assuming a `wp_` table prefix it will return `wp_signups`.\n  $blogVersionsTable = $I->grabSignupsTableName();\n
                                                                                    grabSiteMetaTableName

                                                                                    Gets the prefixed sitemeta table name.

                                                                                    // Assuming a `wp_` table prefix it will return `wp_sitemeta`.\n  $blogVersionsTable = $I->grabSiteMetaTableName();\n  $I->useBlog(23);\n  // Assuming a `wp_` table prefix it will return `wp_sitemeta`.\n  $blogVersionsTable = $I->grabSiteMetaTableName();\n
                                                                                    grabSiteOptionFromDatabase

                                                                                    Gets a site option from the database.

                                                                                    $fooCountOptionId = $I->haveSiteOptionInDatabase('foo_count','23');\n
                                                                                    Parameters
                                                                                    • string $key - The name of the option to read from the database.
                                                                                    grabSiteTableName

                                                                                    Gets the prefixed site table name.

                                                                                    // Assuming a `wp_` table prefix it will return `wp_site`.\n  $blogVersionsTable = $I->grabSiteTableName();\n  $I->useBlog(23);\n  // Assuming a `wp_` table prefix it will return `wp_site`.\n  $blogVersionsTable = $I->grabSiteTableName();\n
                                                                                    grabSiteTransientFromDatabase

                                                                                    Gets a site transient from the database.

                                                                                    $I->grabSiteTransientFromDatabase('total_comments');\n  $I->grabSiteTransientFromDatabase('api_data');\n
                                                                                    Parameters
                                                                                    • string $key - The site transient to fetch the value for, w/o the _site_transient_ prefix.
                                                                                    grabSiteUrl

                                                                                    Returns the current site URL as specified in the module configuration.

                                                                                    $shopPath = $I->grabSiteUrl('/shop');\n
                                                                                    Parameters
                                                                                    • string $path - A path that should be appended to the site URL.
                                                                                    grabTablePrefix

                                                                                    Returns the table prefix, namespaced for secondary blogs if selected.

                                                                                    // Assuming a table prefix of `wp_` it will return `wp_`;\n  $tablePrefix = $I->grabTablePrefix();\n  $I->useBlog(23);\n  // Assuming a table prefix of `wp_` it will return `wp_23_`;\n  $tablePrefix = $I->grabTablePrefix();\n
                                                                                    grabTermIdFromDatabase

                                                                                    Gets a term ID from the database. Looks up the prefixed terms table, e.g. wp_terms.

                                                                                    // Return the 'fiction' term 'term_id'.\n  $termId = $I->grabTermIdFromDatabase(['name' => 'fiction']);\n  // Get a term ID by more stringent criteria.\n  $termId = $I->grabTermIdFromDatabase(['name' => 'fiction', 'slug' => 'genre--fiction']);\n  // Return the 'term_id' of the first term for a group.\n  $termId = $I->grabTermIdFromDatabase(['term_group' => 23]);\n
                                                                                    Parameters
                                                                                    • \\Codeception\\Module\\array/array $criteria - An array of search criteria. grabTermMetaTableName

                                                                                      Gets the terms meta table prefixed name.

                                                                                      // Returns 'wp_termmeta'.\n  $I->grabTermMetaTableName();\n  // Returns 'wp_23_termmeta'.\n  $I->useBlog(23);\n  $I->grabTermMetaTableName();\n
                                                                                      grabTermRelationshipsTableName

                                                                                      Gets the prefixed term relationships table name, e.g. wp_term_relationships.

                                                                                      $I->grabTermRelationshipsTableName();\n
                                                                                      grabTermTaxonomyIdFromDatabase

                                                                                      Gets a term_taxonomy_id from the database. Looks up the prefixed terms_relationships table, e.g. wp_term_relationships.

                                                                                      // Get the `term_taxonomy_id` for a term and a taxonomy.\n  $I->grabTermTaxonomyIdFromDatabase(['term_id' => $fictionId, 'taxonomy' => 'genre']);\n  // Get the `term_taxonomy_id` for the first term with a count of 23.\n  $I->grabTermTaxonomyIdFromDatabase(['count' => 23]);\n
                                                                                      Parameters
                                                                                      • \\Codeception\\Module\\array/array $criteria - An array of search criteria. grabTermTaxonomyTableName

                                                                                        Gets the prefixed term and taxonomy table name, e.g. wp_term_taxonomy.

                                                                                        // Returns 'wp_term_taxonomy'.\n  $I->grabTermTaxonomyTableName();\n  // Returns 'wp_23_term_taxonomy'.\n  $I->useBlog(23);\n  $I->grabTermTaxonomyTableName();\n
                                                                                        grabTermsTableName

                                                                                        Gets the prefixed terms table name, e.g. wp_terms.

                                                                                        // Returns 'wp_terms'.\n  $I->grabTermsTableName();\n  // Returns 'wp_23_terms'.\n  $I->useBlog(23);\n  $I->grabTermsTableName();\n
                                                                                        grabUserIdFromDatabase

                                                                                        Gets the a user ID from the database using the user login.

                                                                                        $userId = $I->grabUserIdFromDatabase('luca');\n
                                                                                        Parameters
                                                                                        • string $userLogin - The user login name.
                                                                                        grabUserMetaFromDatabase

                                                                                        Gets a user meta from the database.

                                                                                        // Returns a user 'karma' value.\n  $I->grabUserMetaFromDatabase($userId, 'karma');\n  // Returns an array, the unserialized version of the value stored in the database.\n  $I->grabUserMetaFromDatabase($userId, 'api_data');\n
                                                                                        Parameters
                                                                                        • int $userId - The ID of th user to get the meta for.
                                                                                        • string $meta_key - The meta key to fetch the value for.
                                                                                        grabUsermetaTableName

                                                                                        Returns the prefixed users meta table name.

                                                                                        // Given a `wp_` table prefix returns `wp_usermeta`.\n  $usermetaTable = $I->grabUsermetaTableName();\n  // Given a `wp_` table prefix returns `wp_usermeta`.\n  $I->useBlog(23);\n  $usermetaTable = $I->grabUsermetaTableName();\n
                                                                                        grabUsersTableName

                                                                                        Returns the prefixed users table name.

                                                                                        // Given a `wp_` table prefix returns `wp_users`.\n  $usersTable = $I->grabUsersTableName();\n  // Given a `wp_` table prefix returns `wp_users`.\n  $I->useBlog(23);\n  $usersTable = $I->grabUsersTableName();\n
                                                                                        haveAttachmentInDatabase

                                                                                        Creates the database entries representing an attachment and moves the attachment file to the right location. timestamp that should be used to build the \"year/time\" uploads sub-folder structure. override the image sizes created by default.

                                                                                        $file = codecept_data_dir('images/test.png');\n  $attachmentId = $I->haveAttachmentInDatabase($file);\n  $image = codecept_data_dir('images/test-2.png');\n  $lastWeekAttachment = $I->haveAttachmentInDatabase($image, '-1 week');\n  Requires the WPFilesystem module.\n
                                                                                        Parameters
                                                                                        • string $file - The absolute path to the attachment file.
                                                                                        • string/string/int $date - Either a string supported by the strtotime function or a UNIX
                                                                                        • array/\\Codeception\\Module\\array/array $overrides - An associative array of values overriding the default ones.
                                                                                        • \\Codeception\\Module\\array> $imageSizes - An associative array in the format [ => [,]] to haveBlogInDatabase

                                                                                          Inserts a blog in the blogs table.

                                                                                          // Create the `test` subdomain blog.\n  $blogId = $I->haveBlogInDatabase('test', ['administrator' => $userId]);\n  // Create the `/test` subfolder blog.\n  $blogId = $I->haveBlogInDatabase('test', ['administrator' => $userId], false);\n  or subfolder (`true`)\n
                                                                                          Parameters
                                                                                          • string $domainOrPath - The subdomain or the path to the be used for the blog.
                                                                                          • array/\\Codeception\\Module\\array/array $overrides - An array of values to override the defaults.
                                                                                          • bool $subdomain - Whether the new blog should be created as a subdomain (true)
                                                                                          • haveCommentInDatabase

                                                                                            Inserts a comment in the database.

                                                                                            $I->haveCommentInDatabase($postId, ['comment_content' => 'Test Comment', 'comment_karma' => 23]);\n
                                                                                            Parameters
                                                                                            • int $comment_post_ID - The id of the post the comment refers to.
                                                                                            • array/\\Codeception\\Module\\array/array $data - The comment data overriding default and random generated values. haveCommentMetaInDatabase

                                                                                              Inserts a comment meta field in the database. Array and object meta values will be serialized.

                                                                                              $I->haveCommentMetaInDatabase($commentId, 'api_ID', 23);\n  // The value will be serialized.\n  $apiData = ['ID' => 23, 'user' => 89, 'origin' => 'twitter'];\n  $I->haveCommentMetaInDatabase($commentId, 'api_data', $apiData);\n
                                                                                              Parameters
                                                                                              • int $comment_id - The ID of the comment to insert the meta for.
                                                                                              • string $meta_key - The key of the comment meta to insert.
                                                                                              • mixed $meta_value - The value of the meta to insert, if serializable it will be serialized.
                                                                                              haveLinkInDatabase

                                                                                              Inserts a link in the database.

                                                                                              $linkId = $I->haveLinkInDatabase(['link_url' => 'http://example.org']);\n
                                                                                              Parameters
                                                                                              • array/\\Codeception\\Module\\array/array $overrides - The data to insert. haveManyBlogsInDatabase

                                                                                                Inserts many blogs in the database. by the count.

                                                                                                $blogIds = $I->haveManyBlogsInDatabase(3, ['domain' =>'test-{{n}}']);\n  foreach($blogIds as $blogId){\n  $I->useBlog($blogId);\n  $I->haveManuPostsInDatabase(3);\n  }\n
                                                                                                Parameters
                                                                                                • int $count - The number of blogs to create.
                                                                                                • array/\\Codeception\\Module\\array/array $overrides - An array of values to override the default ones; {{n}} will be replaced
                                                                                                • bool $subdomain - Whether the new blogs should be created as a subdomain or subfolder.
                                                                                                • haveManyCommentsInDatabase

                                                                                                  Inserts many comments in the database.

                                                                                                  // Insert 3 random comments for a post.\n  $I->haveManyCommentsInDatabase(3, $postId);\n  // Insert 3 random comments for a post.\n  $I->haveManyCommentsInDatabase(3, $postId, ['comment_content' => 'Comment {{n}}']);\n
                                                                                                  Parameters
                                                                                                  • int $count - The number of comments to insert.
                                                                                                  • int $comment_post_ID - The comment parent post ID.
                                                                                                  • array/\\Codeception\\Module\\array/array $overrides - An associative array to override the defaults. haveManyLinksInDatabase

                                                                                                    Inserts many links in the database links table.

                                                                                                    // Insert 3 randomly generated links in the database.\n  $linkIds = $I->haveManyLinksInDatabase(3);\n  // Inserts links in the database replacing the `n` placeholder.\n  $linkIds = $I->haveManyLinksInDatabase(3, ['link_url' => 'http://example.org/test-{{n}}']);\n
                                                                                                    Parameters
                                                                                                    • int $count - The number of links to insert.
                                                                                                    • array/\\Codeception\\Module\\array/array $overrides - Overrides for the default arguments. haveManyPostsInDatabase

                                                                                                      Inserts many posts in the database returning their IDs. An array of values to override the defaults. The {{n}} placeholder can be used to have the post count inserted in its place; e.g. Post Title - {{n}} will be set to Post Title - 0 for the first post, Post Title - 1 for the second one and so on. The same applies to meta values as well.

                                                                                                      // Insert 3 random posts.\n  $I->haveManyPostsInDatabase(3);\n  // Insert 3 posts with generated titles.\n  $I->haveManyPostsInDatabase(3, ['post_title' => 'Test post {{n}}']);\n
                                                                                                      Parameters
                                                                                                      • int $count - The number of posts to insert.
                                                                                                      • array/\\Codeception\\Module\\array/array $overrides haveManyTermsInDatabase

                                                                                                        Inserts many terms in the database.

                                                                                                        $terms = $I->haveManyTermsInDatabase(3, 'genre-{{n}}', 'genre');\n  $termIds = array_column($terms, 0);\n  $termTaxonomyIds = array_column($terms, 1);\n
                                                                                                        Parameters
                                                                                                        • int $count - The number of terms to insert.
                                                                                                        • string $name - The term name template, can include the {{n}} placeholder.
                                                                                                        • string $taxonomy - The taxonomy to insert the terms for.
                                                                                                        • array/\\Codeception\\Module\\array/array $overrides - An associative array of default overrides. haveManyUsersInDatabase

                                                                                                          Inserts many users in the database.

                                                                                                          $subscribers = $I->haveManyUsersInDatabase(5, 'user-{{n}}');\n  $editors = $I->haveManyUsersInDatabase(\n  5,\n  'user-{{n}}',\n  'editor',\n  ['user_email' => 'user-{{n}}@example.org']\n  );\n
                                                                                                          Parameters
                                                                                                          • int $count - The number of users to insert.
                                                                                                          • string $user_login - The user login name.
                                                                                                          • string $role - The user role.
                                                                                                          • array/\\Codeception\\Module\\array/array $overrides - An array of values to override the default ones. haveMenuInDatabase

                                                                                                            Creates and adds a menu to a theme location in the database.

                                                                                                            list($termId, $termTaxId) = $I->haveMenuInDatabase('test', 'sidebar');\n
                                                                                                            Parameters
                                                                                                            • string $slug - The menu slug.
                                                                                                            • string $location - The theme menu location the menu will be assigned to.
                                                                                                            • array/\\Codeception\\Module\\array/array $overrides - An array of values to override the defaults. haveMenuItemInDatabase

                                                                                                              Adds a menu element to a menu for the current theme. post meta.

                                                                                                              $I->haveMenuInDatabase('test', 'sidebar');\n  $I->haveMenuItemInDatabase('test', 'Test one', 0);\n  $I->haveMenuItemInDatabase('test', 'Test two', 1);\n
                                                                                                              Parameters
                                                                                                              • string $menuSlug - The menu slug the item should be added to.
                                                                                                              • string $title - The menu item title.
                                                                                                              • int/null $menuOrder - An optional menu order, 1 based.
                                                                                                              • array/\\Codeception\\Module\\array/array $meta - An associative array that will be prefixed with _menu_item_ for the item haveOptionInDatabase

                                                                                                                Inserts an option in the database.

                                                                                                                $I->haveOptionInDatabase('posts_per_page', 23);\n  $I->haveOptionInDatabase('my_plugin_options', ['key_one' => 'value_one', 'key_two' => 89]);\n  If the option value is an object or an array then the value will be serialized.\n
                                                                                                                Parameters
                                                                                                                • string $option_name - The option name.
                                                                                                                • mixed $option_value - The option value; if an array or object it will be serialized.
                                                                                                                • string $autoload - Weather the option should be autoloaded by WordPress or not.
                                                                                                                havePageInDatabase

                                                                                                                Inserts a page in the database.

                                                                                                                // Creates a test page in the database with random values.\n  $randomPageId = $I->havePageInDatabase();\n  // Creates a test page in the database defining its title.\n  $testPageId = $I->havePageInDatabase(['post_title' => 'Test page']);\n
                                                                                                                Parameters
                                                                                                                • array/\\Codeception\\Module\\array/array $overrides - An array of values to override the default ones. havePostInDatabase

                                                                                                                  Inserts a post in the database. values.

                                                                                                                  // Insert a post with random values in the database.\n  $randomPostId = $I->havePostInDatabase();\n  // Insert a post with specific values in the database.\n  $I->havePostInDatabase([\n  'post_type' => 'book',\n  'post_title' => 'Alice in Wonderland',\n  'meta_input' => [\n  'readers_count' => 23\n  ],\n  'tax_input' => [\n  ['genre' => 'fiction']\n  ]\n  ]);\n
                                                                                                                  Parameters
                                                                                                                  • array/\\Codeception\\Module\\array/array $data - An associative array of post data to override default and random generated havePostThumbnailInDatabase

                                                                                                                    Assigns the specified attachment ID as thumbnail (featured image) to a post.

                                                                                                                    $attachmentId = $I->haveAttachmentInDatabase(codecept_data_dir('some-image.png'));\n  $postId = $I->havePostInDatabase();\n  $I->havePostThumbnailInDatabase($postId, $attachmentId);\n
                                                                                                                    Parameters
                                                                                                                    • int $postId - The post ID to assign the thumbnail (featured image) to.
                                                                                                                    • int $thumbnailId - The post ID of the attachment.
                                                                                                                    havePostmetaInDatabase

                                                                                                                    Adds one or more meta key and value couples in the database for a post.

                                                                                                                    // Set the post-meta for a post.\n  $I->havePostmetaInDatabase($postId, 'karma', 23);\n  // Set an array post-meta for a post, it will be serialized in the db.\n  $I->havePostmetaInDatabase($postId, 'data', ['one', 'two']);\n  // Use a loop to insert one meta per row.\n  foreach( ['one', 'two'] as $value){\n  $I->havePostmetaInDatabase($postId, 'data', $value);\n  }\n
                                                                                                                    Parameters
                                                                                                                    • int $postId - The post ID.
                                                                                                                    • string $meta_key - The meta key.
                                                                                                                    • mixed $meta_value - The value to insert in the database, objects and arrays will be serialized.
                                                                                                                    haveSiteOptionInDatabase

                                                                                                                    Inserts a site option in the database. If the value is an array or an object then the value will be serialized.

                                                                                                                    $fooCountOptionId = $I->haveSiteOptionInDatabase('foo_count','23');\n
                                                                                                                    Parameters
                                                                                                                    • string $key - The name of the option to insert.
                                                                                                                    • mixed $value - The value to insert for the option.
                                                                                                                    haveSiteTransientInDatabase

                                                                                                                    Inserts a site transient in the database. If the value is an array or an object then the value will be serialized.

                                                                                                                    $I->haveSiteTransientInDatabase('total_comments_count', 23);\n  // This value will be serialized.\n  $I->haveSiteTransientInDatabase('api_data', ['user' => 'luca', 'token' => '11ae3ijns-j83']);\n
                                                                                                                    Parameters
                                                                                                                    • string $key - The key of the site transient to insert, w/o the _site_transient_ prefix.
                                                                                                                    • mixed $value - The value to insert; if serializable the value will be serialized.
                                                                                                                    haveTermInDatabase

                                                                                                                    Inserts a term in the database.

                                                                                                                    // Insert a random 'genre' term in the database.\n  $I->haveTermInDatabase('non-fiction', 'genre');\n  // Insert a term in the database with term meta.\n  $I->haveTermInDatabase('fiction', 'genre', [\n  'slug' => 'genre--fiction',\n  'meta' => [\n  'readers_count' => 23\n  ]\n  ]);\n
                                                                                                                    Parameters
                                                                                                                    • string $name - The term name, e.g. \"Fuzzy\".
                                                                                                                    • string $taxonomy - The term taxonomy
                                                                                                                    • array/\\Codeception\\Module\\array/array $overrides - An array of values to override the default ones. haveTermMetaInDatabase

                                                                                                                      Inserts a term meta row in the database. Objects and array meta values will be serialized.

                                                                                                                      $I->haveTermMetaInDatabase($fictionId, 'readers_count', 23);\n  // Insert some meta that will be serialized.\n  $I->haveTermMetaInDatabase($fictionId, 'flags', [3, 4, 89]);\n  // Use a loop to insert one meta per row.\n  foreach([3, 4, 89] as $value) {\n  $I->haveTermMetaInDatabase($fictionId, 'flag', $value);\n  }\n
                                                                                                                      Parameters
                                                                                                                      • int $term_id - The ID of the term to insert the meta for.
                                                                                                                      • string $meta_key - The key of the meta to insert.
                                                                                                                      • mixed $meta_value - The value of the meta to insert, if serializable it will be serialized.
                                                                                                                      haveTermRelationshipInDatabase

                                                                                                                      Creates a term relationship in the database. No check about the consistency of the insertion is made. E.g. a post could be assigned a term from a taxonomy that's not registered for that post type.

                                                                                                                      // Assign the `fiction` term to a book.\n  $I->haveTermRelationshipInDatabase($bookId, $fictionId);\n
                                                                                                                      Parameters
                                                                                                                      • int $object_id - A post ID, a user ID or anything that can be assigned a taxonomy term.
                                                                                                                      • int $term_taxonomy_id - The term_taxonomy_id of the term and taxonomy to create a relation with.
                                                                                                                      • int $term_order - Defaults to 0.
                                                                                                                      haveTransientInDatabase

                                                                                                                      Inserts a transient in the database. If the value is an array or an object then the value will be serialized. Since the transients are set in the context of tests it's not possible to set an expiration directly.

                                                                                                                      // Store an array in the `tweets` transient.\n  $I->haveTransientInDatabase('tweets', $tweets);\n
                                                                                                                      Parameters
                                                                                                                      • string $transient - The transient name.
                                                                                                                      • mixed $value - The transient value.
                                                                                                                      haveUserCapabilitiesInDatabase

                                                                                                                      Sets a user capabilities in the database.

                                                                                                                      // Assign one user a role in a blog.\n  $blogId = $I->haveBlogInDatabase('test');\n  $editor = $I->haveUserInDatabase('luca', 'editor');\n  $capsIds = $I->haveUserCapabilitiesInDatabase($editor, [$blogId => 'editor']);\n  // Assign a user two roles in blog 1.\n  $capsIds = $I->haveUserCapabilitiesInDatabase($userId, ['editor', 'subscriber']);\n  // Assign one user different roles in different blogs.\n  $capsIds = $I->haveUserCapabilitiesInDatabase($userId, [$blogId1 => 'editor', $blogId2 => 'author']);\n  // Assign a user a role and an additional capability in blog 1.\n  $I->haveUserCapabilitiesInDatabase($userId, ['editor' => true, 'edit_themes' => true]);\n  // Assign a user a mix of roles and capabilities in different blogs.\n  $capsIds = $I->haveUserCapabilitiesInDatabase(\n  $userId,\n  [\n  $blogId1 => ['editor' => true, 'edit_themes' => true],\n  $blogId2 => ['administrator' => true, 'edit_themes' => false]\n  ]\n  );\n  associative array of blog IDs/roles for a multisite\n  installation (e.g. `[1 => 'administrator`, 2 =>\n  'subscriber']`).\n
                                                                                                                      Parameters
                                                                                                                      • int $userId - The ID of the user to set the capabilities of.
                                                                                                                      • string/\\Codeception\\Module\\array/\\Codeception\\Module\\array $role - Either a role string (e.g. administrator),an haveUserInDatabase

                                                                                                                        Inserts a user and its meta in the database. defaults to subscriber. If more than one role is specified, then the first role in the list will be the user primary role and the wp_user_level will be set to that role. in the users and usermeta table.

                                                                                                                        // Create an editor user in blog 1 w/ specific email.\n  $userId = $I->haveUserInDatabase('luca', 'editor', ['user_email' => 'luca@example.org']);\n  // Create a subscriber user in blog 1.\n  $subscriberId = $I->haveUserInDatabase('subscriber');\n  // Create a user editor in blog 1, author in blog 2, administrator in blog 3.\n  $userWithMeta = $I->haveUserInDatabase('luca',\n  [\n  1 => 'editor',\n  2 => 'author',\n  3 => 'administrator'\n  ], [\n  'user_email' => 'luca@example.org'\n  'meta' => ['a meta_key' => 'a_meta_value']\n  ]\n  );\n  // Create editor in blog 1 w/ `edit_themes` cap, author in blog 2, admin in blog 3 w/o `manage_options` cap.\n  $userWithMeta = $I->haveUserInDatabase('luca',\n  [\n  1 => ['editor', 'edit_themes'],\n  2 => 'author',\n  3 => ['administrator' => true, 'manage_options' => false]\n  ]\n  );\n  // Create a user w/o role.\n  $userId = $I->haveUserInDatabase('luca', '');\n
                                                                                                                        Parameters
                                                                                                                        • string $user_login - The user login name.
                                                                                                                        • string/string/\\Codeception\\Module\\array $role - The user role slug(s), e.g. administrator or ['author', 'editor'];
                                                                                                                        • array/\\Codeception\\Module\\array/array $overrides - An associative array of column names and values overriding defaults haveUserLevelsInDatabase

                                                                                                                          Sets the user access level meta in the database for a user. IDs/roles for a multisite installation (e.g. [1 => 'administrator, 2 => 'subscriber']`).

                                                                                                                          $userId = $I->haveUserInDatabase('luca', 'editor');\n  $moreThanAnEditorLessThanAnAdmin = 8;\n  $I->haveUserLevelsInDatabase($userId, $moreThanAnEditorLessThanAnAdmin);\n
                                                                                                                          Parameters
                                                                                                                          • int $userId - The ID of the user to set the level for.
                                                                                                                          • \\Codeception\\Module\\array/string $role - Either a role string (e.g. administrator) or an array of blog haveUserMetaInDatabase

                                                                                                                            Sets a user meta in the database.

                                                                                                                            $userId = $I->haveUserInDatabase('luca', 'editor');\n  $I->haveUserMetaInDatabase($userId, 'karma', 23);\n  values will trigger the insertion of multiple rows.\n
                                                                                                                            Parameters
                                                                                                                            • int $userId - The user ID.
                                                                                                                            • string $meta_key - The meta key to set the value for.
                                                                                                                            • mixed $meta_value - Either a single value or an array of values; objects will be serialized while array of
                                                                                                                            importSql

                                                                                                                            Loads a set SQL code lines in the current database.

                                                                                                                            // Import a SQL string.\n  $I->importSql([$sqlString]);\n  // Import a set of SQL strings.\n  $I->importSql($sqlStrings);\n  // Import a prepared set of SQL strings.\n  $preparedSqlStrings = array_map(function($line){\n  return str_replace('{{date}}', date('Y-m-d H:i:s'), $line);\n  }, $sqlTemplate);\n  $I->importSql($preparedSqlStrings);\n
                                                                                                                            Parameters
                                                                                                                            • \\Codeception\\Module\\array/array $sql - The SQL strings to load. importSqlDumpFile

                                                                                                                              Import the SQL dump file if populate is enabled.

                                                                                                                              // Import a dump file passing the absolute path.\n  $I->importSqlDumpFile(codecept_data_dir('dumps/start.sql'));\n  Specifying a dump file that file will be imported.\n
                                                                                                                              Parameters
                                                                                                                              • string/null $dumpFile - The dump file that should be imported in place of the default one.
                                                                                                                              seeAttachmentInDatabase

                                                                                                                              Checks for an attachment in the database.

                                                                                                                              $url = 'https://example.org/images/foo.png';\n  $I->seeAttachmentInDatabase(['guid' => $url]);\n
                                                                                                                              Parameters
                                                                                                                              • \\Codeception\\Module\\array/array $criteria - An array of search criteria. seeBlogInDatabase

                                                                                                                                Checks for a blog in the blogs table.

                                                                                                                                // Search for a blog by `blog_id`.\n  $I->seeBlogInDatabase(['blog_id' => 23]);\n  // Search for all blogs on a path.\n  $I->seeBlogInDatabase(['path' => '/sub-path/']);\n
                                                                                                                                Parameters
                                                                                                                                • \\Codeception\\Module\\array/array $criteria - An array of search criteria. seeCommentInDatabase

                                                                                                                                  Checks for a comment in the database. Will look up the \"comments\" table.

                                                                                                                                  $I->seeCommentInDatabase(['comment_ID' => 23]);\n
                                                                                                                                  Parameters
                                                                                                                                  • \\Codeception\\Module\\array/array $criteria - An array of search criteria. seeCommentMetaInDatabase

                                                                                                                                    Checks that a comment meta value is in the database. Will look up the \"commentmeta\" table.

                                                                                                                                    // Assert a specified meta for a comment exists.\n  $I->seeCommentMetaInDatabase(['comment_ID' => $commentId, 'meta_key' => 'karma', 'meta_value' => 23]);\n  // Assert the comment has at least one meta set.\n  $I->seeCommentMetaInDatabase(['comment_ID' => $commentId]);\n
                                                                                                                                    Parameters
                                                                                                                                    • \\Codeception\\Module\\array/array $criteria - An array of search criteria. seeLinkInDatabase

                                                                                                                                      Checks for a link in the links table of the database.

                                                                                                                                      // Asserts a link exists by name.\n  $I->seeLinkInDatabase(['link_name' => 'my-link']);\n  // Asserts at least one link exists for the user.\n  $I->seeLinkInDatabase(['link_owner' => $userId]);\n
                                                                                                                                      Parameters
                                                                                                                                      • \\Codeception\\Module\\array/array $criteria - An array of search criteria. seeOptionInDatabase

                                                                                                                                        Checks if an option is in the database for the current blog, either by criteria or by name and value. If checking for an array or an object then the serialized version will be checked for.

                                                                                                                                        // Checks an option is in the database.\n  $I->seeOptionInDatabase('tables_version');\n  // Checks an option is in the database and has a specific value.\n  $I->seeOptionInDatabase('tables_version', '1.0');\n  $I->seeOptionInDatabase(['option_name' => 'tables_version', 'option_value' => 1.0']);\n
                                                                                                                                        Parameters
                                                                                                                                        • \\Codeception\\Module\\array/string $criteriaOrName - An array of search criteria or the option name.
                                                                                                                                        • mixed/null $value - The optional value to try and match, only used if the option name is provided.
                                                                                                                                        • seePageInDatabase

                                                                                                                                          Checks for a page in the database.

                                                                                                                                          // Asserts a page with an exists in the database.\n  $I->seePageInDatabase(['ID' => 23]);\n  // Asserts a page with a slug and ID exists in the database.\n  $I->seePageInDatabase(['post_title' => 'Test Page', 'ID' => 23]);\n
                                                                                                                                          Parameters
                                                                                                                                          • \\Codeception\\Module\\array/array $criteria - An array of search criteria. seePostInDatabase

                                                                                                                                            Checks for a post in the database.

                                                                                                                                            // Assert a post exists in the database.\n  $I->seePostInDatabase(['ID' => 23]);\n  // Assert a post with a slug and ID exists in the database.\n  $I->seePostInDatabase(['post_content' => 'test content', 'ID' => 23]);\n
                                                                                                                                            Parameters
                                                                                                                                            • \\Codeception\\Module\\array/array $criteria - An array of search criteria. seePostMetaInDatabase

                                                                                                                                              Checks for a post meta value in the database for the current blog. If the meta_value is an object or an array then the check will be made for serialized values.

                                                                                                                                              $postId = $I->havePostInDatabase(['meta_input' => ['foo' => 'bar']];\n  $I->seePostMetaInDatabase(['post_id' => '$postId', 'meta_key' => 'foo']);\n
                                                                                                                                              Parameters
                                                                                                                                              • \\Codeception\\Module\\array/array $criteria - An array of search criteria. seePostWithTermInDatabase

                                                                                                                                                Checks that a post to term relation exists in the database. The method will check the \"term_relationships\" table.

                                                                                                                                                $fiction = $I->haveTermInDatabase('fiction', 'genre');\n  $postId = $I->havePostInDatabase(['tax_input' => ['genre' => ['fiction']]]);\n  $I->seePostWithTermInDatabase($postId, $fiction['term_taxonomy_id']);\n  passed this parameter will be interpreted as a `term_id`, else as a\n  the\n  term order.\n  to build a `taxonomy_term_id` from the `term_id`.\n
                                                                                                                                                Parameters
                                                                                                                                                • int $post_id - The post ID.
                                                                                                                                                • int $term_taxonomy_id - The term term_id or term_taxonomy_id; if the $taxonomy argument is
                                                                                                                                                • int/null $term_order - The order the term applies to the post, defaults to null to not use
                                                                                                                                                • string/null $taxonomy - The taxonomy the term_id is for; if passed this parameter will be used
                                                                                                                                                seeSiteOptionInDatabase

                                                                                                                                                Checks that a site option is in the database.

                                                                                                                                                // Check that the option is set in the database.\n  $I->seeSiteOptionInDatabase('foo_count');\n  // Check that the option is set and has a specific value.\n  $I->seeSiteOptionInDatabase('foo_count', 23);\n
                                                                                                                                                Parameters
                                                                                                                                                • \\Codeception\\Module\\array/string $criteriaOrName - An array of search criteria or the option name.
                                                                                                                                                • mixed/null $value - The optional value to try and match, only used if the option name is provided.
                                                                                                                                                • seeSiteSiteTransientInDatabase

                                                                                                                                                  Checks that a site option is in the database.

                                                                                                                                                  // Check a transient exists.\n  $I->seeSiteSiteTransientInDatabase('total_counts');\n  // Check a transient exists and has a specific value.\n  $I->seeSiteSiteTransientInDatabase('total_counts', 23);\n
                                                                                                                                                  Parameters
                                                                                                                                                  • string $key - The name of the transient to check for, w/o the _site_transient_ prefix.
                                                                                                                                                  • mixed/null $value - If provided then the assertion will include the value.
                                                                                                                                                  seeTableInDatabase

                                                                                                                                                  Checks that a table is in the database.

                                                                                                                                                  $options = $I->grabPrefixedTableNameFor('options');\n  $I->seeTableInDatabase($options);\n
                                                                                                                                                  Parameters
                                                                                                                                                  • string $table - The full table name, including the table prefix.
                                                                                                                                                  seeTermInDatabase

                                                                                                                                                  Checks for a term in the database. Looks up the terms and term_taxonomy prefixed tables. and the term_taxonomy tables.

                                                                                                                                                  $I->seeTermInDatabase(['slug' => 'genre--fiction']);\n  $I->seeTermInDatabase(['name' => 'Fiction', 'slug' => 'genre--fiction']);\n
                                                                                                                                                  Parameters
                                                                                                                                                  • \\Codeception\\Module\\array/array $criteria - An array of criteria to search for the term, can be columns from the terms seeTermMetaInDatabase

                                                                                                                                                    Checks for a term meta in the database.

                                                                                                                                                    list($termId, $termTaxonomyId) = $I->haveTermInDatabase('fiction', 'genre');\n  $I->haveTermMetaInDatabase($termId, 'rating', 4);\n  $I->seeTermMetaInDatabase(['term_id' => $termId,'meta_key' => 'rating', 'meta_value' => 4]);\n
                                                                                                                                                    Parameters
                                                                                                                                                    • \\Codeception\\Module\\array/array $criteria - An array of search criteria. seeTermRelationshipInDatabase

                                                                                                                                                      Checks for a term relationship in the database.

                                                                                                                                                      $postId = $I->havePostInDatabase(['tax_input' => ['category' => 'one']]);\n  $I->seeTermRelationshipInDatabase(['object_id' => $postId, 'term_taxonomy_id' => $oneTermTaxId]);\n
                                                                                                                                                      Parameters
                                                                                                                                                      • \\Codeception\\Module\\array/array $criteria - An array of search criteria. seeTermTaxonomyInDatabase

                                                                                                                                                        Checks for a taxonomy taxonomy in the database.

                                                                                                                                                        list($termId, $termTaxonomyId) = $I->haveTermInDatabase('fiction', 'genre');\n  $I->seeTermTaxonomyInDatabase(['term_id' => $termId, 'taxonomy' => 'genre']);\n
                                                                                                                                                        Parameters
                                                                                                                                                        • \\Codeception\\Module\\array/array $criteria - An array of search criteria. seeUserInDatabase

                                                                                                                                                          Checks that a user is in the database. The method will check the \"users\" table.

                                                                                                                                                          $I->seeUserInDatabase([\n  \"user_email\" => \"test@example.org\",\n  \"user_login\" => \"login name\"\n  ])\n
                                                                                                                                                          Parameters
                                                                                                                                                          • \\Codeception\\Module\\array/array $criteria - An array of search criteria. seeUserMetaInDatabase

                                                                                                                                                            Checks for a user meta value in the database.

                                                                                                                                                            $I->seeUserMetaInDatabase(['user_id' => 23, 'meta_key' => 'karma']);\n
                                                                                                                                                            Parameters
                                                                                                                                                            • \\Codeception\\Module\\array/array $criteria - An array of search criteria. useBlog

                                                                                                                                                              Sets the blog to be used. This has nothing to do with WordPress switch_to_blog function, this code will affect the table prefixes used.

                                                                                                                                                              // Switch to the blog with ID 23.\n  $I->useBlog(23);\n  // Switch back to the main blog.\n  $I->useMainBlog();\n
                                                                                                                                                              Parameters
                                                                                                                                                              • int $blogId - The ID of the blog to use.
                                                                                                                                                              useMainBlog

                                                                                                                                                              Sets the current blog to the main one (blog_id 1).

                                                                                                                                                              // Switch to the blog with ID 23.\n  $I->useBlog(23);\n  // Switch back to the main blog.\n  $I->useMainBlog();\n
                                                                                                                                                              useTheme

                                                                                                                                                              Sets the current theme options.

                                                                                                                                                              $I->useTheme('twentyseventeen');\n  $I->useTheme('child-of-twentyseventeen', 'twentyseventeen');\n  $I->useTheme('acme', 'acme', 'Acme Theme');\n
                                                                                                                                                              Parameters
                                                                                                                                                              • string $stylesheet - The theme stylesheet slug, e.g. twentysixteen.
                                                                                                                                                              • string $template - The theme template slug, e.g. twentysixteen, defaults to $stylesheet.
                                                                                                                                                              • string $themeName - The theme name, e.g. Acme, defaults to the \"title\" version of

                                                                                                                                                              This class extends \\Codeception\\Module\\Db

                                                                                                                                                              This class implements \\Codeception\\Lib\\Interfaces\\Db

                                                                                                                                                              "},{"location":"v3/modules/WPFilesystem/","title":"WPFilesystem module","text":"

                                                                                                                                                              This module should be used in acceptance and functional tests, see levels of testing for more information. This module extends the Filesystem module adding WordPress-specific configuration parameters and methods. The module provides methods to read, write and update the WordPress filesystem directly, without relying on WordPress methods, using WordPress functions or triggering WordPress filters. This module also provides methods to scaffold plugins and themes on the fly in the context of tests and auto-remove them after each test.

                                                                                                                                                              "},{"location":"v3/modules/WPFilesystem/#module-requirements-for-codeception-40","title":"Module requirements for Codeception 4.0+","text":"

                                                                                                                                                              This module requires the codeception/module-filesystem Composer package to work when wp-browser is used with Codeception 4.0.

                                                                                                                                                              To install the package run:

                                                                                                                                                              composer require --dev codeception/module-filesystem:^1.0\n
                                                                                                                                                              "},{"location":"v3/modules/WPFilesystem/#configuration","title":"Configuration","text":"
                                                                                                                                                              • wpRootFolder required The absolute, or relative to the project root folder, path to the root WordPress installation folder. The WordPress installation root folder is the one that contains the wp-load.php file.
                                                                                                                                                              • themes - defaults to /wp-content/themes; the path, relative to the the WordPress installation root folder, to the themes folder.
                                                                                                                                                              • plugins - defaults to /wp-content/plugins; the path, relative to the WordPress installation root folder, to the plugins folder.
                                                                                                                                                              • mu-plugins - defaults to wp-content/mu-plugins; the path, relative to the WordPress installation root folder, to the must-use plugins folder.
                                                                                                                                                              • uploads - defaults to /wp-content/uploads; the path, relative to the WordPress installation root folder, to the uploads folder.
                                                                                                                                                              "},{"location":"v3/modules/WPFilesystem/#example-configuration","title":"Example configuration","text":"
                                                                                                                                                              modules:\n    enabled:\n        - WPFilesystem\n    config:\n        WPFilesystem:\n            wpRootFolder: \"/var/www/wordpress\"\n
                                                                                                                                                              "},{"location":"v3/modules/WPFilesystem/#public-api","title":"Public API","text":"
                                                                                                                                                              • amInMuPluginPath
                                                                                                                                                              • amInPluginPath
                                                                                                                                                              • amInThemePath
                                                                                                                                                              • amInUploadsPath
                                                                                                                                                              • cleanMuPluginDir
                                                                                                                                                              • cleanPluginDir
                                                                                                                                                              • cleanThemeDir
                                                                                                                                                              • cleanUploadsDir
                                                                                                                                                              • copyDirToMuPlugin
                                                                                                                                                              • copyDirToPlugin
                                                                                                                                                              • copyDirToTheme
                                                                                                                                                              • copyDirToUploads
                                                                                                                                                              • deleteMuPluginFile
                                                                                                                                                              • deletePluginFile
                                                                                                                                                              • deleteThemeFile
                                                                                                                                                              • deleteUploadedDir
                                                                                                                                                              • deleteUploadedFile
                                                                                                                                                              • dontSeeInMuPluginFile
                                                                                                                                                              • dontSeeInPluginFile
                                                                                                                                                              • dontSeeInThemeFile
                                                                                                                                                              • dontSeeInUploadedFile
                                                                                                                                                              • dontSeeMuPluginFileFound
                                                                                                                                                              • dontSeePluginFileFound
                                                                                                                                                              • dontSeeThemeFileFound
                                                                                                                                                              • dontSeeUploadedFileFound
                                                                                                                                                              • getBlogUploadsPath
                                                                                                                                                              • getUploadsPath
                                                                                                                                                              • getWpRootFolder
                                                                                                                                                              • haveMuPlugin
                                                                                                                                                              • havePlugin
                                                                                                                                                              • haveTheme
                                                                                                                                                              • makeUploadsDir
                                                                                                                                                              • openUploadedFile
                                                                                                                                                              • seeInMuPluginFile
                                                                                                                                                              • seeInPluginFile
                                                                                                                                                              • seeInThemeFile
                                                                                                                                                              • seeInUploadedFile
                                                                                                                                                              • seeMuPluginFileFound
                                                                                                                                                              • seePluginFileFound
                                                                                                                                                              • seeThemeFileFound
                                                                                                                                                              • seeUploadedFileFound
                                                                                                                                                              • writeToMuPluginFile
                                                                                                                                                              • writeToPluginFile
                                                                                                                                                              • writeToThemeFile
                                                                                                                                                              • writeToUploadedFile
                                                                                                                                                              amInMuPluginPath

                                                                                                                                                              Sets the current working folder to a folder in a mu-plugin.

                                                                                                                                                              $I->amInMuPluginPath('mu-plugin');\n
                                                                                                                                                              Parameters
                                                                                                                                                              • string $path - The path to the folder, relative to the mu-plugins root folder.
                                                                                                                                                              amInPluginPath

                                                                                                                                                              Sets the current working folder to a folder in a plugin.

                                                                                                                                                              $I->amInPluginPath('my-plugin');\n
                                                                                                                                                              Parameters
                                                                                                                                                              • string $path - The folder path, relative to the root uploads folder, to change to.
                                                                                                                                                              amInThemePath

                                                                                                                                                              Sets the current working folder to a folder in a theme.

                                                                                                                                                              $I->amInThemePath('my-theme');\n
                                                                                                                                                              Parameters
                                                                                                                                                              • string $path - The path to the theme folder, relative to themes root folder.
                                                                                                                                                              amInUploadsPath

                                                                                                                                                              Enters, changing directory, to the uploads folder in the local filesystem.

                                                                                                                                                              $I->amInUploadsPath('/logs');\n  $I->seeFileFound('shop.log');\n
                                                                                                                                                              Parameters
                                                                                                                                                              • string $path - The path, relative to the site uploads folder.
                                                                                                                                                              cleanMuPluginDir

                                                                                                                                                              Cleans, emptying it, a folder in a mu-plugin folder.

                                                                                                                                                              $I->cleanMuPluginDir('mu-plugin1/foo');\n
                                                                                                                                                              Parameters
                                                                                                                                                              • string $dir - The path to the directory, relative to the mu-plugins root folder.
                                                                                                                                                              cleanPluginDir

                                                                                                                                                              Cleans, emptying it, a folder in a plugin folder.

                                                                                                                                                              $I->cleanPluginDir('my-plugin/foo');\n
                                                                                                                                                              Parameters
                                                                                                                                                              • string $dir - The path to the folder, relative to the plugins root folder.
                                                                                                                                                              cleanThemeDir

                                                                                                                                                              Clears, emptying it, a folder in a theme folder.

                                                                                                                                                              $I->cleanThemeDir('my-theme/foo');\n
                                                                                                                                                              Parameters
                                                                                                                                                              • string $dir - The path to the folder, relative to the themese root folder.
                                                                                                                                                              cleanUploadsDir

                                                                                                                                                              Clears a folder in the uploads folder. The date argument can be a string compatible with strtotime or a Unix timestamp that will be used to build the Y/m uploads subfolder path.

                                                                                                                                                              $I->cleanUploadsDir('some/folder');\n  $I->cleanUploadsDir('some/folder', 'today');\n
                                                                                                                                                              Parameters
                                                                                                                                                              • string $dir - The path to the directory to delete, relative to the uploads folder.
                                                                                                                                                              • string/int/[\\DateTime](http://php.net/manual/en/class.datetime.php) $date - The date of the uploads to delete, will default to now.
                                                                                                                                                              copyDirToMuPlugin

                                                                                                                                                              Copies a folder to a folder in a mu-plugin.

                                                                                                                                                              $I->copyDirToMuPlugin(codecept_data_dir('foo'), 'mu-plugin/foo');\n
                                                                                                                                                              Parameters
                                                                                                                                                              • string $src - The path to the source file to copy.
                                                                                                                                                              • string $pluginDst - The path to the destination folder, relative to the mu-plugins root folder.
                                                                                                                                                              copyDirToPlugin

                                                                                                                                                              Copies a folder to a folder in a plugin.

                                                                                                                                                              // Copy the 'foo' folder to the 'foo' folder in the plugin.\n  $I->copyDirToPlugin(codecept_data_dir('foo'), 'my-plugin/foo');\n
                                                                                                                                                              Parameters
                                                                                                                                                              • string $src - The path to the source directory to copy.
                                                                                                                                                              • string $pluginDst - The destination path, relative to the plugins root folder.
                                                                                                                                                              copyDirToTheme

                                                                                                                                                              Copies a folder in a theme folder.

                                                                                                                                                              $I->copyDirToTheme(codecept_data_dir('foo'), 'my-theme');\n
                                                                                                                                                              Parameters
                                                                                                                                                              • string $src - The path to the source file.
                                                                                                                                                              • string $themeDst - The path to the destination folder, relative to the themes root folder.
                                                                                                                                                              copyDirToUploads

                                                                                                                                                              Copies a folder to the uploads folder. The date argument can be a string compatible with strtotime or a Unix timestamp that will be used to build the Y/m uploads subfolder path.

                                                                                                                                                              $I->copyDirToUploads(codecept_data_dir('foo'), 'uploadsFoo');\n  $I->copyDirToUploads(codecept_data_dir('foo'), 'uploadsFoo', 'today');\n
                                                                                                                                                              Parameters
                                                                                                                                                              • string $src - The path to the source file, relative to the current uploads folder.
                                                                                                                                                              • string $dst - The path to the destination file, relative to the current uploads folder.
                                                                                                                                                              • string/int/[\\DateTime](http://php.net/manual/en/class.datetime.php) $date - The date of the uploads to delete, will default to now.
                                                                                                                                                              deleteMuPluginFile

                                                                                                                                                              Deletes a file in a mu-plugin folder.

                                                                                                                                                              $I->deleteMuPluginFile('mu-plugin1/some-file.txt');\n
                                                                                                                                                              Parameters
                                                                                                                                                              • string $file - The path to the file, relative to the mu-plugins root folder.
                                                                                                                                                              deletePluginFile

                                                                                                                                                              Deletes a file in a plugin folder.

                                                                                                                                                              $I->deletePluginFile('my-plugin/some-file.txt');\n
                                                                                                                                                              Parameters
                                                                                                                                                              • string $file - The folder path, relative to the plugins root folder.
                                                                                                                                                              deleteThemeFile

                                                                                                                                                              Deletes a file in a theme folder.

                                                                                                                                                              $I->deleteThemeFile('my-theme/some-file.txt');\n
                                                                                                                                                              Parameters
                                                                                                                                                              • string $file - The path to the file to delete, relative to the themes root folder.
                                                                                                                                                              deleteUploadedDir

                                                                                                                                                              Deletes a dir in the uploads folder. The date argument can be a string compatible with strtotime or a Unix timestamp that will be used to build the Y/m uploads subfolder path.

                                                                                                                                                              $I->deleteUploadedDir('folder');\n  $I->deleteUploadedDir('folder', 'today');\n
                                                                                                                                                              Parameters
                                                                                                                                                              • string $dir - The path to the directory to delete, relative to the uploads folder.
                                                                                                                                                              • string/int/[\\DateTime](http://php.net/manual/en/class.datetime.php) $date - The date of the uploads to delete, will default to now.
                                                                                                                                                              deleteUploadedFile

                                                                                                                                                              Deletes a file in the uploads folder. The date argument can be a string compatible with strtotime or a Unix timestamp that will be used to build the Y/m uploads subfolder path.

                                                                                                                                                              $I->deleteUploadedFile('some-file.txt');\n  $I->deleteUploadedFile('some-file.txt', 'today');\n
                                                                                                                                                              Parameters
                                                                                                                                                              • string $file - The file path, relative to the uploads folder or the current folder.
                                                                                                                                                              • string/int $date - A string compatible with strtotime or a Unix timestamp.
                                                                                                                                                              dontSeeInMuPluginFile

                                                                                                                                                              Checks that a file in a mu-plugin folder does not contain a string.

                                                                                                                                                              $I->dontSeeInMuPluginFile('mu-plugin1/some-file.txt', 'foo');\n
                                                                                                                                                              Parameters
                                                                                                                                                              • string $file - The path to the file, relative to the mu-plugins root folder.
                                                                                                                                                              • string $contents - The contents to check the file for.
                                                                                                                                                              dontSeeInPluginFile

                                                                                                                                                              Checks that a file in a plugin folder does not contain a string.

                                                                                                                                                              $I->dontSeeInPluginFile('my-plugin/some-file.txt', 'foo');\n
                                                                                                                                                              Parameters
                                                                                                                                                              • string $file - The path to the file, relative to the plugins root folder.
                                                                                                                                                              • string $contents - The contents to check the file for.
                                                                                                                                                              dontSeeInThemeFile

                                                                                                                                                              Checks that a file in a theme folder does not contain a string.

                                                                                                                                                              $I->dontSeeInThemeFile('my-theme/some-file.txt', 'foo');\n
                                                                                                                                                              Parameters
                                                                                                                                                              • string $file - The path to the file, relative to the themes root folder.
                                                                                                                                                              • string $contents - The contents to check the file for.
                                                                                                                                                              dontSeeInUploadedFile

                                                                                                                                                              Checks that a file in the uploads folder does contain a string. The date argument can be a string compatible with strtotime or a Unix timestamp that will be used to build the Y/m uploads subfolder path.

                                                                                                                                                              $I->dontSeeInUploadedFile('some-file.txt', 'foo');\n  $I->dontSeeInUploadedFile('some-file.txt','foo', 'today');\n
                                                                                                                                                              Parameters
                                                                                                                                                              • string $file - The file path, relative to the uploads folder or the current folder.
                                                                                                                                                              • string $contents - The not expected file contents or part of them.
                                                                                                                                                              • string/int $date - A string compatible with strtotime or a Unix timestamp.
                                                                                                                                                              dontSeeMuPluginFileFound

                                                                                                                                                              Checks that a file is not found in a mu-plugin folder.

                                                                                                                                                              $I->dontSeeMuPluginFileFound('mu-plugin1/some-file.txt');\n
                                                                                                                                                              Parameters
                                                                                                                                                              • string $file - The path to the file, relative to the mu-plugins folder.
                                                                                                                                                              dontSeePluginFileFound

                                                                                                                                                              Checks that a file is not found in a plugin folder.

                                                                                                                                                              $I->dontSeePluginFileFound('my-plugin/some-file.txt');\n
                                                                                                                                                              Parameters
                                                                                                                                                              • string $file - The path to the file, relative to the plugins root folder.
                                                                                                                                                              dontSeeThemeFileFound

                                                                                                                                                              Checks that a file is not found in a theme folder.

                                                                                                                                                              $I->dontSeeThemeFileFound('my-theme/some-file.txt');\n
                                                                                                                                                              Parameters
                                                                                                                                                              • string $file - The path to the file, relative to the themes root folder.
                                                                                                                                                              dontSeeUploadedFileFound

                                                                                                                                                              Checks thata a file does not exist in the uploads folder. The date argument can be a string compatible with strtotime or a Unix timestamp that will be used to build the Y/m uploads subfolder path.

                                                                                                                                                              $I->dontSeeUploadedFileFound('some-file.txt');\n  $I->dontSeeUploadedFileFound('some-file.txt','today');\n
                                                                                                                                                              Parameters
                                                                                                                                                              • string $file - The file path, relative to the uploads folder or the current folder.
                                                                                                                                                              • string/int $date - A string compatible with strtotime or a Unix timestamp.
                                                                                                                                                              getBlogUploadsPath

                                                                                                                                                              Returns the absolute path to a blog uploads folder or file.

                                                                                                                                                              $blogId = $I->haveBlogInDatabase('test');\n  $testTodayUploads = $I->getBlogUploadsPath($blogId);\n  $testLastMonthLogs = $I->getBlogUploadsPath($blogId, '/logs', '-1 month');\n  file or folder.\n  sub-folders in the year/month format; a UNIX timestamp or\n  a string supported by the `strtotime` function; defaults\n  to `now`.\n
                                                                                                                                                              Parameters
                                                                                                                                                              • int $blogId - The blog ID to get the path for.
                                                                                                                                                              • string $file - The path, relatitve to the blog uploads folder, to the
                                                                                                                                                              • null/string/[\\DateTime](http://php.net/manual/en/class.datetime.php)/[\\DateTime](http://php.net/manual/en/class.datetime.php)Immutable $date - The date that should be used to build the uploads
                                                                                                                                                              getUploadsPath

                                                                                                                                                              Returns the path to the specified uploads file of folder. Not providing a value for $file and $date will return the uploads folder path.

                                                                                                                                                              $todaysPath = $I->getUploadsPath();\n  $lastWeek = $I->getUploadsPath('', '-1 week');\n
                                                                                                                                                              Parameters
                                                                                                                                                              • string $file - The file path, relative to the uploads folder.
                                                                                                                                                              • mixed $date - A string compatible with strtotime, a Unix timestamp or a Date object.
                                                                                                                                                              getWpRootFolder

                                                                                                                                                              Returns the absolute path to WordPress root folder without trailing slash.

                                                                                                                                                              $rootFolder = $I->getWpRootFolder();\n  $I->assertFileExists($rootFolder . 'wp-load.php');\n
                                                                                                                                                              haveMuPlugin

                                                                                                                                                              Creates a mu-plugin file, including plugin header, in the mu-plugins folder. The code can not contain the opening '<?php' tag.

                                                                                                                                                              $code = 'echo \"Hello world!\"';\n  $I->haveMuPlugin('foo-mu-plugin.php', $code);\n  // Load the code from a file.\n  $code = file_get_contents(codecept_data_dir('code/mu-plugin.php'));\n  $I->haveMuPlugin('foo-mu-plugin.php', $code);\n
                                                                                                                                                              Parameters
                                                                                                                                                              • string $filename - The path to the file to create, relative to the plugins root folder.
                                                                                                                                                              • string $code - The content of the plugin file with or without the opening PHP tag.
                                                                                                                                                              havePlugin

                                                                                                                                                              Creates a plugin file, including plugin header, in the plugins folder. The plugin is just created and not activated; the code can not contain the opening '<?php' tag.

                                                                                                                                                              $code = 'echo \"Hello world!\"';\n  $I->havePlugin('foo/plugin.php', $code);\n  // Load the code from a file.\n  $code = file_get_contents(codecept_data_dir('code/plugin.php'));\n  $I->havePlugin('foo/plugin.php', $code);\n
                                                                                                                                                              Parameters
                                                                                                                                                              • string $path - The path to the file to create, relative to the plugins folder.
                                                                                                                                                              • string $code - The content of the plugin file with or without the opening PHP tag.
                                                                                                                                                              haveTheme

                                                                                                                                                              Creates a theme file structure, including theme style file and index, in the themes folder. The theme is just created and not activated; the code can not contain the opening '<?php' tag.

                                                                                                                                                              $code = 'sayHi();';\n  $functionsCode  = 'function sayHi(){echo \"Hello world\";};';\n  $I->haveTheme('foo', $indexCode, $functionsCode);\n  // Load the code from a file.\n  $indexCode = file_get_contents(codecept_data_dir('code/index.php'));\n  $functionsCode = file_get_contents(codecept_data_dir('code/functions.php'));\n  $I->haveTheme('foo', $indexCode, $functionsCode);\n
                                                                                                                                                              Parameters
                                                                                                                                                              • string $folder - The path to the theme to create, relative to the themes root folder.
                                                                                                                                                              • string $indexFileCode - The content of the theme index.php file with or without the opening PHP tag.
                                                                                                                                                              • string $functionsFileCode - The content of the theme functions.php file with or without the opening PHP tag.
                                                                                                                                                              makeUploadsDir

                                                                                                                                                              Creates an empty folder in the WordPress installation uploads folder.

                                                                                                                                                              $logsDir = $I->makeUploadsDir('logs/acme');\n  to create.\n
                                                                                                                                                              Parameters
                                                                                                                                                              • string $path - The path, relative to the WordPress installation uploads folder, of the folder
                                                                                                                                                              openUploadedFile

                                                                                                                                                              Opens a file in the the uploads folder. The date argument can be a string compatible with strtotime or a Unix timestamp that will be used to build the Y/m uploads subfolder path.

                                                                                                                                                              $I->openUploadedFile('some-file.txt');\n  $I->openUploadedFile('some-file.txt', 'time');\n
                                                                                                                                                              Parameters
                                                                                                                                                              • string $filename - The path to the file, relative to the current uploads folder.
                                                                                                                                                              • string/int/[\\DateTime](http://php.net/manual/en/class.datetime.php) $date - The date of the uploads to delete, will default to now.
                                                                                                                                                              seeInMuPluginFile

                                                                                                                                                              Checks that a file in a mu-plugin folder contains a string.

                                                                                                                                                              $I->seeInMuPluginFile('mu-plugin1/some-file.txt', 'foo');\n
                                                                                                                                                              Parameters
                                                                                                                                                              • string $file - The path the file, relative to the mu-plugins root folder.
                                                                                                                                                              • string $contents - The contents to check the file for.
                                                                                                                                                              seeInPluginFile

                                                                                                                                                              Checks that a file in a plugin folder contains a string.

                                                                                                                                                              $I->seeInPluginFile('my-plugin/some-file.txt', 'foo');\n
                                                                                                                                                              Parameters
                                                                                                                                                              • string $file - The path to the file, relative to the plugins root folder.
                                                                                                                                                              • string $contents - The contents to check the file for.
                                                                                                                                                              seeInThemeFile

                                                                                                                                                              Checks that a file in a theme folder contains a string.

                                                                                                                                                              <?php\n  $I->seeInThemeFile('my-theme/some-file.txt', 'foo');\n  ?>\n
                                                                                                                                                              Parameters
                                                                                                                                                              • string $file - The path to the file, relative to the themes root folder.
                                                                                                                                                              • string $contents - The contents to check the file for.
                                                                                                                                                              seeInUploadedFile

                                                                                                                                                              Checks that a file in the uploads folder contains a string. The date argument can be a string compatible with strtotime or a Unix timestamp that will be used to build the Y/m uploads subfolder path.

                                                                                                                                                              $I->seeInUploadedFile('some-file.txt', 'foo');\n  $I->seeInUploadedFile('some-file.txt','foo', 'today');\n
                                                                                                                                                              Parameters
                                                                                                                                                              • string $file - The file path, relative to the uploads folder or the current folder.
                                                                                                                                                              • string $contents - The expected file contents or part of them.
                                                                                                                                                              • string/int $date - A string compatible with strtotime or a Unix timestamp.
                                                                                                                                                              seeMuPluginFileFound

                                                                                                                                                              Checks that a file is found in a mu-plugin folder.

                                                                                                                                                              $I->seeMuPluginFileFound('mu-plugin1/some-file.txt');\n
                                                                                                                                                              Parameters
                                                                                                                                                              • string $file - The path to the file, relative to the mu-plugins folder.
                                                                                                                                                              seePluginFileFound

                                                                                                                                                              Checks that a file is found in a plugin folder.

                                                                                                                                                              $I->seePluginFileFound('my-plugin/some-file.txt');\n
                                                                                                                                                              Parameters
                                                                                                                                                              • string $file - The path to the file, relative to thep plugins root folder.
                                                                                                                                                              seeThemeFileFound

                                                                                                                                                              Checks that a file is found in a theme folder.

                                                                                                                                                              $I->seeThemeFileFound('my-theme/some-file.txt');\n
                                                                                                                                                              Parameters
                                                                                                                                                              • string $file - The path to the file, relative to the themes root folder.
                                                                                                                                                              seeUploadedFileFound

                                                                                                                                                              Checks if file exists in the uploads folder. The date argument can be a string compatible with strtotime or a Unix timestamp that will be used to build the Y/m uploads subfolder path.

                                                                                                                                                              $I->seeUploadedFileFound('some-file.txt');\n  $I->seeUploadedFileFound('some-file.txt','today');\n  ?>\n
                                                                                                                                                              Parameters
                                                                                                                                                              • string $filename - The file path, relative to the uploads folder or the current folder.
                                                                                                                                                              • string/int $date - A string compatible with strtotime or a Unix timestamp.
                                                                                                                                                              writeToMuPluginFile

                                                                                                                                                              Writes a file in a mu-plugin folder.

                                                                                                                                                              $I->writeToMuPluginFile('mu-plugin1/some-file.txt', 'foo');\n
                                                                                                                                                              Parameters
                                                                                                                                                              • string $file - The path to the destination file, relative to the mu-plugins root folder.
                                                                                                                                                              • string $data - The data to write to the file.
                                                                                                                                                              writeToPluginFile

                                                                                                                                                              Writes a file in a plugin folder.

                                                                                                                                                              $I->writeToPluginFile('my-plugin/some-file.txt', 'foo');\n
                                                                                                                                                              Parameters
                                                                                                                                                              • string $file - The path to the file, relative to the plugins root folder.
                                                                                                                                                              • string $data - The data to write in the file.
                                                                                                                                                              writeToThemeFile

                                                                                                                                                              Writes a string to a file in a theme folder.

                                                                                                                                                              $I->writeToThemeFile('my-theme/some-file.txt', 'foo');\n
                                                                                                                                                              Parameters
                                                                                                                                                              • string $file - The path to the file, relative to the themese root folder.
                                                                                                                                                              • string $data - The data to write to the file.
                                                                                                                                                              writeToUploadedFile

                                                                                                                                                              Writes a string to a file in the the uploads folder. The date argument can be a string compatible with strtotime or a Unix timestamp that will be used to build the Y/m uploads subfolder path.

                                                                                                                                                              $I->writeToUploadedFile('some-file.txt', 'foo bar');\n  $I->writeToUploadedFile('some-file.txt', 'foo bar', 'today');\n
                                                                                                                                                              Parameters
                                                                                                                                                              • string $filename - The path to the destination file, relative to the current uploads folder.
                                                                                                                                                              • string $data - The data to write to the file.
                                                                                                                                                              • string/int/[\\DateTime](http://php.net/manual/en/class.datetime.php) $date - The date of the uploads to delete, will default to now.

                                                                                                                                                              This class extends \\Codeception\\Module\\Filesystem

                                                                                                                                                              "},{"location":"v3/modules/WPLoader/","title":"WPLoader module","text":"

                                                                                                                                                              This module should be used in integration tests, see levels of testing for more information, to bootstrap WordPress code in the context of the tests. Setting the loadOnly parameter to true the module can be additionally used in acceptance and functional tests to access WordPress code in the tests context. This module is a wrapper around the functionalities provided by the WordPress PHPUnit Core test suite, as such it provides the same method and facilities. The parameters provided to the module duplicate the ones used in the WordPress configuration file: the WPLoader module will not bootstrap WordPress using the wp-config.php file, it will define and use its own WordPress configuration built from the module parameters.

                                                                                                                                                              "},{"location":"v3/modules/WPLoader/#everything-happens-in-a-transaction","title":"Everything happens in a transaction","text":"

                                                                                                                                                              When used to bootstrap and install WordPress (loadOnly: false) exactly as the the WordPress PHPUnit Core test suite it is based on, this module will operate any change to the database in a transaction. This means that, in the context of integration tests, the result of any write or delete operation done during the tests will be rolled back at the end of each test method; this is done for a number of reasons like performance and tests independence. Inspection of the database during tests, e.g. stopping execution using XDebug, will not show any change in the database. Keep this in mind while trying to debug integration tests using the WPLoader module. When configured to only load WordPress (loadOnly: true) then any database operation will be committed and written to the database.

                                                                                                                                                              "},{"location":"v3/modules/WPLoader/#configuration","title":"Configuration","text":"
                                                                                                                                                              • wpRootFolder required The absolute, or relative to the project root folder, path to the root WordPress installation folder. The WordPress installation root folder is the one that contains the wp-load.php file.
                                                                                                                                                              • dbName required - The name of the database used by the WordPress installation, same as the DB_NAME constant.
                                                                                                                                                              • dbHost required - The host of the database used by the WordPress installation, same as the DB_HOST constant. If the database is accessible (as is the case on the latest version of [Local by Flywheel][http://localwp.com]) via unix socket, then the string to insert here should look like this localhost:/path/to/the/mysql.sock.
                                                                                                                                                              • dbUser required - The user of the database used by the WordPress installation, same as the DB_USER constant.
                                                                                                                                                              • dbPassword required - The password of the database used by the WordPress installation, same as DB_PASSWORD constant.
                                                                                                                                                              • loadOnly - defaults to false; whether to only load WordPress, without bootstrapping a fresh installation for tests or not. Read more in the \"Using WPLoader in acceptance and functional tests\" section. If this parameter is set to true the following parameters will not apply.
                                                                                                                                                              • isolatedInstall - defaults to true, whether to install and bootstrap the WordPress installation in a secondary PHP thread for thread safety or not. Maintained for back-compatibility purposes with wp-browser first versions: to get a replica of the bootstrap process used by WordPress Core PHPUnit tests leave this to true.
                                                                                                                                                              • installationTableHandling - defaults to empty; it controls how tables created by WordPress and plugins will be handled during the installation of WordPress during tests. By default tables will be emptied of any content, but some plugins might require tables to be dropped before WordPress is installed and after plugins are activated (this used to be the default behavior). Supported values are drop to drop the tables, empty to just empty the tables and let to do nothing about the tables. If you get errors from database queries while the WPLoader module installs the tests, then try changing this parameter value.
                                                                                                                                                              • wpDebug - defaults to true, the value the WP_DEBUG constant will be set to.
                                                                                                                                                              • multisite - defaults to false, the value the MULTISITE constant will be set to.
                                                                                                                                                              • skipPluggables - defaults to false, if set to true will skip the definition of pluggable functions.
                                                                                                                                                              • dbCharset - defaults to utf8, the value the DB_CHARSET constant will be set to.
                                                                                                                                                              • dbCollate - defaults to an empty string, the value the DB_COLLATE constant will be set to.
                                                                                                                                                              • tablePrefix - defaults to wptests_, the value the $table_prefix variable will be set to.
                                                                                                                                                              • domain - defaults to example.org, the domain of the WordPress site to scaffold for the tests.
                                                                                                                                                              • adminEmail - defaults to admin@example.org, the email of the WordPress site to scaffold for the tests.
                                                                                                                                                              • title - defaults to Test Blog, the title of the WordPress site to scaffolded for the tests.
                                                                                                                                                              • phpBinary - defaults to php, the PHP binary the host machine will have to use to bootstrap and load the test WordPress installation.
                                                                                                                                                              • language - defaults to an empty string, the language of the WordPress installation to scaffold.
                                                                                                                                                              • configFile - defaults to an empty string, an additional configuration file to include before loading WordPress. Any instruction in this fill will run before any WordPress file is included.
                                                                                                                                                              • contentFolder - defaults to an empty string; the path, relative to the wpRootFolder or absolute, to the content folder if different from the default one or the one defined by the WP_CONTENT_DIR constant; if the WP_CONTENT_DIR constant is defined in a config file (see the configFile parameter) this will be ignored.
                                                                                                                                                              • pluginsFolder - defaults to an empty string; the path, relative to the wpRootFolder or absolute, to the plugins folder from the wpRootFolder if different from the default one or the one defined by the WP_PLUGIN_DIR constant; if the WP_PLUGIN_DIR constant is defined in a config file (see the configFile parameter) this will be ignored.
                                                                                                                                                              • plugins - defaults to an empty string; a list of plugins that should be loaded before any test case runs and after mu-plugins have been loaded; these should be defined in the folder/plugin-file.php format.
                                                                                                                                                              • activatePlugins - defaults to an empty string, a list of plugins that will be activated before any test case runs and after WordPress is fully loaded and set up; these should be defined in the folder/plugin-file.php format; when the multisite option is set to true the plugins will be network activated during the installation.
                                                                                                                                                              • bootstrapActions - defaults to an empty string, a list of actions or static functions that should be called after before any test case runs, after plugins have been loaded and activated; static functions should be defined in the YAML array format: yaml bootstrapActions: - action_one - action_two - [MyClass, myStaticMethod]
                                                                                                                                                              • theme - defaults to an empty string, the theme that should be activated for the tests; if a string is passed then both template and stylesheet options will be set to the passed value; if an array is passed then the template and stylesheet will be set in that order:

                                                                                                                                                                yaml theme: my-theme

                                                                                                                                                                The theme will be set to my-theme.

                                                                                                                                                                yaml theme: [ parent, child ]

                                                                                                                                                                The template will be set to parent, the stylesheet will be set to child.

                                                                                                                                                              A word of caution: right now the only way to write tests able to take advantage of the suite is to use the WP_UnitTestCase test case class; while the module will load fine and will raise no problems WP_UnitTestCase will take care of handling the database as intended and using another test case class will almost certainly result in an error if the test case defines more than one test method.

                                                                                                                                                              "},{"location":"v3/modules/WPLoader/#example-configuration","title":"Example configuration","text":"
                                                                                                                                                                modules:\n      enabled:\n          - WPLoader\n      config:\n          WPLoader:\n              multisite: false\n              wpRootFolder: \"/Users/luca/www/wordpress\"\n              dbName: \"wordpress_tests\"\n              dbHost: \"localhost\"\n              dbUser: \"root\"\n              dbPassword: \"password\"\n              isolatedInstall: true\n              installationTableHandling: drop\n              tablePrefix: \"wptests_\"\n              domain: \"wordrpess.localhost\"\n              adminEmail: \"admin@wordpress.localhost\"\n              title: \"Test Blog\"\n              theme: my-theme\n              plugins: ['hello.php', 'my-plugin/my-plugin.php']\n              activatePlugins: ['hello.php', 'my-plugin/my-plugin.php']\n
                                                                                                                                                              "},{"location":"v3/modules/WPLoader/#usage-in-integration-or-wordpress-unit-tests","title":"Usage in integration or \"WordPress unit\" tests","text":"

                                                                                                                                                              The most common use of this module is to run integration, or \"WordPress unit\" tests (see levels of testing for more information).

                                                                                                                                                              As a first step generate a WPTestCase using Codeception command-line utility (see the commands provided by wp-browser):

                                                                                                                                                              codecept generate:wpunit my_suite \"Acme\\User\"\n

                                                                                                                                                              Codeception will generate the tests/my_suite/Acme/UserTest.php class. The class extends the Codeception\\TestCase\\WPTestCase class provided by wp-browser; this looks like a normal PHPUnit test case but has some perks due to it's mixed breed nature. Understanding them might help you work with it:

                                                                                                                                                              • WordPress is installed and configured for the tests before the test case is loaded; WordPress defined functions and classes (and those of the plugins and themes loaded with it) will be available in the setUpBeforeClass method.
                                                                                                                                                              • WordPress is not loaded when PHPUnit will call the data provider methods; this means the post_provider method will generate a function not found exception when the test case runs as the WordPress defined methods are not loaded yet: ``php public function post_provider(){ //wp_insert_post` is loaded with WordPress and WordPress has not been loaded yet! return [ [wp_insert_post(['post_title' => 'Test', 'post_status' => 'publish'])] ]; }

                                                                                                                                                                public function test_posts($post_id){ $this->assertInstanceOf(WP_Post::class, get_post($post_id)); } * WordPress is reset to an initial known state before each test runs; the database transaction is rolled back to wipe any data and tables you might have manipulated in the tests, the global space is cleaned. See [Everything happens in a transaction](#everything-happens-in-a-transaction). * This is a [Codeception Unit test](https://codeception.com/docs/05-UnitTests), as such it does provide access to the `$this->tester` property to access the methods defined in other modules loaded in the suite and to [Codeception test doubles](https://codeception.com/docs/05-UnitTests#Test-Doubles) * This is a [PhpUnit](https://phpunit.de/ \"PHPUnit \u2013 The PHP Testing Framework\") test case too; there are way too many testing functions to cover to report them here but, to highlight a few: [mocking with Prophecy](https://phpunit.readthedocs.io/en/8.2/test-doubles.html) and the wealth of [PHPUnit assertion methods](https://phpunit.readthedocs.io/en/8.2/writing-tests-for-phpunit.html). * This is kind of a WordPress Core suite test case; as such it provides access to its functions and to the often-overlooked `static::factory()` method; in this instance too there are too many methods to list them all but it's worth noting how easy it is to set up test fixtures with the factory:php public function test_post_creation(){ $random_post_id = static::factory()->post->create();

                                                                                                                                                                    $this->assertInstanceOf(WP_Post::class, get_post($random_post_id));\n

                                                                                                                                                                } * The `factory` property can be accessed on the `tester` property too and will work the same way as if called using `static::factory()`:php public function test_post_creation(){ $random_post_id = $this->tester->factory()->post->create();

                                                                                                                                                                    $this->assertInstanceOf(WP_Post::class, get_post($random_post_id));\n

                                                                                                                                                                } ```

                                                                                                                                                              "},{"location":"v3/modules/WPLoader/#wploader-to-only-bootstrap-wordpress","title":"WPLoader to only bootstrap WordPress","text":"

                                                                                                                                                              If the need is to just bootstrap the WordPress installation in the context of the tests variable scope then the WPLoader module loadOnly parameter should be set to true; this could be the case for functional tests in need to access WordPress provided methods, functions and values. An example configuration for the module in this mode is this one:

                                                                                                                                                                modules:\n      enabled:\n          - WPDb # BEFORE the WPLoader one!\n          - WPLoader # AFTER the WPDb one!\n      config:\n          WPDb:\n              dsn: 'mysql:host=localhost;dbname=wordpress'\n              user: 'root'\n              password: 'password'\n              dump: 'tests/_data/dump.sql'\n              populate: true\n              cleanup: true\n              waitlock: 10\n              url: 'http://wordpress.localhost'\n              urlReplacement: true\n              tablePrefix: 'wp_'\n          WPLoader:\n              loadOnly: true \n              wpRootFolder: \"/Users/User/www/wordpress\"\n              dbName: \"wpress-tests\"\n              dbHost: \"localhost\"\n              dbUser: \"root\"\n              dbPassword: \"root\"\n              domain: \"wordpress.localhost\"\n

                                                                                                                                                              With reference to the table above the module will not take care of the test WordPress installation state before and after the tests, the installed and activated plugins, and theme. The module can be used in conjunction with a WPDb module to provide the tests with a WordPress installation suiting the tests at hand; when doing so please take care to list, in the suite configuration file modules section (see example above) the WPDb module before the WPLoader one. Codeception will initialize the modules in the same order they are listed in the modules section of the suite configuration file and the WPLoader module needs the database to be populated by the WPDb module before it runs! As an example this is a correct suite configuration:

                                                                                                                                                              modules:\n  enabled:\n      - WPDb # this before...\n      - WPLoader # ...this one.\n  config:\n      WPDb:\n        # ...\n      WPLoader:\n        loadOnly: true\n        # ... \n
                                                                                                                                                              "},{"location":"v3/modules/WPLoader/#public-api","title":"Public API","text":"
                                                                                                                                                              • debugWpActionFinal
                                                                                                                                                              • debugWpActionInitial
                                                                                                                                                              • debugWpFilterFinal
                                                                                                                                                              • debugWpFilterInitial
                                                                                                                                                              • factory
                                                                                                                                                              • getContentFolder
                                                                                                                                                              • getPluginsFolder
                                                                                                                                                              • startWpFiltersDebug
                                                                                                                                                              • stopWpFiltersDebug
                                                                                                                                                              debugWpActionFinal

                                                                                                                                                              Debugs a single WordPress action final call using Codeception debug functions. The output will show following the selected output verbosity (--debug and -vvv CLI options).

                                                                                                                                                              // Start debugging all WordPress actions final value.\n  add_action('all', [$this,'debugWpActionFinal']);\n  // Run some code firing actions and debug them.\n  // Stop debugging all WordPress actions final value.\n  remove_action('all', [$this,'debugWpActionFinal']);\n
                                                                                                                                                              Parameters
                                                                                                                                                              • mixed $args
                                                                                                                                                              debugWpActionInitial

                                                                                                                                                              Debugs a single WordPress action initial call using Codeception debug functions. The output will show following the selected output verbosity (--debug and -vvv CLI options).

                                                                                                                                                              // Start debugging all WordPress actions initial value.\n  add_action('all', [$this,'debugWpActionInitial']);\n  // Run some code firing actions and debug them.\n  // Stop debugging all WordPress actions initial value.\n  remove_action('all', [$this,'debugWpActionInitial']);\n
                                                                                                                                                              Parameters
                                                                                                                                                              • mixed $args
                                                                                                                                                              debugWpFilterFinal

                                                                                                                                                              Debugs a single WordPress filter final call using Codeception debug functions. The output will show following the selected output verbosity (--debug and -vvv CLI options).

                                                                                                                                                              // Start debugging all WordPress filters final value.\n  add_filter('all', [$this,'debugWpFilterFinal']);\n  // Run some code firing filters and debug them.\n  // Stop debugging all WordPress filters final value.\n  remove_filter('all', [$this,'debugWpFilterFinal']);\n
                                                                                                                                                              Parameters
                                                                                                                                                              • mixed $args
                                                                                                                                                              debugWpFilterInitial

                                                                                                                                                              Debugs a single WordPress filter initial call using Codeception debug functions. The output will show following the selected output verbosity (--debug and -vvv CLI options).

                                                                                                                                                              // Start debugging all WordPress filters initial value.\n  add_filter('all', [$this,'debugWpFilterInitial']);\n  // Run some code firing filters and debug them.\n  // Stop debugging all WordPress filters initial value.\n  remove_filter('all', [$this,'debugWpFilterInitial']);\n
                                                                                                                                                              Parameters
                                                                                                                                                              • mixed $args
                                                                                                                                                              factory

                                                                                                                                                              Accessor method to get the object storing the factories for things. This methods gives access to the same factories provided by the Core test suite.

                                                                                                                                                              $postId = $I->factory()->post->create();\n  $userId = $I->factory()->user->create(['role' => 'administrator']);\n
                                                                                                                                                              getContentFolder

                                                                                                                                                              Returns the absolute path to the WordPress content directory.

                                                                                                                                                              $content = $this->getContentFolder();\n  $themes = $this->getContentFolder('themes');\n  $twentytwenty = $this->getContentFolder('themes/twentytwenty');\n
                                                                                                                                                              Parameters
                                                                                                                                                              • string $path - An optional path to append to the content directory absolute path.
                                                                                                                                                              getPluginsFolder

                                                                                                                                                              Returns the absolute path to the plugins directory. The value will first look at the WP_PLUGIN_DIR constant, then the pluginsFolder configuration parameter and will, finally, look in the default path from the WordPress root directory.

                                                                                                                                                              $plugins = $this->getPluginsFolder();\n  $hello = $this->getPluginsFolder('hello.php');\n
                                                                                                                                                              Parameters
                                                                                                                                                              • string $path - A relative path to append to te plugins directory absolute path.
                                                                                                                                                              startWpFiltersDebug

                                                                                                                                                              Starts the debug of all WordPress filters and actions. The method hook on all filters and actions to debug their value.

                                                                                                                                                              // Start debugging all WordPress filters and action final and initial values.\n  $this->startWpFiltersDebug();\n  // Run some code firing filters and debug them.\n  // Stop debugging all WordPress filters and action final and initial values.\n  $this->stopWpFiltersDebug();\n  the array of arguments as input.\n
                                                                                                                                                              Parameters
                                                                                                                                                              • \\callable $format - A callback function to format the arguments debug output; the callback will receive
                                                                                                                                                              stopWpFiltersDebug

                                                                                                                                                              Stops the debug of all WordPress filters and actions.

                                                                                                                                                              // Start debugging all WordPress filters and action final and initial values.\n  $this->startWpFiltersDebug();\n  // Run some code firing filters and debug them.\n  // Stop debugging all WordPress filters and action final and initial values.\n  $this->stopWpFiltersDebug();\n

                                                                                                                                                              This class extends \\Codeception\\Module

                                                                                                                                                              "},{"location":"v3/modules/WPQueries/","title":"WPQueries module","text":"

                                                                                                                                                              This module should be used in integration tests, see levels of testing for more information, to make assertions on the database queries made by the global $wpdb object. This module requires the WPLoader module to work. The module will set, if not set already, the SAVEQUERIES constant to true and will throw an exception if the constant is already set to a falsy value.

                                                                                                                                                              "},{"location":"v3/modules/WPQueries/#configuration","title":"Configuration","text":"

                                                                                                                                                              This module does not require any configuration, but requires the WPLoader module to work correctly.

                                                                                                                                                              "},{"location":"v3/modules/WPQueries/#usage","title":"Usage","text":"

                                                                                                                                                              This module must be used in a test case extending the \\Codeception\\TestCase\\WPTestCase class.

                                                                                                                                                              The module public API is accessible calling via the \\Codeception\\TestCase\\WPTestCase::queries() method:

                                                                                                                                                              <?php\n\nuse Codeception\\Module\\WPQueries;\n\nclass WPQueriesUsageTest extends \\Codeception\\TestCase\\WPTestCase\n{\n    public function test_queries_made_by_factory_are_not_tracked()\n    {\n        $currentQueriesCount = $this->queries()->countQueries();\n\n        $this->assertNotEmpty($currentQueriesCount);\n\n        static::factory()->post->create_many(3);\n\n        $this->assertNotEmpty($currentQueriesCount);\n        $this->assertEquals($currentQueriesCount, $this->queries()->countQueries());\n    }\n\n    public function test_count_queries()\n    {\n        $currentQueriesCount = $this->queries()->countQueries();\n\n        $this->assertNotEmpty($currentQueriesCount);\n\n        foreach (range(1, 3) as $i) {\n            wp_insert_post(['post_title' => 'Post ' . $i, 'post_content' => str_repeat('test', $i)]);\n        }\n\n        $this->assertNotEmpty($currentQueriesCount);\n        $this->assertGreaterThan($currentQueriesCount, $this->queries()->countQueries());\n    }\n}\n
                                                                                                                                                              "},{"location":"v3/modules/WPQueries/#public-api","title":"Public API","text":"
                                                                                                                                                              • assertCountQueries
                                                                                                                                                              • assertNotQueries
                                                                                                                                                              • assertNotQueriesByAction
                                                                                                                                                              • assertNotQueriesByFilter
                                                                                                                                                              • assertNotQueriesByFunction
                                                                                                                                                              • assertNotQueriesByMethod
                                                                                                                                                              • assertNotQueriesByStatement
                                                                                                                                                              • assertNotQueriesByStatementAndAction
                                                                                                                                                              • assertNotQueriesByStatementAndFilter
                                                                                                                                                              • assertNotQueriesByStatementAndFunction
                                                                                                                                                              • assertNotQueriesByStatementAndMethod
                                                                                                                                                              • assertQueries
                                                                                                                                                              • assertQueriesByAction
                                                                                                                                                              • assertQueriesByFilter
                                                                                                                                                              • assertQueriesByFunction
                                                                                                                                                              • assertQueriesByMethod
                                                                                                                                                              • assertQueriesByStatement
                                                                                                                                                              • assertQueriesByStatementAndAction
                                                                                                                                                              • assertQueriesByStatementAndFilter
                                                                                                                                                              • assertQueriesByStatementAndFunction
                                                                                                                                                              • assertQueriesByStatementAndMethod
                                                                                                                                                              • assertQueriesCountByAction
                                                                                                                                                              • assertQueriesCountByFilter
                                                                                                                                                              • assertQueriesCountByFunction
                                                                                                                                                              • assertQueriesCountByMethod
                                                                                                                                                              • assertQueriesCountByStatement
                                                                                                                                                              • assertQueriesCountByStatementAndAction
                                                                                                                                                              • assertQueriesCountByStatementAndFilter
                                                                                                                                                              • assertQueriesCountByStatementAndFunction
                                                                                                                                                              • assertQueriesCountByStatementAndMethod
                                                                                                                                                              • countQueries
                                                                                                                                                              • getQueries
                                                                                                                                                              assertCountQueries

                                                                                                                                                              Asserts that n queries have been made.

                                                                                                                                                              $posts = $this->factory()->post->create_many(3);\n  $cachedUsers = $this->factory()->user->create_many(2);\n  $nonCachedUsers = $this->factory()->user->create_many(2);\n  foreach($cachedUsers as $userId){\n  wp_cache_set('page-posts-for-user-' . $userId, $posts, 'acme');\n  }\n  // Run the same query as different users\n  foreach(array_merge($cachedUsers, $nonCachedUsers) as $userId){\n  $pagePosts = $plugin->getPagePostsForUser($userId);\n  }\n  $I->assertCountQueries(2, 'A query should be made for each user missing cached posts.')\n
                                                                                                                                                              Parameters
                                                                                                                                                              • int $n - The expected number of queries.
                                                                                                                                                              • string $message - An optional message to override the default one.
                                                                                                                                                              assertNotQueries

                                                                                                                                                              Asserts that no queries were made. Queries generated by setUp, tearDown and factory methods are excluded by default.

                                                                                                                                                              $posts = $this->factory()->post->create_many(3);\n  wp_cache_set('page-posts', $posts, 'acme');\n  $pagePosts = $plugin->getPagePosts();\n  $I->assertNotQueries('Queries should not be made if the cache is set.')\n
                                                                                                                                                              Parameters
                                                                                                                                                              • string $message - An optional message to override the default one.
                                                                                                                                                              assertNotQueriesByAction

                                                                                                                                                              Asserts that no queries were made as a consequence of the specified action. Queries generated by setUp, tearDown and factory methods are excluded by default.

                                                                                                                                                              add_action( 'edit_post', function($postId){\n  $count = get_option('acme_title_updates_count');\n  update_option('acme_title_updates_count', ++$count);\n  } );\n  wp_delete_post($bookId);\n  $this->assertNotQueriesByAction('edit_post');\n
                                                                                                                                                              Parameters
                                                                                                                                                              • string $action - The action name, e.g. 'init'.
                                                                                                                                                              • string $message - An optional message to override the default one.
                                                                                                                                                              assertNotQueriesByFilter

                                                                                                                                                              Asserts that no queries were made as a consequence of the specified filter. Queries generated by setUp, tearDown and factory methods are excluded by default.

                                                                                                                                                              add_filter('the_title', function($title, $postId){\n  $post = get_post($postId);\n  if($post->post_type !== 'book'){\n  return $title;\n  }\n  $new = get_option('acme_new_prefix');\n  return \"{$new} - \" . $title;\n  });\n  $title = apply_filters('the_title', get_post($notABookId)->post_title, $notABookId);\n  $this->assertNotQueriesByFilter('the_title');\n
                                                                                                                                                              Parameters
                                                                                                                                                              • string $filter - The filter name, e.g. 'posts_where'.
                                                                                                                                                              • string $message - An optional message to override the default one.
                                                                                                                                                              assertNotQueriesByFunction

                                                                                                                                                              Asserts that no queries were made by the specified function. Queries generated by setUp, tearDown and factory methods are excluded by default.

                                                                                                                                                              $this->assertEmpty(Acme\\get_orphaned_posts());\n  Acme\\delete_orphaned_posts();\n  $this->assertNotQueriesByFunction('Acme\\delete_orphaned_posts');\n
                                                                                                                                                              Parameters
                                                                                                                                                              • string $function - The fully qualified name of the function to check.
                                                                                                                                                              • string $message - An optional message to override the default one.
                                                                                                                                                              assertNotQueriesByMethod

                                                                                                                                                              Asserts that no queries have been made by the specified class method. Queries generated by setUp, tearDown and factory methods are excluded by default.

                                                                                                                                                              $options = new Acme\\Options();\n  $options->update('adsSource', 'not-a-real-url.org');\n  $I->assertNotQueriesByMethod('Acme\\Options', 'update');\n
                                                                                                                                                              Parameters
                                                                                                                                                              • string $class - The fully qualified name of the class to check.
                                                                                                                                                              • string $method - The name of the method to check.
                                                                                                                                                              • string $message - An optional message to override the default one.
                                                                                                                                                              assertNotQueriesByStatement

                                                                                                                                                              Asserts that no queries have been made by the specified class method. Queries generated by setUp, tearDown and factory methods are excluded by default.

                                                                                                                                                              $bookRepository = new Acme\\BookRepository();\n  $repository->where('ID', 23)->set('title', 'Peter Pan', $deferred = true);\n  $this->assertNotQueriesByStatement('INSERT', 'Deferred write should happen on __destruct');\n  Regular expressions must contain delimiters.\n
                                                                                                                                                              Parameters
                                                                                                                                                              • string $statement - A simple string the statement should start with or a valid regular expression.
                                                                                                                                                              • string $message - An optional message to override the default one.
                                                                                                                                                              assertNotQueriesByStatementAndAction

                                                                                                                                                              Asserts that no queries were made as a consequence of the specified action containing the SQL query. Queries generated by setUp, tearDown and factory methods are excluded by default.

                                                                                                                                                              add_action( 'edit_post', function($postId){\n  $count = get_option('acme_title_updates_count');\n  update_option('acme_title_updates_count', ++$count);\n  } );\n  wp_delete_post($bookId);\n  $this->assertNotQueriesByStatementAndAction('DELETE', 'delete_post');\n  Regular expressions must contain delimiters.\n
                                                                                                                                                              Parameters
                                                                                                                                                              • string $statement - A simple string the statement should start with or a valid regular expression.
                                                                                                                                                              • string $action - The action name, e.g. 'init'.
                                                                                                                                                              • string $message - An optional message to override the default one.
                                                                                                                                                              assertNotQueriesByStatementAndFilter

                                                                                                                                                              Asserts that no queries were made as a consequence of the specified filter containing the specified SQL query. Queries generated by setUp, tearDown and factory methods are excluded by default.

                                                                                                                                                              add_filter('the_title', function($title, $postId){\n  $post = get_post($postId);\n  if($post->post_type !== 'book'){\n  return $title;\n  }\n  $new = get_option('acme_new_prefix');\n  return \"{$new} - \" . $title;\n  });\n  $title = apply_filters('the_title', get_post($notABookId)->post_title, $notABookId);\n  $this->assertNotQueriesByStatementAndFilter('SELECT', 'the_title');\n  Regular expressions must contain delimiters.\n
                                                                                                                                                              Parameters
                                                                                                                                                              • string $statement - A simple string the statement should start with or a valid regular expression.
                                                                                                                                                              • string $filter - The filter name, e.g. 'posts_where'.
                                                                                                                                                              • string $message - An optional message to override the default one.
                                                                                                                                                              assertNotQueriesByStatementAndFunction

                                                                                                                                                              Asserts that no queries were made by the specified function starting with the specified SQL statement. Queries generated by setUp, tearDown and factory methods are excluded by default.

                                                                                                                                                              wp_insert_post(['ID' => $bookId, 'post_title' => 'The Call of the Wild']);\n  $this->assertNotQueriesByStatementAndFunction('INSERT', 'wp_insert_post');\n  $this->assertQueriesByStatementAndFunction('UPDATE', 'wp_insert_post');\n  Regular expressions must contain delimiters.\n
                                                                                                                                                              Parameters
                                                                                                                                                              • string $statement - A simple string the statement should start with or a valid regular expression.
                                                                                                                                                              • string $function - The name of the function to check the assertions for.
                                                                                                                                                              • string $message - An optional message to override the default one.
                                                                                                                                                              assertNotQueriesByStatementAndMethod

                                                                                                                                                              Asserts that no queries were made by the specified class method starting with the specified SQL statement. Queries generated by setUp, tearDown and factory methods are excluded by default.

                                                                                                                                                              Acme\\BookRepository::new(['title' => 'Alice in Wonderland'])->commit();\n  $this->assertQueriesByStatementAndMethod('INSERT', Acme\\BookRepository::class, 'commit');\n  Regular expressions must contain delimiters.\n
                                                                                                                                                              Parameters
                                                                                                                                                              • string $statement - A simple string the statement should start with or a valid regular expression.
                                                                                                                                                              • string $class - The fully qualified name of the class to check.
                                                                                                                                                              • string $method - The name of the method to check.
                                                                                                                                                              • string $message - An optional message to override the default one.
                                                                                                                                                              assertQueries

                                                                                                                                                              Asserts that at least one query was made during the test. Queries generated by setUp, tearDown and factory methods are excluded by default.

                                                                                                                                                              wp_cache_delete('page-posts', 'acme');\n  $pagePosts = $plugin->getPagePosts();\n  $I->assertQueries('Queries should be made to set the cache.')\n
                                                                                                                                                              Parameters
                                                                                                                                                              • string $message - An optional message to override the default one.
                                                                                                                                                              assertQueriesByAction

                                                                                                                                                              Asserts that at least one query was made as a consequence of the specified action. Queries generated by setUp, tearDown and factory methods are excluded by default.

                                                                                                                                                              add_action( 'edit_post', function($postId){\n  $count = get_option('acme_title_updates_count');\n  update_option('acme_title_updates_count', ++$count);\n  } );\n  wp_update_post(['ID' => $bookId, 'post_title' => 'New Title']);\n  $this->assertQueriesByAction('edit_post');\n
                                                                                                                                                              Parameters
                                                                                                                                                              • string $action - The action name, e.g. 'init'.
                                                                                                                                                              • string $message - An optional message to override the default one.
                                                                                                                                                              assertQueriesByFilter

                                                                                                                                                              Asserts that at least one query was made as a consequence of the specified filter. Queries generated by setUp, tearDown and factory methods are excluded by default.

                                                                                                                                                              add_filter('the_title', function($title, $postId){\n  $post = get_post($postId);\n  if($post->post_type !== 'book'){\n  return $title;\n  }\n  $new = get_option('acme_new_prefix');\n  return \"{$new} - \" . $title;\n  });\n  $title = apply_filters('the_title', get_post($bookId)->post_title, $bookId);\n  $this->assertQueriesByFilter('the_title');\n
                                                                                                                                                              Parameters
                                                                                                                                                              • string $filter - The filter name, e.g. 'posts_where'.
                                                                                                                                                              • string $message - An optional message to override the default one.
                                                                                                                                                              assertQueriesByFunction

                                                                                                                                                              Asserts that queries were made by the specified function. Queries generated by setUp, tearDown and factory methods are excluded by default.

                                                                                                                                                              acme_clean_queue();\n  $this->assertQueriesByFunction('acme_clean_queue');\n
                                                                                                                                                              Parameters
                                                                                                                                                              • string $function - The fully qualified name of the function to check.
                                                                                                                                                              • string $message - An optional message to override the default one.
                                                                                                                                                              assertQueriesByMethod

                                                                                                                                                              Asserts that at least one query has been made by the specified class method. Queries generated by setUp, tearDown and factory methods are excluded by default.

                                                                                                                                                              $options = new Acme\\Options();\n  $options->update('showAds', false);\n  $I->assertQueriesByMethod('Acme\\Options', 'update');\n
                                                                                                                                                              Parameters
                                                                                                                                                              • string $class - The fully qualified name of the class to check.
                                                                                                                                                              • string $method - The name of the method to check.
                                                                                                                                                              • string $message - An optional message to override the default one.
                                                                                                                                                              assertQueriesByStatement

                                                                                                                                                              Asserts that at least a query starting with the specified statement was made. Queries generated by setUp, tearDown and factory methods are excluded by default.

                                                                                                                                                              wp_cache_flush();\n  cached_get_posts($args);\n  $I->assertQueriesByStatement('SELECT');\n  Regular expressions must contain delimiters.\n
                                                                                                                                                              Parameters
                                                                                                                                                              • string $statement - A simple string the statement should start with or a valid regular expression.
                                                                                                                                                              • string $message - An optional message to override the default one.
                                                                                                                                                              assertQueriesByStatementAndAction

                                                                                                                                                              Asserts that at least one query was made as a consequence of the specified action containing the SQL query. Queries generated by setUp, tearDown and factory methods are excluded by default.

                                                                                                                                                              add_action( 'edit_post', function($postId){\n  $count = get_option('acme_title_updates_count');\n  update_option('acme_title_updates_count', ++$count);\n  } );\n  wp_update_post(['ID' => $bookId, 'post_title' => 'New']);\n  $this->assertQueriesByStatementAndAction('UPDATE', 'edit_post');\n  Regular expressions must contain delimiters.\n
                                                                                                                                                              Parameters
                                                                                                                                                              • string $statement - A simple string the statement should start with or a valid regular expression.
                                                                                                                                                              • string $action - The action name, e.g. 'init'.
                                                                                                                                                              • string $message - An optional message to override the default one.
                                                                                                                                                              assertQueriesByStatementAndFilter

                                                                                                                                                              Asserts that at least one query was made as a consequence of the specified filter containing the SQL query. Queries generated by setUp, tearDown and factory methods are excluded by default.

                                                                                                                                                              add_filter('the_title', function($title, $postId){\n  $post = get_post($postId);\n  if($post->post_type !== 'book'){\n  return $title;\n  }\n  $new = get_option('acme_new_prefix');\n  return \"{$new} - \" . $title;\n  });\n  $title = apply_filters('the_title', get_post($bookId)->post_title, $bookId);\n  $this->assertQueriesByStatementAndFilter('SELECT', 'the_title');\n  Regular expressions must contain delimiters.\n
                                                                                                                                                              Parameters
                                                                                                                                                              • string $statement - A simple string the statement should start with or a valid regular expression.
                                                                                                                                                              • string $filter - The filter name, e.g. 'posts_where'.
                                                                                                                                                              • string $message - An optional message to override the default one.
                                                                                                                                                              assertQueriesByStatementAndFunction

                                                                                                                                                              Asserts that queries were made by the specified function starting with the specified SQL statement. Queries generated by setUp, tearDown and factory methods are excluded by default.

                                                                                                                                                              wp_insert_post(['post_type' => 'book', 'post_title' => 'Alice in Wonderland']);\n  $this->assertQueriesByStatementAndFunction('INSERT', 'wp_insert_post');\n  Regular expressions must contain delimiters.\n
                                                                                                                                                              Parameters
                                                                                                                                                              • string $statement - A simple string the statement should start with or a valid regular expression.
                                                                                                                                                              • string $function - The fully qualified function name.
                                                                                                                                                              • string $message - An optional message to override the default one.
                                                                                                                                                              assertQueriesByStatementAndMethod

                                                                                                                                                              Asserts that queries were made by the specified class method starting with the specified SQL statement. Queries generated by setUp, tearDown and factory methods are excluded by default.

                                                                                                                                                              Acme\\BookRepository::new(['title' => 'Alice in Wonderland'])->commit();\n  $this->assertQueriesByStatementAndMethod('UPDATE', Acme\\BookRepository::class, 'commit');\n  Regular expressions must contain delimiters.\n
                                                                                                                                                              Parameters
                                                                                                                                                              • string $statement - A simple string the statement should start with or a valid regular expression.
                                                                                                                                                              • string $class - The fully qualified name of the class to check.
                                                                                                                                                              • string $method - The name of the method to check.
                                                                                                                                                              • string $message - An optional message to override the default one.
                                                                                                                                                              assertQueriesCountByAction

                                                                                                                                                              Asserts that n queries were made as a consequence of the specified action. Queries generated by setUp, tearDown and factory methods are excluded by default.

                                                                                                                                                              add_action( 'edit_post', function($postId){\n  $count = get_option('acme_title_updates_count');\n  update_option('acme_title_updates_count', ++$count);\n  } );\n  wp_update_post(['ID' => $bookOneId, 'post_title' => 'One']);\n  wp_update_post(['ID' => $bookTwoId, 'post_title' => 'Two']);\n  wp_update_post(['ID' => $bookThreeId, 'post_title' => 'Three']);\n  $this->assertQueriesCountByAction(3, 'edit_post');\n
                                                                                                                                                              Parameters
                                                                                                                                                              • int $n - The expected number of queries.
                                                                                                                                                              • string $action - The action name, e.g. 'init'.
                                                                                                                                                              • string $message - An optional message to override the default one.
                                                                                                                                                              assertQueriesCountByFilter

                                                                                                                                                              Asserts that n queries were made as a consequence of the specified filter. Queries generated by setUp, tearDown and factory methods are excluded by default.

                                                                                                                                                              add_filter('the_title', function($title, $postId){\n  $post = get_post($postId);\n  if($post->post_type !== 'book'){\n  return $title;\n  }\n  $new = get_option('acme_new_prefix');\n  return \"{$new} - \" . $title;\n  });\n  $title = apply_filters('the_title', get_post($bookOneId)->post_title, $bookOneId);\n  $title = apply_filters('the_title', get_post($notABookId)->post_title, $notABookId);\n  $title = apply_filters('the_title', get_post($bookTwoId)->post_title, $bookTwoId);\n  $this->assertQueriesCountByFilter(2, 'the_title');\n
                                                                                                                                                              Parameters
                                                                                                                                                              • int $n - The expected number of queries.
                                                                                                                                                              • string $filter - The filter name, e.g. 'posts_where'.
                                                                                                                                                              • string $message - An optional message to override the default one.
                                                                                                                                                              assertQueriesCountByFunction

                                                                                                                                                              Asserts that n queries were made by the specified function. Queries generated by setUp, tearDown and factory methods are excluded by default.

                                                                                                                                                              $this->assertCount(3, Acme\\get_orphaned_posts());\n  Acme\\delete_orphaned_posts();\n  $this->assertQueriesCountByFunction(3, 'Acme\\delete_orphaned_posts');\n
                                                                                                                                                              Parameters
                                                                                                                                                              • int $n - The expected number of queries.
                                                                                                                                                              • string $function - The function to check the queries for.
                                                                                                                                                              • string $message - An optional message to override the default one.
                                                                                                                                                              assertQueriesCountByMethod

                                                                                                                                                              Asserts that n queries have been made by the specified class method. Queries generated by setUp, tearDown and factory methods are excluded by default.

                                                                                                                                                              $bookRepository = new Acme\\BookRepository();\n  $repository->where('ID', 23)->commit('title', 'Peter Pan');\n  $repository->where('ID', 89)->commit('title', 'Moby-dick');\n  $repository->where('ID', 2389)->commit('title', 'The call of the wild');\n  $this->assertQueriesCountByMethod(3, 'Acme\\BookRepository', 'commit');\n
                                                                                                                                                              Parameters
                                                                                                                                                              • int $n - The expected number of queries.
                                                                                                                                                              • string $class - The fully qualified name of the class to check.
                                                                                                                                                              • string $method - The name of the method to check.
                                                                                                                                                              • string $message - An optional message to override the default one.
                                                                                                                                                              assertQueriesCountByStatement

                                                                                                                                                              Asserts that n queries starting with the specified statement were made. Queries generated by setUp, tearDown and factory methods are excluded by default.

                                                                                                                                                              $bookRepository = new Acme\\BookRepository();\n  $repository->where('ID', 23)->set('title', 'Peter Pan', $deferred = true);\n  $repository->where('ID', 89)->set('title', 'Moby-dick', $deferred = true);\n  $repository->where('ID', 2389)->set('title', 'The call of the wild', $deferred = false);\n  $this->assertQueriesCountByStatement(1, 'INSERT', 'Deferred write should happen on __destruct');\n  Regular expressions must contain delimiters.\n
                                                                                                                                                              Parameters
                                                                                                                                                              • int $n - The expected number of queries.
                                                                                                                                                              • string $statement - A simple string the statement should start with or a valid regular expression.
                                                                                                                                                              • string $message - An optional message to override the default one.
                                                                                                                                                              assertQueriesCountByStatementAndAction

                                                                                                                                                              Asserts that n queries were made as a consequence of the specified action containing the specified SQL statement. Queries generated by setUp, tearDown and factory methods are excluded by default.

                                                                                                                                                              add_action( 'edit_post', function($postId){\n  $count = get_option('acme_title_updates_count');\n  update_option('acme_title_updates_count', ++$count);\n  } );\n  wp_delete_post($bookOneId);\n  wp_delete_post($bookTwoId);\n  wp_update_post(['ID' => $bookThreeId, 'post_title' => 'New']);\n  $this->assertQueriesCountByStatementAndAction(2, 'DELETE', 'delete_post');\n  $this->assertQueriesCountByStatementAndAction(1, 'INSERT', 'edit_post');\n  Regular expressions must contain delimiters.\n
                                                                                                                                                              Parameters
                                                                                                                                                              • int $n - The expected number of queries.
                                                                                                                                                              • string $statement - A simple string the statement should start with or a valid regular expression.
                                                                                                                                                              • string $action - The action name, e.g. 'init'.
                                                                                                                                                              • string $message - An optional message to override the default one.
                                                                                                                                                              assertQueriesCountByStatementAndFilter

                                                                                                                                                              Asserts that n queries were made as a consequence of the specified filter containing the specified SQL statement. Queries generated by setUp, tearDown and factory methods are excluded by default.

                                                                                                                                                              add_filter('the_title', function($title, $postId){\n  $post = get_post($postId);\n  if($post->post_type !== 'book'){\n  return $title;\n  }\n  $new = get_option('acme_new_prefix');\n  return \"{$new} - \" . $title;\n  });\n  // Warm up the cache.\n  $title = apply_filters('the_title', get_post($bookOneId)->post_title, $bookOneId);\n  // Cache is warmed up now.\n  $title = apply_filters('the_title', get_post($bookTwoId)->post_title, $bookTwoId);\n  $title = apply_filters('the_title', get_post($bookThreeId)->post_title, $bookThreeId);\n  $this->assertQueriesCountByStatementAndFilter(1, 'SELECT', 'the_title');\n  Regular expressions must contain delimiters.\n
                                                                                                                                                              Parameters
                                                                                                                                                              • int $n - The expected number of queries.
                                                                                                                                                              • string $statement - A simple string the statement should start with or a valid regular expression.
                                                                                                                                                              • string $filter - The filter name, e.g. 'posts_where'.
                                                                                                                                                              • string $message - An optional message to override the default one.
                                                                                                                                                              assertQueriesCountByStatementAndFunction

                                                                                                                                                              Asserts that n queries were made by the specified function starting with the specified SQL statement. Queries generated by setUp, tearDown and factory methods are excluded by default.

                                                                                                                                                              wp_insert_post(['post_type' => 'book', 'post_title' => 'The Call of the Wild']);\n  wp_insert_post(['post_type' => 'book', 'post_title' => 'Alice in Wonderland']);\n  wp_insert_post(['post_type' => 'book', 'post_title' => 'The Chocolate Factory']);\n  $this->assertQueriesCountByStatementAndFunction(3, 'INSERT', 'wp_insert_post');\n  Regular expressions must contain delimiters.\n
                                                                                                                                                              Parameters
                                                                                                                                                              • int $n - The expected number of queries.
                                                                                                                                                              • string $statement - A simple string the statement should start with or a valid regular expression.
                                                                                                                                                              • string $function - The fully-qualified function name.
                                                                                                                                                              • string $message - An optional message to override the default one.
                                                                                                                                                              assertQueriesCountByStatementAndMethod

                                                                                                                                                              Asserts that n queries were made by the specified class method starting with the specified SQL statement. Queries generated by setUp, tearDown and factory methods are excluded by default.

                                                                                                                                                              Acme\\BookRepository::new(['title' => 'Alice in Wonderland'])->commit();\n  Acme\\BookRepository::new(['title' => 'Moby-Dick'])->commit();\n  Acme\\BookRepository::new(['title' => 'The Call of the Wild'])->commit();\n  $this->assertQueriesCountByStatementAndMethod(3, 'INSERT', Acme\\BookRepository::class, 'commit');\n  Regular expressions must contain delimiters.\n
                                                                                                                                                              Parameters
                                                                                                                                                              • int $n - The expected number of queries.
                                                                                                                                                              • string $statement - A simple string the statement should start with or a valid regular expression.
                                                                                                                                                              • string $class - The fully qualified name of the class to check.
                                                                                                                                                              • string $method - The name of the method to check.
                                                                                                                                                              • string $message - An optional message to override the default one.
                                                                                                                                                              countQueries

                                                                                                                                                              Returns the current number of queries. Set-up and tear-down queries performed by the test case are filtered out.

                                                                                                                                                              // In a WPTestCase, using the global $wpdb object.\n  $queriesCount = $this->queries()->countQueries();\n  // In a WPTestCase, using a custom $wpdb object.\n  $queriesCount = $this->queries()->countQueries($customWdbb);\n
                                                                                                                                                              Parameters
                                                                                                                                                              • \\wpdb/null $wpdb - A specific instance of the wpdb class or null to use the global one.
                                                                                                                                                              getQueries

                                                                                                                                                              Returns the queries currently performed by the global database object or the specified one. Set-up and tear-down queries performed by the test case are filtered out.

                                                                                                                                                              // In a WPTestCase, using the global $wpdb object.\n  $queries = $this->queries()->getQueries();\n  // In a WPTestCase, using a custom $wpdb object.\n  $queries = $this->queries()->getQueries($customWdbb);\n
                                                                                                                                                              Parameters
                                                                                                                                                              • null/\\wpdb $wpdb - A specific instance of the wpdb class or null to use the global one.

                                                                                                                                                              This class extends \\Codeception\\Module

                                                                                                                                                              "},{"location":"v3/modules/WPWebDriver/","title":"WpWebDriver module","text":"

                                                                                                                                                              This module should be used in acceptance tests, see levels of testing for more information.

                                                                                                                                                              This module extends the WebDriver module adding WordPress-specific configuration parameters and methods.

                                                                                                                                                              The module simulates a user interaction with the site with Javascript support; if you don't need to test your project with Javascript support use the WPBrowser module.

                                                                                                                                                              "},{"location":"v3/modules/WPWebDriver/#module-requirements-for-codeception-40","title":"Module requirements for Codeception 4.0+","text":"

                                                                                                                                                              This module requires the codeception/module-webdriver Composer package to work when wp-browser is used with Codeception 4.0.

                                                                                                                                                              To install the package run:

                                                                                                                                                              composer require --dev codeception/module-webdriver:^1.0\n
                                                                                                                                                              "},{"location":"v3/modules/WPWebDriver/#configuration","title":"Configuration","text":"

                                                                                                                                                              Due to the combination of possible browsers, capabilities and configurations, it's not possible to provide an exhaustive coverage of all the possible configuration parameteters here.

                                                                                                                                                              Please refer to WebDriver documentation for more information.

                                                                                                                                                              • url required - Start URL of your WordPress project, e.g. http://wp.test.
                                                                                                                                                              • adminUsername required - This is the login name, not the \"nice\" name, of the administrator user of the WordPress test site. This will be used to fill the username field in WordPress login page.
                                                                                                                                                              • adminPassword required - This is the the password of the administrator use of the WordPress test site. This will be used to fill the password in WordPress login page.
                                                                                                                                                              • adminPath required - The path, relative to the WordPress test site home URL, to the administration area, usually /wp-admin.
                                                                                                                                                              • browser - The browser to use for the tests, e.g. chrome or firefox.
                                                                                                                                                              • capabilities - Depending on the browser set in browser this is a list of browser-specific capabilities.
                                                                                                                                                              "},{"location":"v3/modules/WPWebDriver/#example-configuration","title":"Example configuration","text":"
                                                                                                                                                              modules:\n  enabled:\n    - WPWebDriver\n  config:\n    WPWebDriver:\n      url: 'http://wp.test'\n      adminUsername: 'admin'\n      adminPassword: 'password'\n      adminPath: '/wp-admin'\n      browser: chrome\n      host: localhost\n      port: 4444\n      window_size: false #disabled for Chrome driver\n      capabilities:\n        chromeOptions:\n          args: [\"--headless\", \"--disable-gpu\", \"--proxy-server='direct://'\", \"--proxy-bypass-list=*\"]\n
                                                                                                                                                              "},{"location":"v3/modules/WPWebDriver/#public-api","title":"Public API","text":"
                                                                                                                                                              • activatePlugin
                                                                                                                                                              • amEditingPostWithId
                                                                                                                                                              • amOnAdminAjaxPage
                                                                                                                                                              • amOnAdminPage
                                                                                                                                                              • amOnCronPage
                                                                                                                                                              • amOnPagesPage
                                                                                                                                                              • amOnPluginsPage
                                                                                                                                                              • deactivatePlugin
                                                                                                                                                              • dontSeePluginInstalled
                                                                                                                                                              • grabCookiesWithPattern
                                                                                                                                                              • grabFullUrl
                                                                                                                                                              • grabWordPressTestCookie
                                                                                                                                                              • logOut
                                                                                                                                                              • loginAs
                                                                                                                                                              • loginAsAdmin
                                                                                                                                                              • seeErrorMessage
                                                                                                                                                              • seeMessage
                                                                                                                                                              • seePluginActivated
                                                                                                                                                              • seePluginDeactivated
                                                                                                                                                              • seePluginInstalled
                                                                                                                                                              • seeWpDiePage
                                                                                                                                                              • waitForJqueryAjax
                                                                                                                                                              activatePlugin

                                                                                                                                                              In the plugin administration screen activates one or more plugins clicking the \"Activate\" link. The method will not handle authentication and navigation to the plugins administration page.

                                                                                                                                                              // Activate a plugin.\n  $I->loginAsAdmin();\n  $I->amOnPluginsPage();\n  $I->activatePlugin('hello-dolly');\n  // Activate a list of plugins.\n  $I->loginAsAdmin();\n  $I->amOnPluginsPage();\n  $I->activatePlugin(['hello-dolly','another-plugin']);\n
                                                                                                                                                              Parameters
                                                                                                                                                              • string/\\Codeception\\Module\\array $pluginSlug - The plugin slug, like \"hello-dolly\" or a list of plugin slugs. amEditingPostWithId

                                                                                                                                                                Go to the admin page to edit the post with the specified ID. The method will not handle authentication the admin area.

                                                                                                                                                                $I->loginAsAdmin();\n  $postId = $I->havePostInDatabase();\n  $I->amEditingPostWithId($postId);\n  $I->fillField('post_title', 'Post title');\n
                                                                                                                                                                Parameters
                                                                                                                                                                • int $id - The post ID.
                                                                                                                                                                amOnAdminAjaxPage

                                                                                                                                                                Go to the admin-ajax.php page to start a synchronous, and blocking, GET AJAX request. The method will not handle authentication, nonces or authorization.

                                                                                                                                                                $I->amOnAdminAjaxPage(['action' => 'my-action', 'data' => ['id' => 23], 'nonce' => $nonce]);\n
                                                                                                                                                                Parameters
                                                                                                                                                                • string/\\Codeception\\Module\\array $queryVars - A string or array of query variables to append to the AJAX path. amOnAdminPage

                                                                                                                                                                  Go to a page in the admininstration area of the site. This method will not handle authentication to the administration area.

                                                                                                                                                                  $I->loginAs('user', 'password');\n  // Go to the plugins management screen.\n  $I->amOnAdminPage('/plugins.php');\n
                                                                                                                                                                  Parameters
                                                                                                                                                                  • string $page - The path, relative to the admin area URL, to the page.
                                                                                                                                                                  amOnCronPage

                                                                                                                                                                  Go to the cron page to start a synchronous, and blocking, GET request to the cron script.

                                                                                                                                                                  // Triggers the cron job with an optional query argument.\n  $I->amOnCronPage('/?some-query-var=some-value');\n
                                                                                                                                                                  Parameters
                                                                                                                                                                  • string/\\Codeception\\Module\\array $queryVars - A string or array of query variables to append to the AJAX path. amOnPagesPage

                                                                                                                                                                    Go the \"Pages\" administration screen. The method will not handle authentication.

                                                                                                                                                                    $I->loginAsAdmin();\n  $I->amOnPagesPage();\n  $I->see('Add New');\n
                                                                                                                                                                    amOnPluginsPage

                                                                                                                                                                    Go to the plugins administration screen. The method will not handle authentication.

                                                                                                                                                                    $I->loginAsAdmin();\n  $I->amOnPluginsPage();\n  $I->activatePlugin('hello-dolly');\n
                                                                                                                                                                    deactivatePlugin

                                                                                                                                                                    In the plugin administration screen deactivate a plugin clicking the \"Deactivate\" link. The method will not handle authentication and navigation to the plugins administration page.

                                                                                                                                                                    // Deactivate one plugin.\n  $I->loginAsAdmin();\n  $I->amOnPluginsPage();\n  $I->deactivatePlugin('hello-dolly');\n  // Deactivate a list of plugins.\n  $I->loginAsAdmin();\n  $I->amOnPluginsPage();\n  $I->deactivatePlugin(['hello-dolly', 'my-plugin']);\n
                                                                                                                                                                    Parameters
                                                                                                                                                                    • string/\\Codeception\\Module\\array $pluginSlug - The plugin slug, like \"hello-dolly\", or a list of plugin slugs. dontSeePluginInstalled

                                                                                                                                                                      Assert a plugin is not installed in the plugins administration screen. The method will not handle authentication and navigation to the plugin administration screen.

                                                                                                                                                                      $I->loginAsAdmin();\n  $I->amOnPluginsPage();\n  $I->dontSeePluginInstalled('my-plugin');\n
                                                                                                                                                                      Parameters
                                                                                                                                                                      • string $pluginSlug - The plugin slug, like \"hello-dolly\".
                                                                                                                                                                      grabCookiesWithPattern

                                                                                                                                                                      Returns all the cookies whose name matches a regex pattern.

                                                                                                                                                                      $I->loginAs('customer','password');\n  $I->amOnPage('/shop');\n  $cartCookies = $I->grabCookiesWithPattern(\"#^shop_cart\\\\.*#\");\n
                                                                                                                                                                      Parameters
                                                                                                                                                                      • string $cookiePattern - The regular expression pattern to use for the matching.
                                                                                                                                                                      grabFullUrl

                                                                                                                                                                      Grabs the current page full URL including the query vars.

                                                                                                                                                                      $today = date('Y-m-d');\n  $I->amOnPage('/concerts?date=' . $today);\n  $I->assertRegExp('#\\\\/concerts$#', $I->grabFullUrl());\n
                                                                                                                                                                      grabWordPressTestCookie

                                                                                                                                                                      Returns WordPress default test cookie object if present.

                                                                                                                                                                      // Grab the default WordPress test cookie.\n  $wpTestCookie = $I->grabWordPressTestCookie();\n  // Grab a customized version of the test cookie.\n  $myTestCookie = $I->grabWordPressTestCookie('my_test_cookie');\n
                                                                                                                                                                      Parameters
                                                                                                                                                                      • string $name - Optional, overrides the default cookie name.
                                                                                                                                                                      logOut

                                                                                                                                                                      Navigate to the default WordPress logout page and click the logout link.

                                                                                                                                                                      // Log out using the `wp-login.php` form and return to the current page.\n  $I->logOut(true);\n  // Log out using the `wp-login.php` form and remain there.\n  $I->logOut(false);\n  // Log out using the `wp-login.php` form and move to another page.\n  $I->logOut('/some-other-page');\n
                                                                                                                                                                      Parameters
                                                                                                                                                                      • bool/bool/string $redirectTo - Whether to redirect to another (optionally specified) page after the logout.
                                                                                                                                                                      loginAs

                                                                                                                                                                      Login as the specified user. The method will not follow redirection, after the login, to any page. Depending on the driven browser the login might be \"too fast\" and the server might have not replied with valid cookies yet; in that case the method will re-attempt the login to obtain the cookies.

                                                                                                                                                                      $I->loginAs('user', 'password');\n  $I->amOnAdminPage('/');\n  $I->see('Dashboard');\n
                                                                                                                                                                      Parameters
                                                                                                                                                                      • string $username - The user login name.
                                                                                                                                                                      • string $password - The user password in plain text.
                                                                                                                                                                      • int $timeout - The max time, in seconds, to try to login.
                                                                                                                                                                      • int $maxAttempts - The max number of attempts to try to login.
                                                                                                                                                                      loginAsAdmin

                                                                                                                                                                      Login as the administrator user using the credentials specified in the module configuration. The method will not follow redirection, after the login, to any page.

                                                                                                                                                                      $I->loginAsAdmin();\n  $I->amOnAdminPage('/');\n  $I->see('Dashboard');\n
                                                                                                                                                                      Parameters
                                                                                                                                                                      • int $timeout - The max time, in seconds, to try to login.
                                                                                                                                                                      • int $maxAttempts - The max number of attempts to try to login.
                                                                                                                                                                      seeErrorMessage

                                                                                                                                                                      In an administration screen look for an error admin notice. The check is class-based to decouple from internationalization. The method will not handle authentication and navigation the administration area. .notice.notice-error ones.

                                                                                                                                                                      $I->loginAsAdmin()\n  $I->amOnAdminPage('/');\n  $I->seeErrorMessage('.my-plugin');\n
                                                                                                                                                                      Parameters
                                                                                                                                                                      • string/string/\\Codeception\\Module\\array $classes - A list of classes the notice should have other than the seeMessage

                                                                                                                                                                        In an administration screen look for an admin notice. The check is class-based to decouple from internationalization. The method will not handle authentication and navigation the administration area.

                                                                                                                                                                        $I->loginAsAdmin()\n  $I->amOnAdminPage('/');\n  $I->seeMessage('.missing-api-token.my-plugin');\n
                                                                                                                                                                        Parameters
                                                                                                                                                                        • string/\\Codeception\\Module\\array/string $classes - A list of classes the message should have in addition to the .notice one. seePluginActivated

                                                                                                                                                                          Assert a plugin is activated in the plugin administration screen. The method will not handle authentication and navigation to the plugin administration screen.

                                                                                                                                                                          $I->loginAsAdmin();\n  $I->amOnPluginsPage();\n  $I->seePluginActivated('my-plugin');\n
                                                                                                                                                                          Parameters
                                                                                                                                                                          • string $pluginSlug - The plugin slug, like \"hello-dolly\".
                                                                                                                                                                          seePluginDeactivated

                                                                                                                                                                          Assert a plugin is not activated in the plugins administration screen. The method will not handle authentication and navigation to the plugin administration screen.

                                                                                                                                                                          $I->loginAsAdmin();\n  $I->amOnPluginsPage();\n  $I->seePluginDeactivated('my-plugin');\n
                                                                                                                                                                          Parameters
                                                                                                                                                                          • string $pluginSlug - The plugin slug, like \"hello-dolly\".
                                                                                                                                                                          seePluginInstalled

                                                                                                                                                                          Assert a plugin is installed, no matter its activation status, in the plugin administration screen. The method will not handle authentication and navigation to the plugin administration screen.

                                                                                                                                                                          $I->loginAsAdmin();\n  $I->amOnPluginsPage();\n  $I->seePluginInstalled('my-plugin');\n
                                                                                                                                                                          Parameters
                                                                                                                                                                          • string $pluginSlug - The plugin slug, like \"hello-dolly\".
                                                                                                                                                                          seeWpDiePage

                                                                                                                                                                          Checks that the current page is one generated by the wp_die function. The method will try to identify the page based on the default WordPress die page HTML attributes.

                                                                                                                                                                          $I->loginAs('user', 'password');\n  $I->amOnAdminPage('/forbidden');\n  $I->seeWpDiePage();\n
                                                                                                                                                                          waitForJqueryAjax

                                                                                                                                                                          Waits for any jQuery triggered AJAX request to be resolved.

                                                                                                                                                                          $I->amOnPage('/triggering-ajax-requests');\n  $I->waitForJqueryAjax();\n  $I->see('From AJAX');\n
                                                                                                                                                                          Parameters
                                                                                                                                                                          • int $time - The max time to wait for AJAX requests to complete.

                                                                                                                                                                          This class extends \\Codeception\\Module\\WebDriver

                                                                                                                                                                          This class implements \\Codeception\\Lib\\Interfaces\\RequiresPackage, \\Codeception\\Lib\\Interfaces\\ConflictsWithModule, \\Codeception\\Lib\\Interfaces\\ElementLocator, \\Codeception\\Lib\\Interfaces\\PageSourceSaver, \\Codeception\\Lib\\Interfaces\\ScreenshotSaver, \\Codeception\\Lib\\Interfaces\\SessionSnapshot, \\Codeception\\Lib\\Interfaces\\MultiSession, \\Codeception\\Lib\\Interfaces\\Remote, \\Codeception\\Lib\\Interfaces\\Web

                                                                                                                                                                          "},{"location":"v3/modules/WordPress/","title":"WordPress module","text":"

                                                                                                                                                                          This module requires good knowledge and attention to be used effectively; you can replace it with a combination of the WPBrowser module together with the WPLoader module in loadOnly mode. This module should be used in functional tests, see levels of testing for more information. This module provides a middle-ground, in terms of testing and effects, between the fully isolated approach of the WPBrowser module and the fully integrated approach of the WPLoader module with loadOnly set to false. It allows to interact with WordPress on a very high level, using methods like $I->loginAs() or $I->amOnPage() as you could do with the WPBrowser module while also loading WordPress in the same variable scope as the tests as the WPLoader module would. Due to WordPress reliance on constants, globals and side-effects this module will make requests to WordPress in an insulated manner and reproduce WordPress environment (globals and super-globals) after each response in the tests variable scope. The module simulates a user interaction with the site without Javascript support, use the WPWebDriver module for any kind of testing that requires Javascript-based interaction with the site.

                                                                                                                                                                          "},{"location":"v3/modules/WordPress/#module-requirements-for-codeception-40","title":"Module requirements for Codeception 4.0+","text":"

                                                                                                                                                                          This module requires the codeception/lib-innerbrowser Composer package to work when wp-browser is used with Codeception 4.0.

                                                                                                                                                                          To install the package run:

                                                                                                                                                                          composer require --dev codeception/lib-innerbrowser:^1.0\n
                                                                                                                                                                          "},{"location":"v3/modules/WordPress/#detecting-requests-coming-from-this-module","title":"Detecting requests coming from this module","text":"

                                                                                                                                                                          When it runs this module will set the WPBROWSER_HOST_REQUEST environment variable. You can detect and use that information to, as an example, use the correct database in your test site wp-config.php file:

                                                                                                                                                                          <?php\nif ( \n    // Custom header.\n    isset( $_SERVER['HTTP_X_TESTING'] )\n    // Custom user agent.\n    || ( isset( $_SERVER['HTTP_USER_AGENT'] ) && $_SERVER['HTTP_USER_AGENT'] === 'wp-browser' )\n    // The env var set by the WPClIr or WordPress modules.\n    || getenv( 'WPBROWSER_HOST_REQUEST' )\n) {\n    // Use the test database if the request comes from a test.\n    define( 'DB_NAME', 'wordpress_test' );\n} else {\n    // Else use the default one.\n    define( 'DB_NAME', 'wordpress' );\n}\n
                                                                                                                                                                          "},{"location":"v3/modules/WordPress/#configuration","title":"Configuration","text":"
                                                                                                                                                                          • wpRootFolder required The absolute, or relative to the project root folder, path to the root WordPress installation folder. The WordPress installation root folder is the one that contains the wp-load.php file.
                                                                                                                                                                          • adminUsername required - This is the login name, not the \"nice\" name, of the administrator user of the WordPress test site. This will be used to fill the username field in WordPress login page.
                                                                                                                                                                          • adminPassword required - This is the the password of the administrator use of the WordPress test site. This will be used to fill the password in WordPress login page.
                                                                                                                                                                          • adminPath required - The path, relative to the WordPress test site home URL, to the administration area, usually /wp-admin.
                                                                                                                                                                          "},{"location":"v3/modules/WordPress/#example-configuration","title":"Example configuration","text":"
                                                                                                                                                                            modules:\n      enabled:\n          - WordPress\n      config:\n          WordPress:\n              wpRootFolder: \"/var/www/wordpress\"\n              adminUsername: 'admin'\n              adminPassword: 'password'\n              adminPath: '/wp-admin'\n
                                                                                                                                                                          "},{"location":"v3/modules/WordPress/#public-api","title":"Public API","text":"
                                                                                                                                                                          • amEditingPostWithId
                                                                                                                                                                          • amOnAdminAjaxPage
                                                                                                                                                                          • amOnAdminPage
                                                                                                                                                                          • amOnCronPage
                                                                                                                                                                          • amOnPage
                                                                                                                                                                          • amOnPagesPage
                                                                                                                                                                          • amOnPluginsPage
                                                                                                                                                                          • dontSeePluginInstalled
                                                                                                                                                                          • extractCookie
                                                                                                                                                                          • getResponseContent
                                                                                                                                                                          • getWpRootFolder
                                                                                                                                                                          • grabWordPressTestCookie
                                                                                                                                                                          • logOut
                                                                                                                                                                          • loginAs
                                                                                                                                                                          • loginAsAdmin
                                                                                                                                                                          • seeErrorMessage
                                                                                                                                                                          • seeMessage
                                                                                                                                                                          • seePluginActivated
                                                                                                                                                                          • seePluginDeactivated
                                                                                                                                                                          • seePluginInstalled
                                                                                                                                                                          • seeWpDiePage
                                                                                                                                                                          amEditingPostWithId

                                                                                                                                                                          Go to the admin page to edit the post with the specified ID. The method will not handle authentication the admin area.

                                                                                                                                                                          $I->loginAsAdmin();\n  $postId = $I->havePostInDatabase();\n  $I->amEditingPostWithId($postId);\n  $I->fillField('post_title', 'Post title');\n
                                                                                                                                                                          Parameters
                                                                                                                                                                          • int $id - The post ID.
                                                                                                                                                                          amOnAdminAjaxPage

                                                                                                                                                                          Go to the admin-ajax.php page to start a synchronous, and blocking, GET AJAX request. The method will not handle authentication, nonces or authorization.

                                                                                                                                                                          $I->amOnAdminAjaxPage(['action' => 'my-action', 'data' => ['id' => 23], 'nonce' => $nonce]);\n
                                                                                                                                                                          Parameters
                                                                                                                                                                          • string/\\Codeception\\Module\\array $queryVars - A string or array of query variables to append to the AJAX path. amOnAdminPage

                                                                                                                                                                            Go to a page in the admininstration area of the site.

                                                                                                                                                                            $I->loginAs('user', 'password');\n  // Go to the plugins management screen.\n  $I->amOnAdminPage('/plugins.php');\n
                                                                                                                                                                            Parameters
                                                                                                                                                                            • string $page - The path, relative to the admin area URL, to the page.
                                                                                                                                                                            amOnCronPage

                                                                                                                                                                            Go to the cron page to start a synchronous, and blocking, GET request to the cron script.

                                                                                                                                                                            // Triggers the cron job with an optional query argument.\n  $I->amOnCronPage('/?some-query-var=some-value');\n
                                                                                                                                                                            Parameters
                                                                                                                                                                            • string/\\Codeception\\Module\\array $queryVars - A string or array of query variables to append to the AJAX path. amOnPage

                                                                                                                                                                              Go to a page on the site. The module will try to reach the page, relative to the URL specified in the module configuration, without applying any permalink resolution.

                                                                                                                                                                              // Go the the homepage.\n  $I->amOnPage('/');\n  // Go to the single page of post with ID 23.\n  $I->amOnPage('/?p=23');\n  // Go to search page for the string \"foo\".\n  $I->amOnPage('/?s=foo');\n
                                                                                                                                                                              Parameters
                                                                                                                                                                              • string $page - The path to the page, relative to the the root URL.
                                                                                                                                                                              amOnPagesPage

                                                                                                                                                                              Go the \"Pages\" administration screen. The method will not handle authentication.

                                                                                                                                                                              $I->loginAsAdmin();\n  $I->amOnPagesPage();\n  $I->see('Add New');\n
                                                                                                                                                                              amOnPluginsPage

                                                                                                                                                                              Go to the plugins administration screen. The method will not handle authentication.

                                                                                                                                                                              $I->loginAsAdmin();\n  $I->amOnPluginsPage();\n  $I->activatePlugin('hello-dolly');\n
                                                                                                                                                                              dontSeePluginInstalled

                                                                                                                                                                              Assert a plugin is not installed in the plugins administration screen. The method will not handle authentication and navigation to the plugin administration screen.

                                                                                                                                                                              $I->loginAsAdmin();\n  $I->amOnPluginsPage();\n  $I->dontSeePluginInstalled('my-plugin');\n
                                                                                                                                                                              Parameters
                                                                                                                                                                              • string $pluginSlug - The plugin slug, like \"hello-dolly\".
                                                                                                                                                                              extractCookie

                                                                                                                                                                              Grab a cookie value from the current session, sets it in the $_COOKIE array and returns its value. This method utility is to get, in the scope of test code, the value of a cookie set during the tests.

                                                                                                                                                                              $id = $I->haveUserInDatabase('user', 'subscriber', ['user_pass' => 'pass']);\n  $I->loginAs('user', 'pass');\n  // The cookie is now set in the `$_COOKIE` super-global.\n  $I->extractCookie(LOGGED_IN_COOKIE);\n  // Generate a nonce using WordPress methods (see WPLoader in loadOnly mode) with correctly set context.\n  wp_set_current_user($id);\n  $nonce = wp_create_nonce('wp_rest');\n  // Use the generated nonce to make a request to the the REST API.\n  $I->haveHttpHeader('X-WP-Nonce', $nonce);\n
                                                                                                                                                                              Parameters
                                                                                                                                                                              • string $cookie - The cookie name.
                                                                                                                                                                              • array/\\Codeception\\Module\\array/array $params - Parameters to filter the cookie value. getResponseContent

                                                                                                                                                                                Returns content of the last response. This method exposes an underlying API for custom assertions.

                                                                                                                                                                                // In test class.\n  $this->assertContains($text, $this->getResponseContent(), \"foo-bar\");\n
                                                                                                                                                                                getWpRootFolder

                                                                                                                                                                                Returns the absolute path to the WordPress root folder.

                                                                                                                                                                                $root = $I->getWpRootFolder();\n  $this->assertFileExists($root . '/someFile.txt');\n
                                                                                                                                                                                grabWordPressTestCookie

                                                                                                                                                                                Returns WordPress default test cookie object if present.

                                                                                                                                                                                // Grab the default WordPress test cookie.\n  $wpTestCookie = $I->grabWordPressTestCookie();\n  // Grab a customized version of the test cookie.\n  $myTestCookie = $I->grabWordPressTestCookie('my_test_cookie');\n
                                                                                                                                                                                Parameters
                                                                                                                                                                                • string $name - Optional, overrides the default cookie name.
                                                                                                                                                                                logOut

                                                                                                                                                                                Navigate to the default WordPress logout page and click the logout link.

                                                                                                                                                                                // Log out using the `wp-login.php` form and return to the current page.\n  $I->logOut(true);\n  // Log out using the `wp-login.php` form and remain there.\n  $I->logOut(false);\n  // Log out using the `wp-login.php` form and move to another page.\n  $I->logOut('/some-other-page');\n
                                                                                                                                                                                Parameters
                                                                                                                                                                                • bool/bool/string $redirectTo - Whether to redirect to another (optionally specified) page after the logout.
                                                                                                                                                                                loginAs

                                                                                                                                                                                Login as the specified user. The method will not follow redirection, after the login, to any page.

                                                                                                                                                                                $I->loginAs('user', 'password');\n  $I->amOnAdminPage('/');\n  $I->seeElement('.admin');\n
                                                                                                                                                                                Parameters
                                                                                                                                                                                • string $username - The user login name.
                                                                                                                                                                                • string $password - The user password in plain text.
                                                                                                                                                                                loginAsAdmin

                                                                                                                                                                                Login as the administrator user using the credentials specified in the module configuration. The method will not follow redirection, after the login, to any page.

                                                                                                                                                                                $I->loginAsAdmin();\n  $I->amOnAdminPage('/');\n  $I->see('Dashboard');\n
                                                                                                                                                                                seeErrorMessage

                                                                                                                                                                                In an administration screen look for an error admin notice. The check is class-based to decouple from internationalization. The method will not handle authentication and navigation the administration area. .notice.notice-error ones.

                                                                                                                                                                                $I->loginAsAdmin()\n  $I->amOnAdminPage('/');\n  $I->seeErrorMessage('.my-plugin');\n
                                                                                                                                                                                Parameters
                                                                                                                                                                                • string/string/\\Codeception\\Module\\array $classes - A list of classes the notice should have other than the seeMessage

                                                                                                                                                                                  In an administration screen look for an admin notice. The check is class-based to decouple from internationalization. The method will not handle authentication and navigation the administration area.

                                                                                                                                                                                  $I->loginAsAdmin()\n  $I->amOnAdminPage('/');\n  $I->seeMessage('.missing-api-token.my-plugin');\n
                                                                                                                                                                                  Parameters
                                                                                                                                                                                  • string/\\Codeception\\Module\\array/string $classes - A list of classes the message should have in addition to the .notice one. seePluginActivated

                                                                                                                                                                                    Assert a plugin is activated in the plugin administration screen. The method will not handle authentication and navigation to the plugin administration screen.

                                                                                                                                                                                    $I->loginAsAdmin();\n  $I->amOnPluginsPage();\n  $I->seePluginActivated('my-plugin');\n
                                                                                                                                                                                    Parameters
                                                                                                                                                                                    • string $pluginSlug - The plugin slug, like \"hello-dolly\".
                                                                                                                                                                                    seePluginDeactivated

                                                                                                                                                                                    Assert a plugin is not activated in the plugins administration screen. The method will not handle authentication and navigation to the plugin administration screen.

                                                                                                                                                                                    $I->loginAsAdmin();\n  $I->amOnPluginsPage();\n  $I->seePluginDeactivated('my-plugin');\n
                                                                                                                                                                                    Parameters
                                                                                                                                                                                    • string $pluginSlug - The plugin slug, like \"hello-dolly\".
                                                                                                                                                                                    seePluginInstalled

                                                                                                                                                                                    Assert a plugin is installed, no matter its activation status, in the plugin administration screen. The method will not handle authentication and navigation to the plugin administration screen.

                                                                                                                                                                                    $I->loginAsAdmin();\n  $I->amOnPluginsPage();\n  $I->seePluginInstalled('my-plugin');\n
                                                                                                                                                                                    Parameters
                                                                                                                                                                                    • string $pluginSlug - The plugin slug, like \"hello-dolly\".
                                                                                                                                                                                    seeWpDiePage

                                                                                                                                                                                    Checks that the current page is one generated by the wp_die function. The method will try to identify the page based on the default WordPress die page HTML attributes.

                                                                                                                                                                                    $I->loginAs('user', 'password');\n  $I->amOnAdminPage('/forbidden');\n  $I->seeWpDiePage();\n

                                                                                                                                                                                    This class extends \\Codeception\\Lib\\Framework

                                                                                                                                                                                    This class implements \\Codeception\\Lib\\Interfaces\\Web, \\Codeception\\Lib\\Interfaces\\PageSourceSaver, \\Codeception\\Lib\\Interfaces\\ElementLocator, \\Codeception\\Lib\\Interfaces\\ConflictsWithModule, \\Codeception\\Lib\\Interfaces\\DependsOnModule

                                                                                                                                                                                    "},{"location":"v3/tutorials/automatically-change-db-in-tests/","title":"Automatically change database during acceptance and functional tests","text":"

                                                                                                                                                                                    You should always back up any site you run tests on if you care about the site content.

                                                                                                                                                                                    Now this disclaimer has been made ad nauseam; there's a simple way to use a different database when during tests.

                                                                                                                                                                                    "},{"location":"v3/tutorials/automatically-change-db-in-tests/#identifying-requests","title":"Identifying requests","text":"

                                                                                                                                                                                    The first component of this solution is identifying the source of the current HTTP request. WordPress makes this identification before deciding which database to use.

                                                                                                                                                                                    To provide the WordPress installation with this information, you can set the headers entry of the WPBrowser or WPWebDriver module in the suite configuration file.

                                                                                                                                                                                    As an example here is an acceptance suite configuration file setting two custom headers, X_WPBROWSER_REQUEST and X_TEST_REQUEST, on each request sent by the WPWebDriver module:

                                                                                                                                                                                    actor: AcceptanceTester\nmodules:\n    enabled:\n        - WPDb\n        - WPBrowser\n        - \\Helper\\Acceptance\n    config:\n        WPDb:\n            dsn: 'mysql:host=localhost;dbname=tests'\n            user: 'root'\n            password: 'root'\n            dump: 'tests/_data/dump.sql'\n            populate: true\n            cleanup: true\n            waitlock: 10\n            url: 'http://wp.test'\n            urlReplacement: true\n            tablePrefix: 'wp_'\n        WPBrowser:\n            url: 'http://wp.test'\n            adminUsername: 'admin'\n            adminPassword: 'admin'\n            adminPath: '/wp-admin'\n            headers:\n                X_WPBROWSER_REQUEST: 1\n                X_TEST_REQUEST: 1\n

                                                                                                                                                                                    The two headers are sent on each HTTP request type, not just on GET type requests.

                                                                                                                                                                                    "},{"location":"v3/tutorials/automatically-change-db-in-tests/#using-a-different-database-to-handle-test-requests","title":"Using a different database to handle test requests","text":"

                                                                                                                                                                                    Now that each request made by the WPWebDriver module contains those two headers, it's time for WordPress to check those and change the database to use accordingly.

                                                                                                                                                                                    The database to use is set by the DB_NAME constant that is, in turn, set in the wp-config.php file. Different setups could involve more complex configurations for the wp-config.php file but, for the sake of simplicity, I assume the default WordPress wp-config.php file structure. In the example below, the default database name is wordpress, while the name of the test database is tests.

                                                                                                                                                                                    - define( 'DB_NAME', 'wordpress' );\n+ if( isset( $_SERVER['HTTP_X_TEST_REQUEST'] ) && $_SERVER['HTTP_X_TEST_REQUEST'] ) {\n+     define( 'DB_NAME', 'tests' );\n+ } else {\n+     define( 'DB_NAME', 'wordpress' );\n+ }\n

                                                                                                                                                                                    The diff shows the replacement done in the WordPress installation wp-config.php file.

                                                                                                                                                                                    For copy-and-paste pleasure, replace the line starting with:

                                                                                                                                                                                    define( 'DB_NAME', 'default_db_name' );\n

                                                                                                                                                                                    With this snippet:

                                                                                                                                                                                    if( isset( $_SERVER['HTTP_X_TEST_REQUEST'] ) && $_SERVER['HTTP_X_TEST_REQUEST'] ) {\n      define( 'DB_NAME', 'test_db_name' );\n} else {\n      define( 'DB_NAME', 'default_db_name' );\n}\n

                                                                                                                                                                                    Where default_db_name is the name of the database your test WordPress installation normally uses.

                                                                                                                                                                                    Happy, and safer, testing.

                                                                                                                                                                                    "},{"location":"v3/tutorials/local-flywheel-setup/","title":"Local flywheel setup","text":""},{"location":"v3/tutorials/local-flywheel-setup/#setting-up-wp-browser-with-local-by-flywheel-to-test-a-plugin","title":"Setting up wp-browser with Local by Flywheel to test a plugin","text":"

                                                                                                                                                                                    Note: the original version of this guide used, on Mac, the version of Local by Flywheel based on VirtualBox and Docker containers. That version has been replaced by a new one that will not use any virtualization layer. The UI is almost the same but, for back-compatibility purposes, I've not removed the references to the previous version; I have, instead, pointed out where the set up values and procedures might differ due to the changes.

                                                                                                                                                                                    "},{"location":"v3/tutorials/local-flywheel-setup/#requirements","title":"Requirements","text":"
                                                                                                                                                                                    • A Mac or Windows machine
                                                                                                                                                                                    • A working installation of Local By Flywheel.
                                                                                                                                                                                    • You should be able to create sites and visit them from your browser without issues.
                                                                                                                                                                                    • Composer installed and working on your terminal PATH, you should be able to run composer --version at the terminal and see the version correctly.
                                                                                                                                                                                    "},{"location":"v3/tutorials/local-flywheel-setup/#install-local-by-flywheel","title":"Install Local by Flywheel","text":"

                                                                                                                                                                                    This walk-through starts after Local by Flywheel has been installed and is correctly running on your machine; you can download Local from the site and follow the installation instructions.

                                                                                                                                                                                    In the context of this guide I'm assuming the sites directory is ~/Local Sites, the default \"Sites Path\" in Local preferences.

                                                                                                                                                                                    If your document root lies elsewhere, replace the ~/Local Sites path with the actual directory in each command.

                                                                                                                                                                                    "},{"location":"v3/tutorials/local-flywheel-setup/#creating-the-databases-and-installing-wordpress","title":"Creating the databases and installing WordPress","text":"

                                                                                                                                                                                    Using Local UI create a new site:

                                                                                                                                                                                    • The site name is myplugin.
                                                                                                                                                                                    • The site administrator user name is admin.
                                                                                                                                                                                    • The site administrator password is password.

                                                                                                                                                                                    Once Local provisioned and installed the new site, open the \"Database\" administration tab and, depending on your OS, start a database administration UI or website. In the image below I'm using Adminer:

                                                                                                                                                                                    Create a database called tests:

                                                                                                                                                                                    Make sure you can visit the WordPress installation at http://myplugin.local and that you can correctly access the administration area at http://myplugin.local/wp-admin.

                                                                                                                                                                                    "},{"location":"v3/tutorials/local-flywheel-setup/#scaffolding-the-project-folder","title":"Scaffolding the project folder","text":"

                                                                                                                                                                                    I'm assuming the scope of the development is to test the my-plugin plugin.

                                                                                                                                                                                    The first step is to create the bare minimum code required to make the plugin show up among the available WordPress plugins. Create the main plugin file in the WordPress installation plugins directory, in the ~/Local Sites/myplugin/app/public/wp-content/plugins/my-plugin/my-plugin.php file:

                                                                                                                                                                                    <?php\n/**\n * Plugin Name: My plugin\n */ \n

                                                                                                                                                                                    The plugin should now show up, activate and deactivate correctly, among the plugins listed in the WordPress installation at http://myplugin.local/wp-admin/plugins.php.

                                                                                                                                                                                    "},{"location":"v3/tutorials/local-flywheel-setup/#installing-wp-browser","title":"Installing wp-browser","text":"

                                                                                                                                                                                    Open a terminal window and navigate to the plugin directory and initialize the Composer project:

                                                                                                                                                                                    cd ~/Local Sites/myplugin/app/public/wp-content/plugins/my-plugin\ncomposer init\n

                                                                                                                                                                                    Composer will ask some questions to initialize the project, for the sake of this small guide the answers are not relevant. Here is the composer.json file generated by the above answers:

                                                                                                                                                                                    {\n    \"name\": \"local/my-plugin\",\n    \"type\": \"wordpress-plugin\",\n    \"require\": {}\n}\n

                                                                                                                                                                                    Next require lucatume/wp-browser as a development dependency:

                                                                                                                                                                                    composer require --dev lucatume/wp-browser\n

                                                                                                                                                                                    Composer installs any dependency binary file, an executable file, in the project vendor/bin folder. To check Codeception is correctly installed run this command:

                                                                                                                                                                                    vendor/bin/codecept --version\n

                                                                                                                                                                                    Since wp-browser requires Codeception, there is no need to require Codeception explicitly as a development dependency.

                                                                                                                                                                                    "},{"location":"v3/tutorials/local-flywheel-setup/#setting-up-wp-browser","title":"Setting up wp-browser","text":"

                                                                                                                                                                                    For those that might get lost while trying to set up wp-browser for the first time the VVV context provides an excellent base to understand the process.

                                                                                                                                                                                    wp-browser needs to know:

                                                                                                                                                                                    • Where the WordPress installation files are located: they will be loaded in integration and \"WordPress unit\" tests.
                                                                                                                                                                                    • How to connect to the WordPress site \"normal\" database: this is the database that stores the data of the site I would see when visiting the local installation URL at http://myplugin.local.
                                                                                                                                                                                    • How to connect to the database dedicated to the integration and \"WordPress unit\" tests: this database will be used to install WordPress during integration and \"WordPress unit\" tests.

                                                                                                                                                                                    Any test suite using a database should never run on a database containing data of any value; this means that your first step should be to backup the site database.

                                                                                                                                                                                    You can create a backup of the current site database contents using whatever tool the version of Local you're using provides. In this example I'm using Adminer:

                                                                                                                                                                                    At any moment you can re-import the site database dump using, again, phpMyAdmin, under the \"Import\" tab:

                                                                                                                                                                                    "},{"location":"v3/tutorials/local-flywheel-setup/#bootstrapping-and-configuring-wp-browser","title":"Bootstrapping and configuring wp-browser","text":"

                                                                                                                                                                                    After the backup is done it's time to bootstrap wp-browser using its interactive mode:

                                                                                                                                                                                    cd ~/Local Sites/myplugin/app/public/wp-content/plugins/my-plugin\nvendor/bin/codecept init wpbrowser\n

                                                                                                                                                                                    The initialization guide will ask a number of questions.

                                                                                                                                                                                    "},{"location":"v3/tutorials/local-flywheel-setup/#windows-configuration","title":"Windows configuration","text":"

                                                                                                                                                                                    In the screenshots below are the answers I used to configure wp-browser on Windows.

                                                                                                                                                                                    Note that I've set up the database host using the values provided by Local UI, yours might differ depending on the version of Local you're using:

                                                                                                                                                                                    Below a complete list of each answer:

                                                                                                                                                                                    • I acknowledge wp-browser should run on development servers... y
                                                                                                                                                                                    • Would you like to set up the suites interactively now? y
                                                                                                                                                                                    • How would you like the acceptance suite to be called? acceptance
                                                                                                                                                                                    • How would you like the functional suite to be called? functional
                                                                                                                                                                                    • How would you like the WordPress unit and integration suite to be called? wpunit
                                                                                                                                                                                    • How would you like to call the env configuration file? .env.testing
                                                                                                                                                                                    • What is the path of the WordPress root directory? ~/Local Sites/myplugin/app/public
                                                                                                                                                                                    • What is the path, relative to WordPress root URL, of the admin area of the test site? /wp-admin
                                                                                                                                                                                    • What is the name of the test database used by the test site? tests
                                                                                                                                                                                    • What is the host of the test database used by the test site? localhost:10003
                                                                                                                                                                                    • What is the user of the test database used by the test site? root
                                                                                                                                                                                    • What is the password of the test database used by the test site? root
                                                                                                                                                                                    • What is the table prefix of the test database used by the test site? wp_
                                                                                                                                                                                    • What is the name of the test database WPLoader should use? tests
                                                                                                                                                                                    • What is the host of the test database WPLoader should use? localhost:10003
                                                                                                                                                                                    • What is the user of the test database WPLoader should use? root
                                                                                                                                                                                    • What is the password of the test database WPLoader should use? root
                                                                                                                                                                                    • What is the table prefix of the test database WPLoader should use? wp_
                                                                                                                                                                                    • What is the URL the test site? http://myplugin.local
                                                                                                                                                                                    • What is the email of the test site WordPress administrator? admin@myplugin.local
                                                                                                                                                                                    • What is the title of the test site? My Plugin Test
                                                                                                                                                                                    • What is the login of the administrator user of the test site? admin
                                                                                                                                                                                    • What is the password of the administrator user of the test site? password
                                                                                                                                                                                    • Are you testing a plugin, a theme or a combination of both (both)? plugin
                                                                                                                                                                                    • What is the folder/plugin.php name of the plugin? my-plugin/my-plugin.php
                                                                                                                                                                                    • Does your project needs additional plugins to be activated to work? no

                                                                                                                                                                                    Codeception will build the suites for the first time and should be ready to go.

                                                                                                                                                                                    "},{"location":"v3/tutorials/local-flywheel-setup/#mac-configuration","title":"Mac configuration","text":"

                                                                                                                                                                                    In the screenshots below are the answers I used to configure wp-browser on Mac.

                                                                                                                                                                                    Note that I've set up the database host using the values provided by Local UI, yours might differ.

                                                                                                                                                                                    This screenshot is from the previous version of Local, the one based on VirtualBox and Docker:

                                                                                                                                                                                    Below a complete list of each answer:

                                                                                                                                                                                    • I acknowledge wp-browser should run on development servers... y
                                                                                                                                                                                    • Would you like to set up the suites interactively now? y
                                                                                                                                                                                    • How would you like the acceptance suite to be called? acceptance
                                                                                                                                                                                    • How would you like the functional suite to be called? functional
                                                                                                                                                                                    • How would you like the WordPress unit and integration suite to be called? wpunit
                                                                                                                                                                                    • How would you like to call the env configuration file? .env.testing
                                                                                                                                                                                    • What is the path of the WordPress root directory? ~/Local Sites/myplugin/app/public
                                                                                                                                                                                    • What is the path, relative to WordPress root URL, of the admin area of the test site? /wp-admin
                                                                                                                                                                                    • What is the name of the test database used by the test site? tests
                                                                                                                                                                                    • What is the host of the test database used by the test site? /Users/lucatume/Library/Application Support/Local/run/FjKWfVMGd/mysql/mysqld.sock ( or 192.168.95.100:4055 on an older version of Local)
                                                                                                                                                                                    • What is the user of the test database used by the test site? root
                                                                                                                                                                                    • What is the password of the test database used by the test site? root
                                                                                                                                                                                    • What is the table prefix of the test database used by the test site? wp_
                                                                                                                                                                                    • What is the name of the test database WPLoader should use? tests
                                                                                                                                                                                    • What is the host of the test database WPLoader should use? /Users/lucatume/Library/Application Support/Local/run/FjKWfVMGd/mysql/mysqld.sock (or 192.168.95.100:4055 on an older version of Local)
                                                                                                                                                                                    • What is the user of the test database WPLoader should use? root
                                                                                                                                                                                    • What is the password of the test database WPLoader should use? root
                                                                                                                                                                                    • What is the table prefix of the test database WPLoader should use? wp_
                                                                                                                                                                                    • What is the URL the test site? http://myplugin.local
                                                                                                                                                                                    • What is the email of the test site WordPress administrator? admin@myplugin.local
                                                                                                                                                                                    • What is the title of the test site? My Plugin Test
                                                                                                                                                                                    • What is the login of the administrator user of the test site? admin
                                                                                                                                                                                    • What is the password of the administrator user of the test site? password
                                                                                                                                                                                    • Are you testing a plugin, a theme or a combination of both (both)? plugin
                                                                                                                                                                                    • What is the folder/plugin.php name of the plugin? my-plugin/my-plugin.php
                                                                                                                                                                                    • Does your project needs additional plugins to be activated to work? no

                                                                                                                                                                                    Codeception will build the suites for the first time and should be ready to go.

                                                                                                                                                                                    "},{"location":"v3/tutorials/local-flywheel-setup/#setting-up-the-starting-database-fixture","title":"Setting up the starting database fixture","text":"

                                                                                                                                                                                    A \"fixture\", in testing terms, is a minimal, starting environment shared by all tests. In BDD it's the Background any scenario will share. In the case of a plugin the minimal, starting environment is the following:

                                                                                                                                                                                    • A fresh WordPress installation empty of any content.
                                                                                                                                                                                    • WordPress using its default theme.
                                                                                                                                                                                    • The only active plugin is the one you're testing, in this example: my-plugin.

                                                                                                                                                                                    You should set up this fixture \"manually\", using the site administration UI at http://myplugin.local/wp-admin.

                                                                                                                                                                                    The following command will empty the site, backup any content you care about first!

                                                                                                                                                                                    When you're done setting up the initial database fixture, export it using the \"Export\" tab of your database tool of choice, and move the file to the ~/Local Sites/myplugin/app/public/wp-content/plugins/my-plugin/tests/_data/dump.sql directory.

                                                                                                                                                                                    There is one last step left to complete the setup.

                                                                                                                                                                                    "},{"location":"v3/tutorials/local-flywheel-setup/#using-the-tests-database-in-acceptance-and-functional-tests","title":"Using the tests database in acceptance and functional tests","text":"

                                                                                                                                                                                    Acceptance and functional tests will act as users, navigating to the site pages and making requests as a user would.

                                                                                                                                                                                    This means that WordPress will load, and with it its wp-config.php file, to handle the requests made by the tests.

                                                                                                                                                                                    During the setup phase I've specified the database to be used for acceptance and functional tests as tests but, looking at the contents of the ~/Local Sites/myplugin/app/public/wp-config.php file, the DB_NAME constant is set to local.

                                                                                                                                                                                    What we'll do now means:

                                                                                                                                                                                    • If the request is a normal one, use the local database.
                                                                                                                                                                                    • If the request comes from a test, use the tests database.

                                                                                                                                                                                    In your IDE/text-editor of choice edit the ~/Local Sites/myplugin/app/public/wp-config.php and replace the line defining the DB_NAME constant like this:

                                                                                                                                                                                    - define( 'DB_NAME', 'local' );\n+ if( isset( $_SERVER['HTTP_X_WPBROWSER_REQUEST'] ) && $_SERVER['HTTP_X_WPBROWSER_REQUEST'] ) { \n+    define( 'DB_NAME', 'tests' );\n+ } else {\n+    define( 'DB_NAME', 'local' );\n+ }\n

                                                                                                                                                                                    Here's the copy-and-paste friendly version:

                                                                                                                                                                                    if( isset( $_SERVER['HTTP_X_TEST_REQUEST'] ) && $_SERVER['HTTP_X_TEST_REQUEST'] ) {\n        define( 'DB_NAME', 'tests' );\n} else {\n        define( 'DB_NAME', 'local' );\n}\n

                                                                                                                                                                                    If you look at the tests/acceptance.suite.yml and tests/functional.suite.yml files, respectively the acceptance and functional suite configuration files, you will see these entries in the WPBrowser module configuration:

                                                                                                                                                                                    headers:\n    X_TEST_REQUEST: 1\n    X_WPBROWSER_REQUEST: 1\n

                                                                                                                                                                                    This means that, with each HTTP request done during tests, the module will send the two headers. Those headers are read, on the WordPress side, using the $_SERVER['HTTP_X_TEST_REQUEST'] and $_SERVER['X_WPBROWSER_REQUEST'] variables.

                                                                                                                                                                                    Codeception and wp-browser are ready to run and the test-drive development can start.

                                                                                                                                                                                    "},{"location":"v3/tutorials/local-flywheel-setup/#sanity-check","title":"Sanity check","text":"

                                                                                                                                                                                    Before starting to write tests, take a moment to run each suite separately and make sure all is set up correctly.

                                                                                                                                                                                    If you run into issues, there's a chance you forgot something along the way, please take the time to read this tutorial a second time before opening an issue.

                                                                                                                                                                                    You have created 4 suites, each suite has at least one example test to make sure all works. Run each suite and make sure all tests succeed, from within the box run:

                                                                                                                                                                                    cd ~/Local Sites/myplugin/app/public/wp-content/plugins/my-plugin \nvendor/bin/codecept run acceptance\nvendor/bin/codecept run functional\nvendor/bin/codecept run wpunit\nvendor/bin/codecept run unit\n

                                                                                                                                                                                    You're now run to customize the suites to your liking or start writing tests, run vendor/bin/codecept to see a list of the available commands.

                                                                                                                                                                                    "},{"location":"v3/tutorials/mamp-mac-setup/","title":"Mamp mac setup","text":""},{"location":"v3/tutorials/mamp-mac-setup/#setting-up-wp-browser-with-mamp-on-mac-to-test-a-plugin","title":"Setting up wp-browser with MAMP on Mac to test a plugin","text":""},{"location":"v3/tutorials/mamp-mac-setup/#requirements","title":"Requirements","text":"
                                                                                                                                                                                    • A Mac machine
                                                                                                                                                                                    • A working installation of MAMP.
                                                                                                                                                                                    • You should be able to create sites and visit them from your browser without issues.
                                                                                                                                                                                    • Composer installed and working on your terminal PATH, you should be able to run composer --version at the terminal and see the version correctly.

                                                                                                                                                                                    The version of MAMP used in this tutorial is the free, non PRO, one. MAMP PRO provides more features, but the setup instructions should remain valid.

                                                                                                                                                                                    "},{"location":"v3/tutorials/mamp-mac-setup/#install-and-configure-mamp","title":"Install and configure MAMP","text":"

                                                                                                                                                                                    This walk-through starts after MAMP has been installed and is correctly running on the host machine; you can download MAMP from the site and follow the installation instructions. In the context of this guide I'm assuming the \"Document Root\" directory is the default one, in the /Applications/MAMP/htdocs directory. If your document root lies elsewhere, replace the /Applications/MAMP/htdocs path with the actual directory in each command.

                                                                                                                                                                                    "},{"location":"v3/tutorials/mamp-mac-setup/#creating-the-databases-and-installing-wordpress","title":"Creating the databases and installing WordPress","text":"

                                                                                                                                                                                    Go to the http://localhost/phpMyAdmin/ page and create two new databases:

                                                                                                                                                                                    • wordpress is the database you will use for WordPress
                                                                                                                                                                                    • tests is the database you will use for the tests

                                                                                                                                                                                    Unzip the the WordPress files into the /Applications/MAMP/htdocs and head over to http://localhost to install WordPress.

                                                                                                                                                                                    The database credentials for the installation are:

                                                                                                                                                                                    • Database name: wordpress
                                                                                                                                                                                    • Database user: root
                                                                                                                                                                                    • Database password: root
                                                                                                                                                                                    • Database host: localhost

                                                                                                                                                                                    Use admin as administrator user name and password as password for the administrator user.

                                                                                                                                                                                    Make sure you can visit the WordPress installation at http://localhost and that you can correctly access the administration area at http://localhost/wp-admin.

                                                                                                                                                                                    "},{"location":"v3/tutorials/mamp-mac-setup/#scaffolding-the-project-folder","title":"Scaffolding the project folder","text":"

                                                                                                                                                                                    I'm assuming the scope of the development is to test the my-plugin plugin.

                                                                                                                                                                                    The first step is to create the bare minimum code required to make the plugin show up among the available WordPress plugins. Create the main plugin file in the WordPress installation plugins directory, in the /Applications/MAMP/htdocs/wp-content/plugins/my-plugin/my-plugin.php file:

                                                                                                                                                                                    <?php\n/**\n * Plugin Name: My plugin\n */ \n

                                                                                                                                                                                    The plugin should now show up, activate and deactivate correctly, among the plugins listed in the WordPress installation at http://localhost/wp-admin/plugins.php.

                                                                                                                                                                                    "},{"location":"v3/tutorials/mamp-mac-setup/#installing-wp-browser","title":"Installing wp-browser","text":"

                                                                                                                                                                                    Open a terminal window and navigate to the plugin directory and initialize the Composer project:

                                                                                                                                                                                    cd /Applications/MAMP/htdocs/wp-content/plugins/my-plugin\ncomposer init\n

                                                                                                                                                                                    Composer will ask some questions to initialize the project, for the sake of this small guide the answers are not relevant. Here is the composer.json file generated by the above answers:

                                                                                                                                                                                    {\n    \"name\": \"mamp/my-plugin\",\n    \"type\": \"wordpress-plugin\",\n    \"require\": {}\n}\n

                                                                                                                                                                                    Next require lucatume/wp-browser as a development dependency:

                                                                                                                                                                                    composer require --dev lucatume/wp-browser\n

                                                                                                                                                                                    Composer installs any dependency binary file, an executable file, in the project vendor/bin folder. To check Codeception is correctly installed run this command:

                                                                                                                                                                                    vendor/bin/codecept --version\n

                                                                                                                                                                                    Since wp-browser requires Codeception, there is no need to require Codeception explicitly as a development dependency.

                                                                                                                                                                                    "},{"location":"v3/tutorials/mamp-mac-setup/#setting-up-wp-browser","title":"Setting up wp-browser","text":"

                                                                                                                                                                                    For those that might get lost while trying to set up wp-browser for the first time the VVV context provides an excellent base to understand the process.

                                                                                                                                                                                    wp-browser needs to know:

                                                                                                                                                                                    • Where the WordPress installation files are located: they will be loaded in integration and \"WordPress unit\" tests.
                                                                                                                                                                                    • How to connect to the WordPress site \"normal\" database: this is the database that stores the data of the site I would see when visiting the local installation URL at http://localhost.
                                                                                                                                                                                    • How to connect to the database dedicated to the integration and \"WordPress unit\" tests: this database will be used to install WordPress during integration and \"WordPress unit\" tests.

                                                                                                                                                                                    Any test suite using a database should never run on a database containing data of any value; this means that your first step should be to backup the site database.

                                                                                                                                                                                    You can create a backup of the current site database contents using phpMyAdmin, at http://localhost/phpMyAdmin/, under the \"Export\" tab:

                                                                                                                                                                                    At any moment you can re-import the site database dump using, again, phpMyAdmin, under the \"Import\" tab:

                                                                                                                                                                                    "},{"location":"v3/tutorials/mamp-mac-setup/#bootstrapping-and-configuring-wp-browser","title":"Bootstrapping and configuring wp-browser","text":"

                                                                                                                                                                                    After the backup is done it's time to bootstrap wp-browser using its interactive mode:

                                                                                                                                                                                    cd /Applications/MAMP/htdocs/wp-content/plugins/my-plugin\nvendor/bin/codecept init wpbrowser\n

                                                                                                                                                                                    The initialization guide will ask a number of questions. In the screenshots below are the answers I used to configure wp-browser.

                                                                                                                                                                                    Below a complete list of each answer:

                                                                                                                                                                                    • I acknowledge wp-browser should run on development servers... y
                                                                                                                                                                                    • Would you like to set up the suites interactively now? y
                                                                                                                                                                                    • How would you like the acceptance suite to be called? acceptance
                                                                                                                                                                                    • How would you like the functional suite to be called? functional
                                                                                                                                                                                    • How would you like the WordPress unit and integration suite to be called? wpunit
                                                                                                                                                                                    • How would you like to call the env configuration file? .env.testing
                                                                                                                                                                                    • What is the path of the WordPress root directory? /Applications/MAMP/htdocs
                                                                                                                                                                                    • What is the path, relative to WordPress root URL, of the admin area of the test site? /wp-admin
                                                                                                                                                                                    • What is the name of the test database used by the test site? tests
                                                                                                                                                                                    • What is the host of the test database used by the test site? localhost
                                                                                                                                                                                    • What is the user of the test database used by the test site? root
                                                                                                                                                                                    • What is the password of the test database used by the test site? root
                                                                                                                                                                                    • What is the table prefix of the test database used by the test site? wp_
                                                                                                                                                                                    • What is the name of the test database WPLoader should use? tests
                                                                                                                                                                                    • What is the host of the test database WPLoader should use? localhost
                                                                                                                                                                                    • What is the user of the test database WPLoader should use? root
                                                                                                                                                                                    • What is the password of the test database WPLoader should use? root
                                                                                                                                                                                    • What is the table prefix of the test database WPLoader should use? wp_
                                                                                                                                                                                    • What is the URL the test site? http://localhost
                                                                                                                                                                                    • What is the email of the test site WordPress administrator? admin@wp.test
                                                                                                                                                                                    • What is the title of the test site? My Plugin Test
                                                                                                                                                                                    • What is the login of the administrator user of the test site? admin
                                                                                                                                                                                    • What is the password of the administrator user of the test site? password
                                                                                                                                                                                    • Are you testing a plugin, a theme or a combination of both (both)? plugin
                                                                                                                                                                                    • What is the folder/plugin.php name of the plugin? my-plugin/my-plugin.php
                                                                                                                                                                                    • Does your project needs additional plugins to be activated to work? no

                                                                                                                                                                                    Codeception will build the suites for the first time and should be ready to go.

                                                                                                                                                                                    "},{"location":"v3/tutorials/mamp-mac-setup/#setting-up-the-starting-database-fixture","title":"Setting up the starting database fixture","text":"

                                                                                                                                                                                    A \"fixture\", in testing terms, is a minimal, starting environment shared by all tests. In BDD it's the Background any scenario will share. In the case of a plugin the minimal, starting environment is the following:

                                                                                                                                                                                    • A fresh WordPress installation empty of any content.
                                                                                                                                                                                    • WordPress using its default theme.
                                                                                                                                                                                    • The only active plugin is the one you're testing, in this example: my-plugin.

                                                                                                                                                                                    You should set up this fixture \"manually\", using the site administration UI at http://localhost/wp-admin.

                                                                                                                                                                                    The following command will empty the site, backup any content you care about first!

                                                                                                                                                                                    When you're done setting up the initial database fixture, export it using the \"Export\" tab of phpMyAdmin, at http://localhost/phpMyAdmin/ and move the file to the /Applications/MAMP/htdocs/wp-content/plugins/my-plugin/tests/_data/dump.sql directory.

                                                                                                                                                                                    There is one last step left to complete the setup.

                                                                                                                                                                                    "},{"location":"v3/tutorials/mamp-mac-setup/#using-the-tests-database-in-acceptance-and-functional-tests","title":"Using the tests database in acceptance and functional tests","text":"

                                                                                                                                                                                    Acceptance and functional tests will act as users, navigating to the site pages and making requests as a user would.

                                                                                                                                                                                    This means that WordPress will load, and with it its wp-config.php file, to handle the requests made by the tests.

                                                                                                                                                                                    During the setup phase I've specified the database to be used for acceptance and functional tests as tests but, looking at the contents of the /Applications/MAMP/htdocs/wp-config.php file, the DB_NAME constant is set to wordpress.

                                                                                                                                                                                    What we'll do now means:

                                                                                                                                                                                    • If the request is a normal one, use the wordpress database.
                                                                                                                                                                                    • If the request comes from a test, use the tests database.

                                                                                                                                                                                    In your IDE/text-editor of choice edit the /Applications/MAMP/htdocs/wp-config.php and replace the line defining the DB_NAME constant like this:

                                                                                                                                                                                    - define( 'DB_NAME', 'wordpress' );\n+ if( isset( $_SERVER['HTTP_X_WPBROWSER_REQUEST'] ) && $_SERVER['HTTP_X_WPBROWSER_REQUEST'] ) { \n+    define( 'DB_NAME', 'tests' );\n+ } else {\n+    define( 'DB_NAME', 'wordpress' );\n+ }\n

                                                                                                                                                                                    Here's the copy-and-paste friendly version:

                                                                                                                                                                                    if( isset( $_SERVER['HTTP_X_TEST_REQUEST'] ) && $_SERVER['HTTP_X_TEST_REQUEST'] ) {\n        define( 'DB_NAME', 'tests' );\n} else {\n        define( 'DB_NAME', 'wordpress' );\n}\n

                                                                                                                                                                                    If you look at the tests/acceptance.suite.yml and tests/functional.suite.yml files, respectively the acceptance and functional suite configuration files, you will see these entries in the WPBrowser module configuration:

                                                                                                                                                                                    headers:\n    X_TEST_REQUEST: 1\n    X_WPBROWSER_REQUEST: 1\n

                                                                                                                                                                                    This means that, with each HTTP request done during tests, the module will send the two headers. Those headers are read, on the WordPress side, using the $_SERVER['HTTP_X_TEST_REQUEST'] and $_SERVER['X_WPBROWSER_REQUEST'] variables.

                                                                                                                                                                                    Codeception and wp-browser are ready to run and the test-drive development can start.

                                                                                                                                                                                    "},{"location":"v3/tutorials/mamp-mac-setup/#sanity-check","title":"Sanity check","text":"

                                                                                                                                                                                    Before starting to write tests, take a moment to run each suite separately and make sure all is set up correctly.

                                                                                                                                                                                    If you run into issues, there's a chance you forgot something along the way, please take the time to read this tutorial a second time before opening an issue.

                                                                                                                                                                                    You have created 4 suites, each suite has at least one example test to make sure all works. Run each suite and make sure all tests succeed, from within the box run:

                                                                                                                                                                                    cd /Applications/MAMP/htdocs/wp-content/plugins/my-plugin \nvendor/bin/codecept run acceptance\nvendor/bin/codecept run functional\nvendor/bin/codecept run wpunit\nvendor/bin/codecept run unit\n

                                                                                                                                                                                    You're now run to customize the suites to your liking or start writing tests, run vendor/bin/codecept to see a list of the available commands.

                                                                                                                                                                                    "},{"location":"v3/tutorials/vvv-setup/","title":"Vvv setup","text":""},{"location":"v3/tutorials/vvv-setup/#setting-up-wp-browser-on-vvv-to-test-a-plugin","title":"Setting up wp-browser on VVV to test a plugin","text":""},{"location":"v3/tutorials/vvv-setup/#requirements","title":"Requirements","text":"
                                                                                                                                                                                    • A Windows, Linux or Mac machine (I'll call this the \"host machine\" or just \"host\").
                                                                                                                                                                                    • A working installation of VVV; you should be able to navigate to VVV root directory, run the vagrant up command, and have VVV up and running.
                                                                                                                                                                                    • On the VVV installation you should be able to visit the two default sites URLs without issues; the two default sites addresses are:
                                                                                                                                                                                      • http://one.wordpress.test
                                                                                                                                                                                      • http://two.wordpress.test
                                                                                                                                                                                    "},{"location":"v3/tutorials/vvv-setup/#why-vvv","title":"Why VVV?","text":"

                                                                                                                                                                                    The VVV project provides a \"a Vagrant configuration for developing with WordPress\" and is an excellent, no-frills, starting point to develop WordPress projects (themes, plugins and whole sites. Based on Vagrant and Virtual Box, VVV removes the differences between systems by providing a uniform, Ubuntu Linux based, virtual machine that will bahave the same on Windows, Linux and Mac. Configuring it to run WordPress tests is easy: let's get started.

                                                                                                                                                                                    "},{"location":"v3/tutorials/vvv-setup/#check-vvv-works-correctly","title":"Check VVV works correctly","text":"

                                                                                                                                                                                    This walk-through starts after VVV has been installed and is running on the host machine; the installation guide is clear and simple to follow and I'm not duplicating it here. In the context of this guide I'm assuming VVV lives in the ~/Repos/VVV directory, that we are working on the my-plugin project and that the plugin is being developed in the default (wordpress-one) WordPress installation provided by the box. If your VVV installation lies elsewhere, replace the ~/Repos/VVV with the actual directory in each command.

                                                                                                                                                                                    After completing the installation of VVV navigate to VVV root folder and run the vagrant up command:

                                                                                                                                                                                    cd ~/Repos/VVV\nvagrant up\n

                                                                                                                                                                                    After the automatic bootstrap and initialization process completed, VVV makes two WordPress sites available:

                                                                                                                                                                                    • http://one.wordpress.test/ is the first default site address.
                                                                                                                                                                                    • http://two.wordpress.test/ is the second default site address.
                                                                                                                                                                                    • http://vvv.test/ is VVV dashboard address.

                                                                                                                                                                                    You should be able to reach each one of the URLs above without issues, should this not be the case something during VVV setup did not go according to the plan and you should fix it before moving on.

                                                                                                                                                                                    If the sanity check above is complete it's time to move to the following part specific to Codeception and wp-browser setup.

                                                                                                                                                                                    "},{"location":"v3/tutorials/vvv-setup/#in-and-out-host-and-guest","title":"In and out, host and guest","text":"

                                                                                                                                                                                    The Vagrant box provided by VVV goes beyond a simple MySQL, PHP and Ngnix server stack and provides a complete WordPress development environment; tools like Composer, [grunt-cli][4992-0003], and [wp-cli][4992-0006] are ready to use.

                                                                                                                                                                                    This allows the entire development, when it comes to the CLI tools, to happen in the virtual machine and not outside of it.

                                                                                                                                                                                    \"Inside the virtual machine\" means the first CLI instruction to run from the ~/Repos/VVV folder (assuming that is the folder where VVV was installed) is this:

                                                                                                                                                                                    cd ~/Repos/VVV\nvagrant ssh\n

                                                                                                                                                                                    This will connect, via SSH, to the virtual machine as the vagrant user. To exit from the SSH session inside the box, just type exit and return.

                                                                                                                                                                                    Note: any further instruction I'm showing here, beside the code editing that will happen in a dedicated PHP IDE like [PHPStorm][4992-0004] or [Sublime Text][4992-0005] on the host machine, will happen \"inside the virtual machine\".

                                                                                                                                                                                    When I say \"host machine\" I mean your laptop, desktop or whatever computer you're working on; when I say \"guest machine\" I mean VVV virtual machine; this is usually the case for any virtual-ish setup (Vagrant, Docker and the like).

                                                                                                                                                                                    "},{"location":"v3/tutorials/vvv-setup/#scaffolding-the-project-folder","title":"Scaffolding the project folder","text":"

                                                                                                                                                                                    I'm assuming the scope of the development is to test the my-plugin plugin.

                                                                                                                                                                                    The first step is to create the bare minimum code required to make the plugin show up among the available WordPress plugins. Create the main plugin file in the http://one.wordpress.test installation plugins directory, in the ~/Repos/VVV/www/wordpress-one/public_html/wp-content/plugins/my-plugin/my-plugin.php file:

                                                                                                                                                                                    <?php\n/**\n * Plugin Name: My plugin\n */ \n

                                                                                                                                                                                    The plugin should now show up, activate and deactivate correctly, among the plugins listed in the VVV default WordPress installation at http://one.wordpress.test/wp-admin/plugins.php.

                                                                                                                                                                                    By default, VVV administrator user name is admin and password is password.

                                                                                                                                                                                    "},{"location":"v3/tutorials/vvv-setup/#installing-wp-browser","title":"Installing wp-browser","text":"

                                                                                                                                                                                    Since Composer is provided from VVV, installing wp-browser requires entering the virtual machine (if you did not already):

                                                                                                                                                                                    cd ~/Repos/VVV\nvagrant ssh\n

                                                                                                                                                                                    Once inside navigate to the plugins folder. The path is now relative to VVV filesystem structure so it won't be the same as the one used above that was, instead, in the context of the \"host machine\":

                                                                                                                                                                                    cd /srv/www/wordpress-one/public_html/wp-content/plugins/my-plugin \ncomposer init\n

                                                                                                                                                                                    Composer will ask some questions to initialize the project, for the sake of this small guide the answers are not relevant. Here is the composer.json file generated by the above answers:

                                                                                                                                                                                    {\n    \"name\": \"vagrant/my-plugin\",\n    \"type\": \"wordpress-plugin\",\n    \"require\": {}\n}\n

                                                                                                                                                                                    Next require lucatume/wp-browser as a development dependency:

                                                                                                                                                                                    composer require --dev lucatume/wp-browser\n

                                                                                                                                                                                    Composer installs any dependency binary file, an executable file, in the project vendor/bin folder. To check Codeception is correctly installed run this command:

                                                                                                                                                                                    vendor/bin/codecept --version\n

                                                                                                                                                                                    Since wp-browser requires Codeception, there is no need to require Codeception explicitly as a development dependency.

                                                                                                                                                                                    "},{"location":"v3/tutorials/vvv-setup/#setting-up-wp-browser","title":"Setting up wp-browser","text":"

                                                                                                                                                                                    For those that might get lost while trying to set up wp-browser for the first time the VVV context provides an excellent base to understand the process.

                                                                                                                                                                                    wp-browser needs to know:

                                                                                                                                                                                    • Where the WordPress installation files are located: they will be loaded in integration and \"WordPress unit\" tests.
                                                                                                                                                                                    • How to connect to the WordPress site \"normal\" database: this is the database that stores the data of the site I would see when visiting the local installation URL (http://one.wordpress.test in the case of the VVV default installation).
                                                                                                                                                                                    • How to connect to the database dedicated to the integration and \"WordPress unit\" tests: this database will be used to install WordPress during integration and \"WordPress unit\" tests.

                                                                                                                                                                                    Any test suite using a database should never run on a database containing data of any value; this means that if I am using VVV for my day to day WordPress development my first step should be to backup the site database.

                                                                                                                                                                                    You can create a backup of the current site database contents using wp-cli from within the virtual machine:

                                                                                                                                                                                    cd /srv/www/wordpress-one/public_html\nwp db export wordpress-one-backup.sql\n

                                                                                                                                                                                    At any moment you can re-import the site database dump using this command, the site database will be reset to the state it was when you created the database dump:

                                                                                                                                                                                    cd /srv/www/wordpress-one/public_html\nwp db import wordpress-one-backup.sql\n

                                                                                                                                                                                    "},{"location":"v3/tutorials/vvv-setup/#creating-the-database-dedicated-to-the-tests","title":"Creating the database dedicated to the tests","text":"

                                                                                                                                                                                    wp-browser will use the databases it works on in a destructive way: between tests the data will be lost.

                                                                                                                                                                                    After the backup you should have done in the previous step, the next step is creating a database dedicated to the test.

                                                                                                                                                                                    At the VVV box command line run:

                                                                                                                                                                                    mysql -u root -p -e \"CREATE DATABASE if not exists tests\"\nmysql -u root -p -e \"GRANT ALL PRIVILEGES ON tests.* TO 'wp'@'localhost';\"\n

                                                                                                                                                                                    When prompted for the password enter root. The first command creates the tests database, if it does not exist; the second command grants the wp user all privileges on it.

                                                                                                                                                                                    In VVV the root database user name is root and the password is root.

                                                                                                                                                                                    Check the database was correctly created running this command:

                                                                                                                                                                                    mysql -u root -p -e \"SHOW DATABASES\"\n

                                                                                                                                                                                    The tests database should be present in the list.

                                                                                                                                                                                    "},{"location":"v3/tutorials/vvv-setup/#bootstrapping-and-configuring-wp-browser","title":"Bootstrapping and configuring wp-browser","text":"

                                                                                                                                                                                    After the backup is done it's time to bootstrap wp-browser using its interactive mode:

                                                                                                                                                                                    cd /srv/www/wordpress-one/public_html/wp-content/plugins/my-plugin\nvendor/bin/codecept init wpbrowser\n

                                                                                                                                                                                    The initialization guide will ask a number of questions. In the screenshots below are the answers I used to configure wp-browser.

                                                                                                                                                                                    Below a complete list of each answer:

                                                                                                                                                                                    • I acknowledge wp-browser should run on development servers... y
                                                                                                                                                                                    • Would you like to set up the suites interactively now? y
                                                                                                                                                                                    • How would you like the acceptance suite to be called? acceptance
                                                                                                                                                                                    • How would you like the functional suite to be called? functional
                                                                                                                                                                                    • How would you like the WordPress unit and integration suite to be called? wpunit
                                                                                                                                                                                    • How would you like to call the env configuration file? .env.testing
                                                                                                                                                                                    • What is the path of the WordPress root directory? /srv/www/wordpress-one/public_html
                                                                                                                                                                                    • What is the path, relative to WordPress root URL, of the admin area of the test site? /wp-admin
                                                                                                                                                                                    • What is the name of the test database used by the test site? tests
                                                                                                                                                                                    • What is the host of the test database used by the test site? localhost
                                                                                                                                                                                    • What is the user of the test database used by the test site? root
                                                                                                                                                                                    • What is the password of the test database used by the test site? root
                                                                                                                                                                                    • What is the table prefix of the test database used by the test site? wp_
                                                                                                                                                                                    • What is the name of the test database WPLoader should use? tests
                                                                                                                                                                                    • What is the host of the test database WPLoader should use? localhost
                                                                                                                                                                                    • What is the user of the test database WPLoader should use? root
                                                                                                                                                                                    • What is the password of the test database WPLoader should use? root
                                                                                                                                                                                    • What is the table prefix of the test database WPLoader should use? wp_
                                                                                                                                                                                    • What is the URL the test site? http://one.wordpress.test
                                                                                                                                                                                    • What is the email of the test site WordPress administrator? admin@one.wordpress.test
                                                                                                                                                                                    • What is the title of the test site? My Plugin Test
                                                                                                                                                                                    • What is the login of the administrator user of the test site? admin
                                                                                                                                                                                    • What is the password of the administrator user of the test site? password
                                                                                                                                                                                    • Are you testing a plugin, a theme or a combination of both (both)? plugin
                                                                                                                                                                                    • What is the folder/plugin.php name of the plugin? my-plugin/my-plugin.php
                                                                                                                                                                                    • Does your project needs additional plugins to be activated to work? no

                                                                                                                                                                                    Codeception will build the suites for the first time and should be ready to go.

                                                                                                                                                                                    "},{"location":"v3/tutorials/vvv-setup/#setting-up-the-starting-database-fixture","title":"Setting up the starting database fixture","text":"

                                                                                                                                                                                    A \"fixture\", in testing terms, is a minimal, starting environment shared by all tests. In BDD it's the Background any scenario will share. In the case of a plugin the minimal, starting environment is the following:

                                                                                                                                                                                    • A fresh WordPress installation empty of any content.
                                                                                                                                                                                    • WordPress using its default theme.
                                                                                                                                                                                    • The only active plugin is the one you're testing, in this example: my-plugin.

                                                                                                                                                                                    You can set up this fixture \"manually\", using the site administration UI at http://one.wordpress.test/wp-admin, or use wp-cli and save precious time.

                                                                                                                                                                                    The following command will empty the site, backup any content you care about first!

                                                                                                                                                                                    As it's been the case so far, I'm running the following command from within the VVV box (use vagrant ssh to log in):

                                                                                                                                                                                    cd /srv/www/wordpress-one/public_html\nwp site empty --yes --uploads\nwp plugin deactivate --all\nwp plugin activate my-plugin\nwp db export wp-content/plugins/my-plugin/tests/_data/dump.sql\n

                                                                                                                                                                                    The initial database fixture has been created, now there's one last step to complete.

                                                                                                                                                                                    "},{"location":"v3/tutorials/vvv-setup/#using-the-tests-database-in-acceptance-and-functional-tests","title":"Using the tests database in acceptance and functional tests","text":"

                                                                                                                                                                                    Acceptance and functional tests will act as users, navigating to the site pages and making requests as a user would.

                                                                                                                                                                                    This means that WordPress will load, and with it its wp-config.php file, to handle the requests made by the tests.

                                                                                                                                                                                    During the setup phase I've specified the database to be used for acceptance and functional tests as tests but, looking at the contents of the /srv/www/wordpress-one/public_html/wp-config.php file, the DB_NAME constant is set to wordpress-one.

                                                                                                                                                                                    What we'll do now means:

                                                                                                                                                                                    • If the request is a normal one, use the wordpress-one database.
                                                                                                                                                                                    • If the request comes from a test, use the tests database.

                                                                                                                                                                                    In your IDE/text-editor of choice edit the ~/Repos/VVV/www/wordpress-one/public_html/wp-config.php and replace the line defining the DB_NAME constant like this:

                                                                                                                                                                                    - define( 'DB_NAME', 'wordpress-one' );\n+ if( isset( $_SERVER['HTTP_X_WPBROWSER_REQUEST'] ) && $_SERVER['HTTP_X_WPBROWSER_REQUEST'] ) { \n+    define( 'DB_NAME', 'tests' );\n+ } else {\n+    define( 'DB_NAME', 'wordpress-one' );\n+ }\n

                                                                                                                                                                                    Here's the copy-and-paste friendly version:

                                                                                                                                                                                    if( isset( $_SERVER['HTTP_X_TEST_REQUEST'] ) && $_SERVER['HTTP_X_TEST_REQUEST'] ) {\n        define( 'DB_NAME', 'tests' );\n} else {\n        define( 'DB_NAME', 'wordpress-one' );\n}\n

                                                                                                                                                                                    If you look at the tests/acceptance.suite.yml and tests/functional.suite.yml files, respectively the acceptance and functional suite configuration files, you will see these entries in the WPBrowser module configuration:

                                                                                                                                                                                    headers:\n    X_TEST_REQUEST: 1\n    X_WPBROWSER_REQUEST: 1\n

                                                                                                                                                                                    This means that, with each HTTP request done during tests, the module will send the two headers. Those headers are read, on the WordPress side, using the $_SERVER['HTTP_X_TEST_REQUEST'] and $_SERVER['X_WPBROWSER_REQUEST'] variables.

                                                                                                                                                                                    Codeception and wp-browser are ready to run and the test-drive development can start.

                                                                                                                                                                                    "},{"location":"v3/tutorials/vvv-setup/#sanity-check","title":"Sanity check","text":"

                                                                                                                                                                                    Before starting to write tests, take a moment to run each suite separately and make sure all is set up correctly.

                                                                                                                                                                                    If you run into issues, there's a chance you forgot something along the way, please take the time to read this tutorial a second time before opening an issue.

                                                                                                                                                                                    You have created 4 suites, each suite has at least one example test to make sure all works. Run each suite and make sure all tests succeed, from within the box run:

                                                                                                                                                                                    cd /srv/www/wordpress-one/public_html/wp-content/plugins/my-plugin \nvendor/bin/codecept run acceptance\nvendor/bin/codecept run functional\nvendor/bin/codecept run wpunit\nvendor/bin/codecept run unit\n

                                                                                                                                                                                    You're now run to customize the suites to your liking or start writing tests, run vendor/bin/codecept to see a list of the available commands.

                                                                                                                                                                                    "},{"location":"v3/tutorials/wamp-setup/","title":"Wamp setup","text":""},{"location":"v3/tutorials/wamp-setup/#setting-up-wp-browser-with-wamp-on-windows-to-test-a-plugin","title":"Setting up wp-browser with WAMP on Windows to test a plugin","text":""},{"location":"v3/tutorials/wamp-setup/#requirements","title":"Requirements","text":"
                                                                                                                                                                                    • A Windows machine
                                                                                                                                                                                    • A working installation of WAMP.
                                                                                                                                                                                    • You should be able to create sites and visit them from your browser without issues.
                                                                                                                                                                                    • Composer installed and working on your terminal PATH, you should be able to run composer --version at the terminal and see the version correctly.
                                                                                                                                                                                    "},{"location":"v3/tutorials/wamp-setup/#install-and-configure-wamp","title":"Install and configure WAMP","text":"

                                                                                                                                                                                    This walk-through starts after WAMP has been installed and is correctly running on the host machine; you can download WAMP from the site and follow the installation instructions. In the context of this guide I'm installing the test WordPress installation in the C:\\wamp64\\www\\wp directory. If your installation lies elsewhere, replace the C:\\wamp64\\www\\wp path with the actual directory in each command.

                                                                                                                                                                                    "},{"location":"v3/tutorials/wamp-setup/#creating-the-databases-and-installing-wordpress","title":"Creating the databases and installing WordPress","text":"

                                                                                                                                                                                    Go to the http://localhost/phpmyadmin/index.php page and create two new databases:

                                                                                                                                                                                    • wordpress is the database you will use for WordPress
                                                                                                                                                                                    • tests is the database you will use for the tests

                                                                                                                                                                                    The default database user is root, the default password is empty.

                                                                                                                                                                                    Unzip the the WordPress files into the C:\\wamp64\\www\\wp and head over to http://localhost/wp to install WordPress. The database credentials for the installation are:

                                                                                                                                                                                    • Database name: wordpress
                                                                                                                                                                                    • Database user: root
                                                                                                                                                                                    • Database password is empty
                                                                                                                                                                                    • Database host: localhost

                                                                                                                                                                                    Use admin as administrator user name and password as password for the administrator user.

                                                                                                                                                                                    Make sure you can visit the WordPress installation at http://localhost/wp and that you can correctly access the administration area at http://localhost/wp/wp-admin.

                                                                                                                                                                                    "},{"location":"v3/tutorials/wamp-setup/#scaffolding-the-project-folder","title":"Scaffolding the project folder","text":"

                                                                                                                                                                                    I'm assuming the scope of the development is to test the my-plugin plugin.

                                                                                                                                                                                    The first step is to create the bare minimum code required to make the plugin show up among the available WordPress plugins. Create the main plugin file in the WordPress installation plugins directory, in the C:\\wamp64\\www\\wp\\wp-content\\plugins\\my-plugin\\my-plugin.php file:

                                                                                                                                                                                    <?php\n/**\n * Plugin Name: My plugin\n */ \n

                                                                                                                                                                                    The plugin should now show up, activate and deactivate correctly, among the plugins listed in the WordPress installation at http://localhost/wp/wp-admin/plugins.php.

                                                                                                                                                                                    "},{"location":"v3/tutorials/wamp-setup/#installing-wp-browser","title":"Installing wp-browser","text":"

                                                                                                                                                                                    Open a terminal window and navigate to the plugin directory and initialize the Composer project. I'm using Cmder as terminal emulator on Windows, but you can use the default one.

                                                                                                                                                                                    cd C:\\wamp64\\www\\wp\\wp-content\\plugins\\my-plugin\ncomposer init\n

                                                                                                                                                                                    Composer will ask some questions to initialize the project, for the sake of this small guide the answers are not relevant. Here is the composer.json file generated by the above answers:

                                                                                                                                                                                    {\n    \"name\": \"wamp/my-plugin\",\n    \"type\": \"wordpress-plugin\",\n    \"require\": {}\n}\n

                                                                                                                                                                                    Next require lucatume/wp-browser as a development dependency:

                                                                                                                                                                                    composer require --dev lucatume/wp-browser\n

                                                                                                                                                                                    Composer installs any dependency binary file, an executable file, in the project vendor/bin folder. To check Codeception is correctly installed run this command:

                                                                                                                                                                                    vendor\\bin\\codecept.bat --version\n

                                                                                                                                                                                    Since wp-browser requires Codeception, there is no need to require Codeception explicitly as a development dependency.

                                                                                                                                                                                    "},{"location":"v3/tutorials/wamp-setup/#setting-up-wp-browser","title":"Setting up wp-browser","text":"

                                                                                                                                                                                    For those that might get lost while trying to set up wp-browser for the first time the VVV context provides an excellent base to understand the process.

                                                                                                                                                                                    wp-browser needs to know:

                                                                                                                                                                                    • Where the WordPress installation files are located: they will be loaded in integration and \"WordPress unit\" tests.
                                                                                                                                                                                    • How to connect to the WordPress site \"normal\" database: this is the database that stores the data of the site I would see when visiting the local installation URL at http://localhost/wp.
                                                                                                                                                                                    • How to connect to the database dedicated to the integration and \"WordPress unit\" tests: this database will be used to install WordPress during integration and \"WordPress unit\" tests.

                                                                                                                                                                                    Any test suite using a database should never run on a database containing data of any value; this means that your first step should be to backup the site database.

                                                                                                                                                                                    You can create a backup of the current site database contents using phpMyAdmin, at http://localhost/phpmyadmin/, under the \"Export\" tab:

                                                                                                                                                                                    At any moment you can re-import the site database dump using, again, phpMyAdmin, under the \"Import\" tab:

                                                                                                                                                                                    "},{"location":"v3/tutorials/wamp-setup/#bootstrapping-and-configuring-wp-browser","title":"Bootstrapping and configuring wp-browser","text":"

                                                                                                                                                                                    After the backup is done it's time to bootstrap wp-browser using its interactive mode:

                                                                                                                                                                                    cd C:\\wamp64\\www\\wp\\wp-content\\plugins\\my-plugin\nvendor/bin/codecept.bat init wpbrowser\n

                                                                                                                                                                                    The initialization guide will ask a number of questions. In the screenshots below are the answers I used to configure wp-browser.

                                                                                                                                                                                    Below a complete list of each answer:

                                                                                                                                                                                    • I acknowledge wp-browser should run on development servers... y
                                                                                                                                                                                    • Would you like to set up the suites interactively now? y
                                                                                                                                                                                    • How would you like the acceptance suite to be called? acceptance
                                                                                                                                                                                    • How would you like the functional suite to be called? functional
                                                                                                                                                                                    • How would you like the WordPress unit and integration suite to be called? wpunit
                                                                                                                                                                                    • How would you like to call the env configuration file? .env.testing
                                                                                                                                                                                    • What is the path of the WordPress root directory? C:/wamp64/www/wp
                                                                                                                                                                                    • What is the path, relative to WordPress root URL, of the admin area of the test site? /wp-admin
                                                                                                                                                                                    • What is the name of the test database used by the test site? tests
                                                                                                                                                                                    • What is the host of the test database used by the test site? localhost
                                                                                                                                                                                    • What is the user of the test database used by the test site? root
                                                                                                                                                                                    • What is the password of the test database used by the test site? ``
                                                                                                                                                                                    • What is the table prefix of the test database used by the test site? wp_
                                                                                                                                                                                    • What is the name of the test database WPLoader should use? tests
                                                                                                                                                                                    • What is the host of the test database WPLoader should use? localhost
                                                                                                                                                                                    • What is the user of the test database WPLoader should use? root
                                                                                                                                                                                    • What is the password of the test database WPLoader should use? ``
                                                                                                                                                                                    • What is the table prefix of the test database WPLoader should use? wp_
                                                                                                                                                                                    • What is the URL the test site? http://localhost/wp
                                                                                                                                                                                    • What is the email of the test site WordPress administrator? admin@wp.test
                                                                                                                                                                                    • What is the title of the test site? My Plugin Test
                                                                                                                                                                                    • What is the login of the administrator user of the test site? admin
                                                                                                                                                                                    • What is the password of the administrator user of the test site? password
                                                                                                                                                                                    • Are you testing a plugin, a theme or a combination of both (both)? plugin
                                                                                                                                                                                    • What is the folder/plugin.php name of the plugin? my-plugin/my-plugin.php
                                                                                                                                                                                    • Does your project needs additional plugins to be activated to work? no

                                                                                                                                                                                    Codeception will build the suites for the first time and should be ready to go.

                                                                                                                                                                                    "},{"location":"v3/tutorials/wamp-setup/#setting-up-the-starting-database-fixture","title":"Setting up the starting database fixture","text":"

                                                                                                                                                                                    A \"fixture\", in testing terms, is a minimal, starting environment shared by all tests. In BDD it's the Background any scenario will share. In the case of a plugin the minimal, starting environment is the following:

                                                                                                                                                                                    • A fresh WordPress installation empty of any content.
                                                                                                                                                                                    • WordPress using its default theme.
                                                                                                                                                                                    • The only active plugin is the one you're testing, in this example: my-plugin.

                                                                                                                                                                                    You should set up this fixture \"manually\", using the site administration UI at http://localhost/wp/wp-admin.

                                                                                                                                                                                    The following command will empty the site, backup any content you care about first!

                                                                                                                                                                                    When you're done setting up the initial database fixture, export it using the \"Export\" tab of phpMyAdmin, at http://localhost/phpmyadmin/ and move the file to the C:\\wamp64\\www\\wp\\wp-content\\plugins\\my-plugin\\tests\\_data\\dump.sql directory.

                                                                                                                                                                                    There is one last step left to complete the setup.

                                                                                                                                                                                    "},{"location":"v3/tutorials/wamp-setup/#using-the-tests-database-in-acceptance-and-functional-tests","title":"Using the tests database in acceptance and functional tests","text":"

                                                                                                                                                                                    Acceptance and functional tests will act as users, navigating to the site pages and making requests as a user would.

                                                                                                                                                                                    This means that WordPress will load, and with it its wp-config.php file, to handle the requests made by the tests.

                                                                                                                                                                                    During the setup phase I've specified the database to be used for acceptance and functional tests as tests but, looking at the contents of the C:\\wamp64\\www\\wp\\wp-config.php file, the DB_NAME constant is set to wordpress.

                                                                                                                                                                                    What we'll do now means:

                                                                                                                                                                                    • If the request is a normal one, use the wordpress database.
                                                                                                                                                                                    • If the request comes from a test, use the tests database.

                                                                                                                                                                                    In your IDE/text-editor of choice edit the C:\\wamp64\\www\\wp\\wp-config.php and replace the line defining the DB_NAME constant like this:

                                                                                                                                                                                    - define( 'DB_NAME', 'wordpress' );\n+ if( isset( $_SERVER['HTTP_X_WPBROWSER_REQUEST'] ) && $_SERVER['HTTP_X_WPBROWSER_REQUEST'] ) { \n+    define( 'DB_NAME', 'tests' );\n+ } else {\n+    define( 'DB_NAME', 'wordpress' );\n+ }\n

                                                                                                                                                                                    Here's the copy-and-paste friendly version:

                                                                                                                                                                                    if( isset( $_SERVER['HTTP_X_TEST_REQUEST'] ) && $_SERVER['HTTP_X_TEST_REQUEST'] ) {\n        define( 'DB_NAME', 'tests' );\n} else {\n        define( 'DB_NAME', 'wordpress' );\n}\n

                                                                                                                                                                                    If you look at the tests/acceptance.suite.yml and tests/functional.suite.yml files, respectively the acceptance and functional suite configuration files, you will see these entries in the WPBrowser module configuration:

                                                                                                                                                                                    headers:\n    X_TEST_REQUEST: 1\n    X_WPBROWSER_REQUEST: 1\n

                                                                                                                                                                                    This means that, with each HTTP request done during tests, the module will send the two headers. Those headers are read, on the WordPress side, using the $_SERVER['HTTP_X_TEST_REQUEST'] and $_SERVER['X_WPBROWSER_REQUEST'] variables.

                                                                                                                                                                                    Codeception and wp-browser are ready to run and the test-drive development can start.

                                                                                                                                                                                    "},{"location":"v3/tutorials/wamp-setup/#sanity-check","title":"Sanity check","text":"

                                                                                                                                                                                    Before starting to write tests, take a moment to run each suite separately and make sure all is set up correctly.

                                                                                                                                                                                    If you run into issues, there's a chance you forgot something along the way, please take the time to read this tutorial a second time before opening an issue.

                                                                                                                                                                                    You have created 4 suites, each suite has at least one example test to make sure all works. Run each suite and make sure all tests succeed, from within the box run:

                                                                                                                                                                                    cd C:\\wamp64\\www\\wp\\wp-content\\plugins\\my-plugin \nvendor/bin/codecept run acceptance\nvendor/bin/codecept run functional\nvendor/bin/codecept run wpunit\nvendor/bin/codecept run unit\n

                                                                                                                                                                                    You're now run to customize the suites to your liking or start writing tests, run vendor/bin/codecept.bat to see a list of the available commands.

                                                                                                                                                                                    "}]} \ No newline at end of file diff --git a/docs/public/sitemap.xml.gz b/docs/public/sitemap.xml.gz deleted file mode 100644 index f2981ee82..000000000 Binary files a/docs/public/sitemap.xml.gz and /dev/null differ diff --git a/docs/public/v3/advanced/run-in-separate-process/index.html b/docs/public/v3/advanced/run-in-separate-process/index.html deleted file mode 100644 index c6634cbfc..000000000 --- a/docs/public/v3/advanced/run-in-separate-process/index.html +++ /dev/null @@ -1,527 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - Run in separate process - wp-browser docs - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
                                                                                                                                                                                    - -
                                                                                                                                                                                    - - - - - - -
                                                                                                                                                                                    - - -
                                                                                                                                                                                    - -
                                                                                                                                                                                    - - - - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - - - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - - - - - -

                                                                                                                                                                                    Run in separate process

                                                                                                                                                                                    - -

                                                                                                                                                                                    Running tests in separate processes

                                                                                                                                                                                    -

                                                                                                                                                                                    PHPUnit offers the possibility to run tests in a separate PHP process; Codeception does not officially support the option as of version 4.0.

                                                                                                                                                                                    -

                                                                                                                                                                                    The wp-browser project tries to fill that gap by supporting the @runInSeparateProcess annotation.
                                                                                                                                                                                    -This support comes with some caveats, though:

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    1. The support is only for test cases extending the Codeception\TestCase\WPTestCase class (the base test case for integration or "WordPress unit" tests)
                                                                                                                                                                                    2. -
                                                                                                                                                                                    3. The support wp-browser provides only supports the @preserveGlobalState annotation with the disabled value; this means there is no support for preserving global state between tests.
                                                                                                                                                                                    4. -
                                                                                                                                                                                    -

                                                                                                                                                                                    Read more about what this means in PHPUnit documentation.

                                                                                                                                                                                    -

                                                                                                                                                                                    Why run tests in a separate PHP process?

                                                                                                                                                                                    -

                                                                                                                                                                                    One main reason: isolation.

                                                                                                                                                                                    -

                                                                                                                                                                                    What does "isolation" means?

                                                                                                                                                                                    -

                                                                                                                                                                                    Before answering that question, it's essential to understand, via an example, why a lack of isolation might be an issue.

                                                                                                                                                                                    -

                                                                                                                                                                                    I want to test the get_api function. The function will return the correct singleton instance of an API handling class: an instance of Api when the function is called in non-admin context, and an instance of AdminApi when the function is called in admin context. The get_api function is acting as a service locator.

                                                                                                                                                                                    -
                                                                                                                                                                                    <?php
                                                                                                                                                                                    -function get_api(){
                                                                                                                                                                                    -    static $api;
                                                                                                                                                                                    -
                                                                                                                                                                                    -    if(null !== $api){
                                                                                                                                                                                    -        return $api;
                                                                                                                                                                                    -    }
                                                                                                                                                                                    -
                                                                                                                                                                                    -    if( is_admin() ) {
                                                                                                                                                                                    -        $api = new Admin_Api();
                                                                                                                                                                                    -    } else {
                                                                                                                                                                                    -        $api = new Api();
                                                                                                                                                                                    -    }
                                                                                                                                                                                    -
                                                                                                                                                                                    -    return $api;
                                                                                                                                                                                    -}
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    There are two challenges to testing this function:

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    1. The is_admin function, defined by WordPress, looks up a WP_ADMIN constant to know if the context of the current request is an administration UI one or not.
                                                                                                                                                                                    2. -
                                                                                                                                                                                    3. The get_api function will check for the context and resolve and build the correct instance only once, the first time it's called in the context of a request.
                                                                                                                                                                                    4. -
                                                                                                                                                                                    -

                                                                                                                                                                                    There are some possible solutions to this problem:

                                                                                                                                                                                    -

                                                                                                                                                                                    a. Refactor the get_api function into a method of an Api_Factory object taking the context as a dependency, thus allowing injection of the "context" (which implies the creation of a Context adapter that will proxy its is_admin method to the is_admin function). You can find the code for such refactoring in the OOP refactoring of get_api section. -b. Refactor the get_api function to accept the current is_admin value as an input argument, get_api( $is_admin ), this refactoring moves part of the complexity of getting hold of the correct instance of the API handler on the client code. Adding more build condition and checks, e.g., if the current request is a REST request or not or some tests on the user authorizations, then, requires adding more input arguments to the get_api function: the knowledge of the implementation of the get_api method will "leak" to the client code having to replicate complexity throughout the system.

                                                                                                                                                                                    -

                                                                                                                                                                                    I want to layout possible solutions to the problem to show there is always a design alternative to make code testable that might or might not fit the current time or scope constraint.

                                                                                                                                                                                    -

                                                                                                                                                                                    In this example, I've inherited the get_api function from the existing code, and it cannot be changed, yet I want to test it dealing with the two problems outlined above.

                                                                                                                                                                                    -

                                                                                                                                                                                    Running tests in separate PHP processes

                                                                                                                                                                                    -

                                                                                                                                                                                    To test the get_api function shown above I've created a new wpunit type of test:

                                                                                                                                                                                    -
                                                                                                                                                                                    vendor/bin/codecept g:wpunit integration "api"
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    The command scaffolds a test/integration/apiTest.php file that I've modified to ensure full coverage of the get_api function:

                                                                                                                                                                                    -
                                                                                                                                                                                    <?php
                                                                                                                                                                                    -
                                                                                                                                                                                    -class apiTest extends \Codeception\TestCase\WPTestCase
                                                                                                                                                                                    -{
                                                                                                                                                                                    -    public function test_get_api_exists()
                                                                                                                                                                                    -    {
                                                                                                                                                                                    -        $this->assertTrue(function_exists('get_api'));
                                                                                                                                                                                    -    }
                                                                                                                                                                                    -
                                                                                                                                                                                    -    public function test_get_api_will_cache()
                                                                                                                                                                                    -    {
                                                                                                                                                                                    -        $this->assertSame(get_api(), get_api());
                                                                                                                                                                                    -    }
                                                                                                                                                                                    -
                                                                                                                                                                                    -    /**
                                                                                                                                                                                    -     * @runInSeparateProcess
                                                                                                                                                                                    -     * @preserveGlobalState disabled
                                                                                                                                                                                    -     */
                                                                                                                                                                                    -    public function test_get_api_will_return_api_if_not_admin()
                                                                                                                                                                                    -    {
                                                                                                                                                                                    -        // Let's make sure we're NOT in admin context.
                                                                                                                                                                                    -        define('WP_ADMIN', false);
                                                                                                                                                                                    -
                                                                                                                                                                                    -        $api = get_api();
                                                                                                                                                                                    -
                                                                                                                                                                                    -        $this->assertInstanceOf(Api::class, $api);
                                                                                                                                                                                    -    }
                                                                                                                                                                                    -
                                                                                                                                                                                    -    /**
                                                                                                                                                                                    -     * @runInSeparateProcess
                                                                                                                                                                                    -     * @preserveGlobalState disabled
                                                                                                                                                                                    -     */
                                                                                                                                                                                    -    public function test_get_api_will_cache_api_if_not_admin()
                                                                                                                                                                                    -    {
                                                                                                                                                                                    -        // Let's make sure we're NOT in admin context.
                                                                                                                                                                                    -        define('WP_ADMIN', false);
                                                                                                                                                                                    -
                                                                                                                                                                                    -        $api = get_api();
                                                                                                                                                                                    -
                                                                                                                                                                                    -        $this->assertSame(get_api(), $api);
                                                                                                                                                                                    -    }
                                                                                                                                                                                    -
                                                                                                                                                                                    -    /**
                                                                                                                                                                                    -     * @runInSeparateProcess
                                                                                                                                                                                    -     * @preserveGlobalState disabled
                                                                                                                                                                                    -     */
                                                                                                                                                                                    -    public function test_get_api_will_return_api_if_is_admin()
                                                                                                                                                                                    -    {
                                                                                                                                                                                    -        // Let's make sure we're NOT in admin context.
                                                                                                                                                                                    -        define('WP_ADMIN', true);
                                                                                                                                                                                    -
                                                                                                                                                                                    -        $api = get_api();
                                                                                                                                                                                    -
                                                                                                                                                                                    -        $this->assertInstanceOf(AdminApi::class, $api);
                                                                                                                                                                                    -    }
                                                                                                                                                                                    -
                                                                                                                                                                                    -    /**
                                                                                                                                                                                    -     * @runInSeparateProcess
                                                                                                                                                                                    -     * @preserveGlobalState disabled
                                                                                                                                                                                    -     */
                                                                                                                                                                                    -    public function test_get_api_will_cache_api_if_is_admin()
                                                                                                                                                                                    -    {
                                                                                                                                                                                    -        // Let's make sure we're NOT in admin context.
                                                                                                                                                                                    -        define('WP_ADMIN', true);
                                                                                                                                                                                    -
                                                                                                                                                                                    -        $api = get_api();
                                                                                                                                                                                    -
                                                                                                                                                                                    -        $this->assertSame(get_api(), $api);
                                                                                                                                                                                    -    }
                                                                                                                                                                                    -}
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Some pieces of this code are worth pointing out:

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    1. There are two test methods, test_get_api_exists and test_get_api_will_cache that are not running in a separate process. Running tests in a separate process provide isolation at the cost of speed, only tests that require isolation should run in a separate PHP process.
                                                                                                                                                                                    2. -
                                                                                                                                                                                    3. I instruct the Codeception and PHPUnit test runner to run a test method in a different process by adding two annotations that are both required precisely as shown: - ```php - /**
                                                                                                                                                                                        -
                                                                                                                                                                                      • @runInSeparateProcess
                                                                                                                                                                                      • -
                                                                                                                                                                                      • @preserveGlobalState disabled - */ -```
                                                                                                                                                                                      • -
                                                                                                                                                                                      -
                                                                                                                                                                                    4. -
                                                                                                                                                                                    5. The isolation part of this testing approach shines through when I define, in the last four tests, the WP_ADMIN constant multiple times. If I try to do that in test code running in the same PHP process, then the second define call would cause a fatal error.
                                                                                                                                                                                    6. -
                                                                                                                                                                                    7. The isolation has also taken care of the second issue where the get_api function caches the $api instance after its first resolution in a static variable: since each test happens in a self-contained, dedicated PHP process, the static $api variable will be null at the start of each test.
                                                                                                                                                                                    8. -
                                                                                                                                                                                    -

                                                                                                                                                                                    Can I run some tests in the same process and some in a separate process?

                                                                                                                                                                                    -

                                                                                                                                                                                    Yes. In the example test code in the previous section, the test_get_api_exists and test_get_api_will_cache test methods are not running in separate processes.

                                                                                                                                                                                    -

                                                                                                                                                                                    In your test cases extending the Codeception\TestCase\WPTestCase, you can mix test methods running in the primary PHP process and those running in a separate PHP process without issues.

                                                                                                                                                                                    -

                                                                                                                                                                                    OOP refactoring of get_api

                                                                                                                                                                                    -

                                                                                                                                                                                    In the Why run tests in a separate PHP process? section I've outlined a possible refactoring of the get_api function to make it testable without requiring the use of separate PHP processes.

                                                                                                                                                                                    -

                                                                                                                                                                                    I'm providing this refactoring code below for the sake of completeness, the judgment of which approach is "better" is up to the reader.

                                                                                                                                                                                    -
                                                                                                                                                                                    <?php
                                                                                                                                                                                    -
                                                                                                                                                                                    -class Context_Adapter{
                                                                                                                                                                                    -
                                                                                                                                                                                    -    public function is_admin(){
                                                                                                                                                                                    -        return \is_admin();
                                                                                                                                                                                    -    }
                                                                                                                                                                                    -
                                                                                                                                                                                    -}
                                                                                                                                                                                    -
                                                                                                                                                                                    -class Api_Factory{
                                                                                                                                                                                    -
                                                                                                                                                                                    -    private $api;
                                                                                                                                                                                    -    private $context;
                                                                                                                                                                                    -
                                                                                                                                                                                    -    public function __construct(Context_Adapter $context){
                                                                                                                                                                                    -        $this->context = $context;
                                                                                                                                                                                    -    }
                                                                                                                                                                                    -
                                                                                                                                                                                    -    public function getApi(){
                                                                                                                                                                                    -        if(null !== $this->api){
                                                                                                                                                                                    -            return $this->api;    
                                                                                                                                                                                    -        }
                                                                                                                                                                                    -
                                                                                                                                                                                    -        if($this->context->is_admin()){
                                                                                                                                                                                    -            $api = new Admin_Api;
                                                                                                                                                                                    -        } else {
                                                                                                                                                                                    -            $api = new Api;
                                                                                                                                                                                    -        }
                                                                                                                                                                                    -
                                                                                                                                                                                    -        return $api;
                                                                                                                                                                                    -    }
                                                                                                                                                                                    -}
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Now the Api_Factory class can be injected by injecting a mocked Context_Adapter class, modifying the return value of the Context_Adapter::is_admin method.

                                                                                                                                                                                    -

                                                                                                                                                                                    Due to the supposed requirement of the API instance being a singleton, this solution will also require some container or service-locator to ensure at most only one instance of the Api_Factory exists at any given time in the context of a request.

                                                                                                                                                                                    - - - - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - -
                                                                                                                                                                                    - -
                                                                                                                                                                                    - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - - - - - - - \ No newline at end of file diff --git a/docs/public/v3/bin/sniff b/docs/public/v3/bin/sniff deleted file mode 100644 index 413f50b76..000000000 --- a/docs/public/v3/bin/sniff +++ /dev/null @@ -1,187 +0,0 @@ -#! /usr/bin/env php - -[^\\s]+)\\s+(?\\$[^\\s]+)\\s+(?[^\\s]+)/u'; -$returnPattern = '/@return\\s+(?[^\\s]+)\\s+(?[^\\s]+)/u'; -$missingParamComment = []; -$missingReturnComment = []; -$missingDocs = []; -$emptyDocs = []; -$missingDocEntry = []; -$malformedMarkdownLinks = []; - -/** @var \SplFileInfo $fileInfo */ -foreach ($modules as $module => $fileInfo) { - $moduleName = basename($module, '.php'); - $moduleDoc = $moduleDocsRoot . '/' . $moduleName . '.md'; - $class = 'Codeception\\Module\\' . $moduleName; - $reflectionClass = new ReflectionClass($class); - if (!$reflectionClass->isInstantiable()) { - continue; - } - $methods = $reflectionClass->getMethods(ReflectionMethod::IS_PUBLIC); - $methods = array_filter($methods, static function (ReflectionMethod $method) use ($class) { - return strpos($method->name, '_') !== 0 - && $method->getDeclaringClass()->name === $class - && strpos($method->getDocComment(), '@internal') === false; - }); - /** @var \ReflectionMethod $method */ - foreach ($methods as $method) { - $docBlock = $method->getDocComment(); - if (strpos($docBlock, ' @example') === false) { - $missingExample["{$moduleName}::{$method->name}"] = "{$fileInfo->getPath()}:{$method->getStartLine()}"; - } - if (strpos($docBlock, ' @return void') !== false) { - $voidReturn["{$moduleName}::{$method->name}"] = "{$fileInfo->getPath()}:{$method->getStartLine()}"; - } - - $lines = explode(PHP_EOL, $docBlock); - - foreach ($lines as $line) { - if (strpos($line, "@param") !== false) { - if (!preg_match($paramPattern, $line)) { - $missingParamComment["{$moduleName}::{$method->name}"] = "{$fileInfo->getPath()}:{$method->getStartLine()}"; - } - - continue; - } - - if (strpos($line, "@return") !== false) { - if (!preg_match($returnPattern, $line)) { - $missingReturnComment["{$moduleName}::{$method->name}"] = "{$fileInfo->getPath()}:{$method->getStartLine()}"; - } - } - } - } - - if (!file_exists($moduleDoc)) { - $missingDocs[] = $moduleName; - continue; - } - - $moduleDocContents = file_get_contents($moduleDoc); - if (empty($moduleDocContents)) { - $emptyDocs[] = $moduleName; - continue; - } - $beforeDocTag = explode('', $moduleDocContents); - - if (reset($beforeDocTag) === $moduleDocContents) { - $missingDocEntry[] = $moduleName; - } -} - -$allDocFiles = new CallbackFilterIterator(new RecursiveDirectoryIterator($docsRoot), static function (SplFileInfo $fileInfo) { - return $fileInfo->getExtension() === 'md'; -}); - -/** @var \SplFileInfo $file */ -foreach ($allDocFiles as $file) { - $malformedMarkdownLinkPattern = '/.*\\[[^\\(]*\\]\\s+\\([^\\)]*\\)/um'; - if (preg_match($malformedMarkdownLinkPattern, file_get_contents($file->getPathname()))) { - $malformedMarkdownLinks[] = realpath($file->getPathname()); - } -} - -$output = new ConsoleOutput(); - -if ( - empty($missingExample) - && empty($voidReturn) - && empty($missingParamComment) - && empty($missingReturnComment) - && empty($missingDocs) - && empty($emptyDocs) - && empty($missingDocEntry) - && empty($malformedMarkdownLinks) -) { - $output->writeln('Everything is fine with the modules documentation blocks.'); - echo PHP_EOL; - exit(0); -} - -if (!empty($missingExample)) { - $output->writeln("Some methods are missing an @example entry, here's a list."); - $output->writeln('(Paths will be clickable in any modern shell to edit them directly.)'); - echo PHP_EOL; - foreach ($missingExample as $moduleMethod => $path) { - $output->writeln("{$moduleMethod} => {$path}"); - } - echo PHP_EOL; -} - -if (!empty($voidReturn)) { - $output->writeln("Some methods have a '@return void' entry, here's a list."); - $output->writeln('(Paths will be clickable in any modern shell to edit them directly.)'); - echo PHP_EOL; - foreach ($voidReturn as $moduleMethod => $path) { - $output->writeln("{$moduleMethod} => {$path}"); - } - echo PHP_EOL; -} - -if (!empty($missingParamComment)) { - $output->writeln("Some methods have a '@param' entry missing a comment, here's a list."); - $output->writeln('(Paths will be clickable in any modern shell to edit them directly.)'); - echo PHP_EOL; - foreach ($missingParamComment as $moduleMethod => $path) { - $output->writeln("{$moduleMethod} => {$path}"); - } - echo PHP_EOL; -} - -if (!empty($missingReturnComment)) { - $output->writeln("Some methods have a '@return' entry missing a comment, here's a list."); - $output->writeln('(Paths will be clickable in any modern shell to edit them directly.)'); - echo PHP_EOL; - foreach ($missingReturnComment as $moduleMethod => $path) { - $output->writeln("{$moduleMethod} => {$path}"); - } - echo PHP_EOL; -} - -if (!(empty($missingDocs) && empty($emptyDocs))) { - $emptyDocModules = array_unique(array_merge($missingDocs, $emptyDocs)); - $output->writeln("Some Modules are missing a documentation file or have an empty documentation, here's a list"); - echo PHP_EOL; - foreach ($emptyDocModules as $module) { - $output->writeln("{$module}"); - } - echo PHP_EOL; -} - -if (!empty($missingDocEntry)) { - $output->writeln("Some Modules are missing a documentation entry, here's a list"); - echo PHP_EOL; - foreach ($missingDocEntry as $module) { - $output->writeln("{$module}"); - } - echo PHP_EOL; -} - -if (!empty($malformedMarkdownLinks)) { - $output->writeln("Some documentation pages have malformed markdown links, here's a list"); - echo PHP_EOL; - foreach ($malformedMarkdownLinks as $file) { - $basename = basename($file); - $output->writeln("{$basename} => {$file}"); - } - echo PHP_EOL; -} - -exit(1); - - diff --git a/docs/public/v3/bin/update_doc.php b/docs/public/v3/bin/update_doc.php deleted file mode 100644 index 8aeabe718..000000000 --- a/docs/public/v3/bin/update_doc.php +++ /dev/null @@ -1,54 +0,0 @@ -.*' - . preg_quote('', '/') - . ').*(?' - . preg_quote('', '/') - . '.*)/usm', - $dest_contents, - $matches -); - -if (!isset($matches['before'], $matches['after'])) { - echo PHP_EOL . "File {$dest} does not contain any .* fenced entry."; - exit(1); -} - -// Remove empty header line from the source. -$src_contents = preg_replace('/^#+\\s+$/um', '', $src_contents); - -$updated_dest_contents = $matches['before'] . PHP_EOL . $src_contents . $matches['after']; - -$updated = file_put_contents($dest, $updated_dest_contents); - -if (!$updated) { - echo PHP_EOL . "File {$dest} could not be updated."; - exit(1); -} - -echo PHP_EOL . "File {$dest} contents updated."; -exit(0); diff --git a/docs/public/v3/bin/wpbdocmd b/docs/public/v3/bin/wpbdocmd deleted file mode 100644 index 430805d14..000000000 --- a/docs/public/v3/bin/wpbdocmd +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/env php -run(); -exit($code); - diff --git a/docs/public/v3/codeception-4-support/index.html b/docs/public/v3/codeception-4-support/index.html deleted file mode 100644 index b524b8337..000000000 --- a/docs/public/v3/codeception-4-support/index.html +++ /dev/null @@ -1,342 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - Codeception 4 support - wp-browser docs - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
                                                                                                                                                                                    - -
                                                                                                                                                                                    - - - - - - -
                                                                                                                                                                                    - - -
                                                                                                                                                                                    - -
                                                                                                                                                                                    - - - - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - - - - - -

                                                                                                                                                                                    Codeception 4 support

                                                                                                                                                                                    - -

                                                                                                                                                                                    Using wp-browser with Codeception 4.0

                                                                                                                                                                                    -

                                                                                                                                                                                    Codeception version 4.0 introduced a number of new features to the framework and it's the version of wp-browser that will be maintained from now on.

                                                                                                                                                                                    -

                                                                                                                                                                                    I've made an effort to keep wp-browser compatible with PHP 5.6 and Codeception versions from 2.5 up.

                                                                                                                                                                                    -

                                                                                                                                                                                    One the biggest changes of Codeception version 4.0 is that modules have been broken out into separate packages.
                                                                                                                                                                                    -To use wp-browser with Codeception 4.0 all you need to do is to add this to your project composer.json file:

                                                                                                                                                                                    -
                                                                                                                                                                                    {
                                                                                                                                                                                    -  "require-dev": {
                                                                                                                                                                                    -    "lucatume/wp-browser": "^2.4",
                                                                                                                                                                                    -    "codeception/module-asserts": "^1.0",
                                                                                                                                                                                    -    "codeception/module-phpbrowser": "^1.0",
                                                                                                                                                                                    -    "codeception/module-webdriver": "^1.0",
                                                                                                                                                                                    -    "codeception/module-db": "^1.0",
                                                                                                                                                                                    -    "codeception/module-filesystem": "^1.0",
                                                                                                                                                                                    -    "codeception/module-cli": "^1.0",
                                                                                                                                                                                    -    "codeception/util-universalframework": "^1.0"
                                                                                                                                                                                    -  }
                                                                                                                                                                                    -}
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    You might not need all the modules listed here, depending on the wp-browser modules you use in your test suites.
                                                                                                                                                                                    -This is a scheme of what Codeception modules you will need for which wp-browser module to help you choose only the required modules:

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • "codeception/module-asserts" - Required for Codeception 4.0 compatibility.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • "codeception/module-phpbrowser" - Required by the WPBrowser module.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • "codeception/module-webdriver" - Required by the WPWebDriver module.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • "codeception/module-db" - Required by the WPDb module.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • "codeception/module-filesystem" - Required by the WPFilesystem module.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • "codeception/module-cli" - Required by the WPCLI module.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • "codeception/util-universalframework" - Required by the WordPress framework module.
                                                                                                                                                                                    • -
                                                                                                                                                                                    - - - - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - -
                                                                                                                                                                                    - -
                                                                                                                                                                                    - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - - - - - - - \ No newline at end of file diff --git a/docs/public/v3/codeception-phpunit-and-wpbrowser/index.html b/docs/public/v3/codeception-phpunit-and-wpbrowser/index.html deleted file mode 100644 index c2b4f3575..000000000 --- a/docs/public/v3/codeception-phpunit-and-wpbrowser/index.html +++ /dev/null @@ -1,357 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - Codeception phpunit and wpbrowser - wp-browser docs - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
                                                                                                                                                                                    - -
                                                                                                                                                                                    - - - - - - -
                                                                                                                                                                                    - - -
                                                                                                                                                                                    - -
                                                                                                                                                                                    - - - - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - - - - - -

                                                                                                                                                                                    Codeception phpunit and wpbrowser

                                                                                                                                                                                    - -

                                                                                                                                                                                    The wp-browser stack

                                                                                                                                                                                    -

                                                                                                                                                                                    The wp-browser project is built leveraging the power of a number of open-source projects.

                                                                                                                                                                                    -

                                                                                                                                                                                    While I'm not listing all of them here it's worth mentioning those that will come up, again and again, in the documentation.

                                                                                                                                                                                    -

                                                                                                                                                                                    WordPress

                                                                                                                                                                                    -

                                                                                                                                                                                    WordPress is open source software you can use to create a beautiful website, blog, or app.

                                                                                                                                                                                    -

                                                                                                                                                                                    The line is taken directly from WordPress.org site.

                                                                                                                                                                                    -

                                                                                                                                                                                    In the context of this documentation WordPress is the PHP and JavaScript framework websites and web applications can be built on, the one anyone can download from here.

                                                                                                                                                                                    -

                                                                                                                                                                                    Codeception

                                                                                                                                                                                    -

                                                                                                                                                                                    Codeception (home) is a modern, powerful PHP testing framework written in PHP.

                                                                                                                                                                                    -

                                                                                                                                                                                    It comes with a number of modules and extensions that are comparable to WordPress plugins and themes.

                                                                                                                                                                                    -

                                                                                                                                                                                    Modules and extensions are combined in suites to be able to run a specific type of test. Each suite will handle a specific type of test for a specific set of code.

                                                                                                                                                                                    -

                                                                                                                                                                                    wp-browser is none other than a collection of modules and extensions for Codeception made specifically to test WordPress applications.

                                                                                                                                                                                    -

                                                                                                                                                                                    PHPUnit

                                                                                                                                                                                    -

                                                                                                                                                                                    PHPUnit is the most widely known PHP testing framework. As the name implies it was born to make unit testing of PHP code easier but its scope and power has grown well below that.

                                                                                                                                                                                    -

                                                                                                                                                                                    Codeception is based, and uses, PhpUnit to wrap some of its functionalities into an easy-to-use API.
                                                                                                                                                                                    -The two are so compatible one with the other that Codeception can run PHPUnit tests with little to no changes.

                                                                                                                                                                                    -

                                                                                                                                                                                    This documentation will not cover this subject and will only deal with Codeception-native test methods but you can find more information here.

                                                                                                                                                                                    - - - - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - -
                                                                                                                                                                                    - -
                                                                                                                                                                                    - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - - - - - - - \ No newline at end of file diff --git a/docs/public/v3/commands/index.html b/docs/public/v3/commands/index.html deleted file mode 100644 index 92d9cd4a3..000000000 --- a/docs/public/v3/commands/index.html +++ /dev/null @@ -1,577 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - Custom commands provided by wp-browser - wp-browser docs - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
                                                                                                                                                                                    - -
                                                                                                                                                                                    - - - - - - -
                                                                                                                                                                                    - - -
                                                                                                                                                                                    - -
                                                                                                                                                                                    - - - - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - - - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - - - - - -

                                                                                                                                                                                    Custom commands provided by wp-browser

                                                                                                                                                                                    -

                                                                                                                                                                                    The project comes with its own set of custom Codeception commands.

                                                                                                                                                                                    -

                                                                                                                                                                                    The commands provide functionalities to quickly scaffold different types of tests. -Any other codecept command remains intact and available.

                                                                                                                                                                                    -

                                                                                                                                                                                    Adding the commands to an existing project

                                                                                                                                                                                    -

                                                                                                                                                                                    The commands are added to the main Codeception configuration file, codeception.yml, when scaffolding a project via the codecept init wp-browser command.

                                                                                                                                                                                    -

                                                                                                                                                                                    They can be added to any existing project adding, or editing, the commands section of the configuration file:

                                                                                                                                                                                    -
                                                                                                                                                                                    extensions:
                                                                                                                                                                                    -    commands:
                                                                                                                                                                                    -        - "Codeception\\Command\\GenerateWPUnit"
                                                                                                                                                                                    -        - "Codeception\\Command\\GenerateWPRestApi"
                                                                                                                                                                                    -        - "Codeception\\Command\\GenerateWPRestController"
                                                                                                                                                                                    -        - "Codeception\\Command\\GenerateWPRestPostTypeController"
                                                                                                                                                                                    -        - "Codeception\\Command\\GenerateWPAjax"
                                                                                                                                                                                    -        - "Codeception\\Command\\GenerateWPCanonical"
                                                                                                                                                                                    -        - "Codeception\\Command\\GenerateWPXMLRPC"
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Generation commands

                                                                                                                                                                                    -

                                                                                                                                                                                    The library provides commands to quickly scaffold integration test cases for specific types of WordPress components, see levels of testing for more information.

                                                                                                                                                                                    -

                                                                                                                                                                                    The tests are almost identical to the ones you could write in a PHPUnit based Core suite with the exception of extending the Codeception\TestCase\WPTestCase test case.

                                                                                                                                                                                    -

                                                                                                                                                                                    generate:wpunit

                                                                                                                                                                                    -

                                                                                                                                                                                    Generates a test case extending the \Codeception\TestCase\WPTestCase class using the

                                                                                                                                                                                    -
                                                                                                                                                                                      codecept generate:wpunit suite SomeClass
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    The command will generate a skeleton test case like

                                                                                                                                                                                    -
                                                                                                                                                                                    <?php
                                                                                                                                                                                    -
                                                                                                                                                                                    -class SomeClassTest extends \Codeception\TestCase\WPTestCase
                                                                                                                                                                                    -{
                                                                                                                                                                                    -    public function setUp()
                                                                                                                                                                                    -    {
                                                                                                                                                                                    -      parent::setUp();
                                                                                                                                                                                    -    }
                                                                                                                                                                                    -
                                                                                                                                                                                    -    public function tearDown()
                                                                                                                                                                                    -    {
                                                                                                                                                                                    -      parent::tearDown();
                                                                                                                                                                                    -    }
                                                                                                                                                                                    -
                                                                                                                                                                                    -    // tests
                                                                                                                                                                                    -    public function testMe()
                                                                                                                                                                                    -    {
                                                                                                                                                                                    -    }
                                                                                                                                                                                    -
                                                                                                                                                                                    -}
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    generate:wprest

                                                                                                                                                                                    -

                                                                                                                                                                                    Generates a test case extending the \Codeception\TestCase\WPRestApiTestCase class using the

                                                                                                                                                                                    -
                                                                                                                                                                                      codecept generate:wprest suite SomeClass
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    The command will generate a skeleton test case like

                                                                                                                                                                                    -
                                                                                                                                                                                    <?php
                                                                                                                                                                                    -
                                                                                                                                                                                    -class SomeClassTest extends \Codeception\TestCase\WPRestApiTestCase
                                                                                                                                                                                    -{
                                                                                                                                                                                    -    public function setUp()
                                                                                                                                                                                    -    {
                                                                                                                                                                                    -      parent::setUp();
                                                                                                                                                                                    -    }
                                                                                                                                                                                    -
                                                                                                                                                                                    -    public function tearDown()
                                                                                                                                                                                    -    {
                                                                                                                                                                                    -      parent::tearDown();
                                                                                                                                                                                    -    }
                                                                                                                                                                                    -
                                                                                                                                                                                    -    // tests
                                                                                                                                                                                    -    public function testMe()
                                                                                                                                                                                    -    {
                                                                                                                                                                                    -    }
                                                                                                                                                                                    -
                                                                                                                                                                                    -}
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    generate:wprestcontroller

                                                                                                                                                                                    -

                                                                                                                                                                                    Generates a test case extending the \Codeception\TestCase\WPRestControllerTestCase class using the

                                                                                                                                                                                    -
                                                                                                                                                                                      codecept generate:wprest suite SomeClass
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    The command will generate a skeleton test case like

                                                                                                                                                                                    -
                                                                                                                                                                                    <?php
                                                                                                                                                                                    -
                                                                                                                                                                                    -class SomeClassTest extends \Codeception\TestCase\WPRestControllerTestCase
                                                                                                                                                                                    -{
                                                                                                                                                                                    -    public function setUp()
                                                                                                                                                                                    -    {
                                                                                                                                                                                    -      parent::setUp();
                                                                                                                                                                                    -    }
                                                                                                                                                                                    -
                                                                                                                                                                                    -    public function tearDown()
                                                                                                                                                                                    -    {
                                                                                                                                                                                    -      parent::tearDown();
                                                                                                                                                                                    -    }
                                                                                                                                                                                    -
                                                                                                                                                                                    -    // tests
                                                                                                                                                                                    -    public function testMe()
                                                                                                                                                                                    -    {
                                                                                                                                                                                    -    }
                                                                                                                                                                                    -
                                                                                                                                                                                    -}
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    generate:wprestposttypecontroller

                                                                                                                                                                                    -

                                                                                                                                                                                    Generates a test case extending the \Codeception\TestCase\WPRestPostTypeControllerTestCase class using the

                                                                                                                                                                                    -
                                                                                                                                                                                      codecept generate:wprest suite SomeClass
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    The command will generate a skeleton test case like

                                                                                                                                                                                    -
                                                                                                                                                                                    <?php
                                                                                                                                                                                    -
                                                                                                                                                                                    -class SomeClassTest extends \Codeception\TestCase\WPRestPostTypeControllerTestCase
                                                                                                                                                                                    -{
                                                                                                                                                                                    -    public function setUp()
                                                                                                                                                                                    -    {
                                                                                                                                                                                    -      parent::setUp();
                                                                                                                                                                                    -    }
                                                                                                                                                                                    -
                                                                                                                                                                                    -    public function tearDown()
                                                                                                                                                                                    -    {
                                                                                                                                                                                    -      parent::tearDown();
                                                                                                                                                                                    -    }
                                                                                                                                                                                    -
                                                                                                                                                                                    -    // tests
                                                                                                                                                                                    -    public function testMe()
                                                                                                                                                                                    -    {
                                                                                                                                                                                    -    }
                                                                                                                                                                                    -
                                                                                                                                                                                    -}
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    generate:wpajax

                                                                                                                                                                                    -

                                                                                                                                                                                    Generates a test case extending the \Codeception\TestCase\WPAjaxTestCase class using the

                                                                                                                                                                                    -
                                                                                                                                                                                      codecept generate:wpajax suite SomeClass
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    The command will generate a skeleton test case like

                                                                                                                                                                                    -
                                                                                                                                                                                    <?php
                                                                                                                                                                                    -
                                                                                                                                                                                    -class SomeClassTest extends \Codeception\TestCase\WPAjaxTestCase
                                                                                                                                                                                    -{
                                                                                                                                                                                    -    public function setUp()
                                                                                                                                                                                    -    {
                                                                                                                                                                                    -      parent::setUp();
                                                                                                                                                                                    -    }
                                                                                                                                                                                    -
                                                                                                                                                                                    -    public function tearDown()
                                                                                                                                                                                    -    {
                                                                                                                                                                                    -      parent::tearDown();
                                                                                                                                                                                    -    }
                                                                                                                                                                                    -
                                                                                                                                                                                    -    // tests
                                                                                                                                                                                    -    public function testMe()
                                                                                                                                                                                    -    {
                                                                                                                                                                                    -    }
                                                                                                                                                                                    -
                                                                                                                                                                                    -}
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    generate:wpxmlrpc

                                                                                                                                                                                    -

                                                                                                                                                                                    Generates a test case extending the \Codeception\TestCase\WPXMLRPCTestCase class using the

                                                                                                                                                                                    -
                                                                                                                                                                                      codecept generate:wpxmlrpc suite SomeClass
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    The command will generate a skeleton test case like

                                                                                                                                                                                    -
                                                                                                                                                                                    <?php
                                                                                                                                                                                    -
                                                                                                                                                                                    -class SomeClassTest extends \Codeception\TestCase\WPXMLRPCTestCase
                                                                                                                                                                                    -{
                                                                                                                                                                                    -    public function setUp()
                                                                                                                                                                                    -    {
                                                                                                                                                                                    -      parent::setUp();
                                                                                                                                                                                    -    }
                                                                                                                                                                                    -
                                                                                                                                                                                    -    public function tearDown()
                                                                                                                                                                                    -    {
                                                                                                                                                                                    -      parent::tearDown();
                                                                                                                                                                                    -    }
                                                                                                                                                                                    -
                                                                                                                                                                                    -    // tests
                                                                                                                                                                                    -    public function testMe()
                                                                                                                                                                                    -    {
                                                                                                                                                                                    -    }
                                                                                                                                                                                    -
                                                                                                                                                                                    -}
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    generate:wpcanonical

                                                                                                                                                                                    -

                                                                                                                                                                                    Generates a test case extending the \Codeception\TestCase\WPCanonicalTestCase class using the

                                                                                                                                                                                    -
                                                                                                                                                                                      codecept generate:wpcanonical suite SomeClass
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    The command will generate a skeleton test case like

                                                                                                                                                                                    -
                                                                                                                                                                                    <?php
                                                                                                                                                                                    -
                                                                                                                                                                                    -class SomeClassTest extends \Codeception\TestCase\WPCanonicalTestCase
                                                                                                                                                                                    -{
                                                                                                                                                                                    -    public function setUp()
                                                                                                                                                                                    -    {
                                                                                                                                                                                    -      parent::setUp();
                                                                                                                                                                                    -    }
                                                                                                                                                                                    -
                                                                                                                                                                                    -    public function tearDown()
                                                                                                                                                                                    -    {
                                                                                                                                                                                    -      parent::tearDown();
                                                                                                                                                                                    -    }
                                                                                                                                                                                    -
                                                                                                                                                                                    -    // tests
                                                                                                                                                                                    -    public function testMe()
                                                                                                                                                                                    -    {
                                                                                                                                                                                    -    }
                                                                                                                                                                                    -
                                                                                                                                                                                    -}
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - -
                                                                                                                                                                                    - -
                                                                                                                                                                                    - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - - - - - - - \ No newline at end of file diff --git a/docs/public/v3/configuration/index.html b/docs/public/v3/configuration/index.html deleted file mode 100644 index 8cbbc200f..000000000 --- a/docs/public/v3/configuration/index.html +++ /dev/null @@ -1,780 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - Configuration - wp-browser docs - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
                                                                                                                                                                                    - -
                                                                                                                                                                                    - - - - - - -
                                                                                                                                                                                    - - -
                                                                                                                                                                                    - -
                                                                                                                                                                                    - - - - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - - - - - -

                                                                                                                                                                                    Configuration

                                                                                                                                                                                    - -

                                                                                                                                                                                    Initializing wp-browser

                                                                                                                                                                                    -

                                                                                                                                                                                    While wp-browser can be configured manually creating each file the fastest way to bootstrap its configuration is by using its initialization template.

                                                                                                                                                                                    -

                                                                                                                                                                                    Throughout the steps below I will use the WordPress setup I've prepared before -From the root folder of the project, /Users/luca/Sites/wordpress/wp-content/plugins/acme-plugin in the example, run the command:

                                                                                                                                                                                    -
                                                                                                                                                                                    vendor/bin/codecept init wpbrowser
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Composer installed Codeception binary (codecept) in the vendor folder of my project.

                                                                                                                                                                                    -

                                                                                                                                                                                    With the command above I'm telling Codeception to initialize a wp-browser project in the current folder.
                                                                                                                                                                                    -When I click enter I'm presented with a list of questions, each answer will be used to configure the wp-browser project for me; one by one.

                                                                                                                                                                                    -

                                                                                                                                                                                    In the screenshot the answers I've provided to each question, with reference to the setup above:

                                                                                                                                                                                    -

                                                                                                                                                                                    codecept init wpbrowser 1

                                                                                                                                                                                    -

                                                                                                                                                                                    codecept init wpbrowser 2

                                                                                                                                                                                    -

                                                                                                                                                                                    wp-browser will try to provide a brief explanation of what each question is but below is the long version.

                                                                                                                                                                                    -

                                                                                                                                                                                    Long question explanation

                                                                                                                                                                                    -

                                                                                                                                                                                    I've tried to condense as much clarity as possible in the questions the codecept init wpbrowser command will ask but, for sake of brevity and space, there's no way I could provide inline a deeper explanation of each.

                                                                                                                                                                                    -

                                                                                                                                                                                    Below is a longer explanation of each question:

                                                                                                                                                                                    - -

                                                                                                                                                                                    How would you like the acceptance suite to be called?

                                                                                                                                                                                    -

                                                                                                                                                                                    With reference to the testing levels definition this question provides you with the possibility to change the name of the acceptance-like test suite.

                                                                                                                                                                                    -

                                                                                                                                                                                    Common, alternative, names are ui, rest and user.

                                                                                                                                                                                    -

                                                                                                                                                                                    How would you like the functional suite to be called?

                                                                                                                                                                                    -

                                                                                                                                                                                    With reference to the testing levels definition this question provides you with the possibility to change the name of the functional-like test suite.

                                                                                                                                                                                    -

                                                                                                                                                                                    A common alternative name is service.

                                                                                                                                                                                    -

                                                                                                                                                                                    How would you like the WordPress unit and integration suite to be called?

                                                                                                                                                                                    -

                                                                                                                                                                                    With reference to the testing levels definition this question provides you with the possibility to change the name of the suite dedicated to integration and "WordPress unit" tests.

                                                                                                                                                                                    -

                                                                                                                                                                                    A common alternative name is integration.

                                                                                                                                                                                    -

                                                                                                                                                                                    How would you like to call the env configuration file?

                                                                                                                                                                                    -

                                                                                                                                                                                    Instead of configuring each module in each suite with the same parameters over and over Codeception supports dynamic configuration via environment files.

                                                                                                                                                                                    -

                                                                                                                                                                                    wp-browser will scaffold such a configuration for you and will use, by default, a file called .env to store the configuration parameters.

                                                                                                                                                                                    -

                                                                                                                                                                                    The file name might not suit all setups especially and this question allows changing that file name; common, alternative, file names are .env.tests, .env.codeception and similar.

                                                                                                                                                                                    -

                                                                                                                                                                                    Where is WordPress installed?

                                                                                                                                                                                    -

                                                                                                                                                                                    During tests the test code will need to access WordPress code, precisely wp-browser requires being pointed to the folder that contains the wp-load.php file.

                                                                                                                                                                                    -

                                                                                                                                                                                    The answer can be an absolute path, like /Users/luca/Sites/wordrpress, or a path relative to the folder where Codeception is installed like vendor/wordpress.

                                                                                                                                                                                    -

                                                                                                                                                                                    This path should be accessible by the machine that is running the tests; if you're running the tests from your machine (e.g. your laptop) that's just the path to the folder where WordPress is installed, /Users/luca/Sites/wordpress in the example configuration above.

                                                                                                                                                                                    -

                                                                                                                                                                                    If you are, instead, running the tests from within a virtualized machine (e.g. Vagrant or Docker) then the path should be the one used by the virtualized machine.

                                                                                                                                                                                    -

                                                                                                                                                                                    To make an example:

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • on my machine WordPress is installed at /Users/luca/Sites/wordpress
                                                                                                                                                                                    • -
                                                                                                                                                                                    • I've created a Docker container using the official WordPress image and bound the above folder into the container
                                                                                                                                                                                    • -
                                                                                                                                                                                    • internally the container will put WordPress in the /var/www/html folder
                                                                                                                                                                                    • -
                                                                                                                                                                                    -

                                                                                                                                                                                    If I run the tests from my host machine then WordPress root directory will be /Users/luca/Sites/wordpress, if I run the tests from within the Docker container then WordPress root folder will be /var/www/html.

                                                                                                                                                                                    -

                                                                                                                                                                                    Another example is Local by Flywheel:

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • in the host machine the path to the WordPress root folder will be /Users/luca/Local\ Sites/wordpress/app/public
                                                                                                                                                                                    • -
                                                                                                                                                                                    • from within the Docker container managed by Local the path will be /app/public
                                                                                                                                                                                    • -
                                                                                                                                                                                    -

                                                                                                                                                                                    If you need a solution that will work in both instances use a relative path: wp-browser will accept paths like ./../../../wordpress and will attempt to resolve them.

                                                                                                                                                                                    -

                                                                                                                                                                                    What is the path, relative to WordPress root URL, of the admin area of the test site?

                                                                                                                                                                                    -

                                                                                                                                                                                    This is usually /wp-admin but you might have the web-server, or a plugin, redirect or hide requests for the administration area to another path.

                                                                                                                                                                                    -

                                                                                                                                                                                    Some examples are /admin, /login and the like.

                                                                                                                                                                                    -

                                                                                                                                                                                    Mind that this is not the path to the login page but the path to the administrationo area; this will be used by wp-browser to find to the administration area in acceptance and functional tests.

                                                                                                                                                                                    -

                                                                                                                                                                                    What is the name of the test database used by the test site?

                                                                                                                                                                                    -

                                                                                                                                                                                    In my example setup it's wordpress.

                                                                                                                                                                                    -

                                                                                                                                                                                    This is the name of the database that is storing the information used by the site I can reach at http://localhost:8080.

                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    I want to underline the word "test". Any site and any database you use and expose to wp-browser should be intended for tests; this means that it does not contain any data you care about as it will be lost.

                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    What is the host of the test database used by the test site?

                                                                                                                                                                                    -

                                                                                                                                                                                    In my example setup it's 127.0.0.1:3306.

                                                                                                                                                                                    -

                                                                                                                                                                                    Here the same principle valid for Where is WordPress installed? applies: the database host is relative to the machine that is running the tests.

                                                                                                                                                                                    -

                                                                                                                                                                                    In my example I'm hosting the database locally, on my laptop, and my machine can reach it at the localhost address (127.0.0.1) on MySQL default port (3306).

                                                                                                                                                                                    -

                                                                                                                                                                                    If I am using the database of a Local by Flywheel site from my host machine then it might be something like 192.168.92.100:4050 (from the site "Database" tab); the same principle applies if I am using a Vagrant-based or Docker-based solution.

                                                                                                                                                                                    -

                                                                                                                                                                                    If I am running the tests from within a virtualized machine (a Docker container, a Vagrant box et cetera) then it would probably be localhost or 1270.0.0.1.

                                                                                                                                                                                    -

                                                                                                                                                                                    This detail will be used in the context of acceptance and functional tests by the WPDb module.

                                                                                                                                                                                    -

                                                                                                                                                                                    What is the user of the test database used by the test site?

                                                                                                                                                                                    -

                                                                                                                                                                                    In my example setup it's root as I'm using MySQL server root user to access the database during tests.

                                                                                                                                                                                    -

                                                                                                                                                                                    Depending on your setup it might be different; since wp-browser will need to not only read but write too to the database make sure to use a user that has full access to the database specified in the answer to the What is the host of the test database used by the test site? question.

                                                                                                                                                                                    -

                                                                                                                                                                                    This detail will be used in the context of acceptance and functional tests by the WPDb module.

                                                                                                                                                                                    -

                                                                                                                                                                                    What is the password of the test database used by the test site?

                                                                                                                                                                                    -

                                                                                                                                                                                    In my example setup it's empty as I've not set any password for the root account.

                                                                                                                                                                                    -

                                                                                                                                                                                    In your case it might be different and it should be the password associated with the user specified in the answer to the What is the user of the test database used by the test site? question.

                                                                                                                                                                                    -

                                                                                                                                                                                    This detail will be used in the context of acceptance and functional tests by the WPDb module.

                                                                                                                                                                                    -

                                                                                                                                                                                    What is the table prefix of the test database used by the test site?

                                                                                                                                                                                    -

                                                                                                                                                                                    In my example setup it's wp_; that value is taken from the WordPress installation configuration file.

                                                                                                                                                                                    -

                                                                                                                                                                                    To have any influence on the site wp-browser will need to modify the same database tables WordPress is using; as I did you can take this value from the wp-config.php file directly: it's the value of the $table_prefix variable.

                                                                                                                                                                                    -

                                                                                                                                                                                    This detail will be used in the context of acceptance and functional tests by the WPDb module.

                                                                                                                                                                                    -

                                                                                                                                                                                    What is the name of the test database WPLoader should use?

                                                                                                                                                                                    -

                                                                                                                                                                                    In my example setup it's tests.

                                                                                                                                                                                    -

                                                                                                                                                                                    During integration, or WordPress "unit" tests, wp-loader will need to load WordPress code.

                                                                                                                                                                                    -

                                                                                                                                                                                    Since WordPress code is not meant to be "modular" it does not support auto-loading or loading just parts of it; it's either almost all or nothing.

                                                                                                                                                                                    -

                                                                                                                                                                                    One of the first things WordPress does, when loading, is trying to connect to a database: if that database is not available then WordPress will not load.

                                                                                                                                                                                    -

                                                                                                                                                                                    In the answer to the question Where is WordPress installed? I've told wp-browser where to find WordPress code, in this answer I'm telling wp-browser what database it should use to bootstrap WordPress.

                                                                                                                                                                                    -

                                                                                                                                                                                    This detail will be used by the WPLoader module to bootstrap WordPress. -It's highly recommended to use a different database from the one used for functional and acceptance tests.

                                                                                                                                                                                    -

                                                                                                                                                                                    What is the host of the test database WPLoader should use?

                                                                                                                                                                                    -

                                                                                                                                                                                    In my example setup it's 127.0.0.1:3306.

                                                                                                                                                                                    -

                                                                                                                                                                                    As in the answer to the question What is the name of the test database WPLoader should use? we're providing connection details about the database that should be used to bootstrap WordPress during integration and WordPress "unit" tests.

                                                                                                                                                                                    -

                                                                                                                                                                                    Again the database host is in relation to the machine running the tests, all the considerations done for What is the host of the test database used by the test site? apply.

                                                                                                                                                                                    -

                                                                                                                                                                                    This detail will be used by the WPLoader module to bootstrap WordPress.

                                                                                                                                                                                    -

                                                                                                                                                                                    What is the user of the test database WPLoader should use?

                                                                                                                                                                                    -

                                                                                                                                                                                    In my example it's root.

                                                                                                                                                                                    -

                                                                                                                                                                                    Similar to the question What is the user of the test database used by the test site? but in relation to the database specified in the question What is the name of the test database WPLoader should use?.

                                                                                                                                                                                    -

                                                                                                                                                                                    This detail will be used by the WPLoader module to bootstrap WordPress.

                                                                                                                                                                                    -

                                                                                                                                                                                    What is the password of the test database WPLoader should use?

                                                                                                                                                                                    -

                                                                                                                                                                                    In my example setup it's empty as I've not set any password for the root account.

                                                                                                                                                                                    -

                                                                                                                                                                                    Similar to the question What is the password of the test database used by the test site? but in relation to the database specified in the question What is the name of the test database WPLoader should use?.

                                                                                                                                                                                    -

                                                                                                                                                                                    This detail will be used by the WPLoader module to bootstrap WordPress.

                                                                                                                                                                                    -

                                                                                                                                                                                    What is the table prefix of the test database WPLoader should use?

                                                                                                                                                                                    -

                                                                                                                                                                                    In my example setup it's wp_.

                                                                                                                                                                                    -

                                                                                                                                                                                    Similar to the question What is the table prefix of the test database used by the test site? but in relation to the database specified in the question What is the name of the test database WPLoader should use?.

                                                                                                                                                                                    -

                                                                                                                                                                                    This detail will be used by the WPLoader module to bootstrap WordPress.

                                                                                                                                                                                    -

                                                                                                                                                                                    What is the URL the test site?

                                                                                                                                                                                    -

                                                                                                                                                                                    In my example setup it's http://localhost:8080.

                                                                                                                                                                                    -

                                                                                                                                                                                    This is the full URL you would have to enter in the browser, on the machine that is running the tests, to reach the test WordPress site homepage.

                                                                                                                                                                                    -

                                                                                                                                                                                    What is the email of the test site WordPress administrator?

                                                                                                                                                                                    -

                                                                                                                                                                                    In my example setup it's admin@wp.localhost.

                                                                                                                                                                                    -

                                                                                                                                                                                    This detail will be used by the WPLoader module to bootstrap WordPress and, while required, it's usually not relevant unless you're testing email communications.

                                                                                                                                                                                    -

                                                                                                                                                                                    What is the title of the test site?

                                                                                                                                                                                    -

                                                                                                                                                                                    In my example setup it's Acme Plugin Test Site.

                                                                                                                                                                                    -

                                                                                                                                                                                    This detail will be used by the WPLoader module to bootstrap WordPress and, while required, it's usually not relevant unless you're testing around the site title.

                                                                                                                                                                                    -

                                                                                                                                                                                    What is the login of the administrator user of the test site?

                                                                                                                                                                                    -

                                                                                                                                                                                    In my example setup it's admin.

                                                                                                                                                                                    -

                                                                                                                                                                                    This detail will be used by the WPBrowser or WPWebDriver modules to fill in the login details for the administrator user.

                                                                                                                                                                                    -

                                                                                                                                                                                    It should be the same as the one that allows you to access the site administration area in the WordPress test site, http://localhost:8080/wp-admin in my example.

                                                                                                                                                                                    -

                                                                                                                                                                                    What is the password of the administrator user of the test site?

                                                                                                                                                                                    -

                                                                                                                                                                                    In my example setup it's password.

                                                                                                                                                                                    -

                                                                                                                                                                                    This detail will be used by the WPBrowser or WPWebDriver modules to fill in the login details for the administrator user.

                                                                                                                                                                                    -

                                                                                                                                                                                    It should be the same as the one that allows you to access the site administration area in the WordPress test site, http://localhost:8080/wp-admin in my example.

                                                                                                                                                                                    -

                                                                                                                                                                                    Are you testing a plugin, a theme or a combination of both?

                                                                                                                                                                                    -

                                                                                                                                                                                    Depending on the answer the WPLoader module will load, during integration or WordPress "unit" tests, your WordPress plugin or theme.

                                                                                                                                                                                    -

                                                                                                                                                                                    If you replied with both (for "a combination of both") then you'll be able to choose the plugins and theme to load in integration and WordPress "unit" tests in the following questions.

                                                                                                                                                                                    -

                                                                                                                                                                                    What is the folder/plugin.php name of the plugin?

                                                                                                                                                                                    -

                                                                                                                                                                                    This question will be asked only if you replied plugin to the question Are you testing a plugin, a theme or a combination of both?.
                                                                                                                                                                                    -In my example setup it's acme-plugin/plugin.php.

                                                                                                                                                                                    -

                                                                                                                                                                                    This is the <folder>/<main-plugin-file>.php path, relative to the WordPress installation plugins folder, to the plugin you are testing.

                                                                                                                                                                                    -

                                                                                                                                                                                    The main plugin file is the one that contains the plugin header.

                                                                                                                                                                                    -

                                                                                                                                                                                    This detail will be used by the WPLoader module to bootstrap WordPress and load your plugin or theme in integration and WordPress "unit" tests.

                                                                                                                                                                                    -

                                                                                                                                                                                    Are you developing a child theme?

                                                                                                                                                                                    -

                                                                                                                                                                                    This question will be asked only if you replied theme to the question Are you testing a plugin, a theme or a combination of both?.
                                                                                                                                                                                    -Enter yes if you are developing a child theme.

                                                                                                                                                                                    -

                                                                                                                                                                                    This detail will be used by the WPLoader module to bootstrap WordPress and load a parent theme along with your theme in integration and WordPress "unit" tests.

                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Please note that wp-browser will not download and install the parent theme in the WordPress installation for you.

                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Are you using a child theme?

                                                                                                                                                                                    -

                                                                                                                                                                                    This question will be asked only if you replied both to the question Are you testing a plugin, a theme or a combination of both?.
                                                                                                                                                                                    -Enter yes if you are using a child theme.

                                                                                                                                                                                    -

                                                                                                                                                                                    This detail will be used by the WPLoader module to bootstrap WordPress and load a parent theme along with your theme in integration and WordPress "unit" tests.

                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Please note that wp-browser will not download and install the parent theme in the WordPress installation for you.

                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    What is the slug of the parent theme?

                                                                                                                                                                                    -

                                                                                                                                                                                    This question will be asked only if you replied yes to the question Are you developing a child theme?.

                                                                                                                                                                                    -

                                                                                                                                                                                    Reply with the slug of the parent theme, that's usually the name of the folder the parent theme lives in, e.g. twentyseventeen.

                                                                                                                                                                                    -

                                                                                                                                                                                    This detail will be used by the WPLoader module to bootstrap WordPress and load a parent theme along with your theme in integration and WordPress "unit" tests.

                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Please note that wp-browser will not download and install the parent theme in the WordPress installation for you.

                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    What is the slug of the theme?

                                                                                                                                                                                    -

                                                                                                                                                                                    This question will be asked only if you replied theme to the question Are you testing a plugin, a theme or a combination of both?.
                                                                                                                                                                                    -Reply with the slug of the theme, that's usually the name of the folder the theme lives in, e.g. twentyseventeen.

                                                                                                                                                                                    -

                                                                                                                                                                                    This detail will be used by the WPLoader module to bootstrap WordPress and load your theme in integration and WordPress "unit" tests.

                                                                                                                                                                                    -

                                                                                                                                                                                    What is the slug of the theme you are using?

                                                                                                                                                                                    -

                                                                                                                                                                                    This question will be asked only if you replied both to the question Are you testing a plugin, a theme or a combination of both?.
                                                                                                                                                                                    -Reply with the slug of the theme you are using, that's usually the name of the folder the theme lives in, e.g. twentyseventeen.

                                                                                                                                                                                    -

                                                                                                                                                                                    This detail will be used by the WPLoader module to bootstrap WordPress and load the theme integration and WordPress "unit" tests.

                                                                                                                                                                                    -

                                                                                                                                                                                    Does your project needs additional plugins to be activated to work?

                                                                                                                                                                                    -

                                                                                                                                                                                    Whether you're testing a plugin, a theme or a combination of both you might need some additional plugins to run your tests.

                                                                                                                                                                                    -

                                                                                                                                                                                    As an example if I'm testing a WooCommerce extension I need the WooCommerce plugin to test it; this is the place where I can define it.

                                                                                                                                                                                    -

                                                                                                                                                                                    The required plugins follow the same format as the one used in the question What is the folder/plugin.php name of the plugin?: <plugin-folder>/<plugin-main-file>.php; in the case of WooCommerce it would be woocommerce/woocommerce.php.

                                                                                                                                                                                    -

                                                                                                                                                                                    This detail will be used by the WPLoader module to bootstrap WordPress and load the required plugins in integration and WordPress "unit" tests.

                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Please note that wp-browser will not download and install the required plugins in the WordPress installation for you.

                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    If you entered a wrong value

                                                                                                                                                                                    -

                                                                                                                                                                                    No worries, just correct the value in the environment file or in the suites configuration files.

                                                                                                                                                                                    -

                                                                                                                                                                                    The environment file will have the name you specified in the answer the question How would you like to call the env configuration file?.

                                                                                                                                                                                    -

                                                                                                                                                                                    The suites configuration files can be found in tests/<suite>.suite.yml; e.g. the wpunit suite configuration file will be tests/wpunit.suite.yml file.

                                                                                                                                                                                    -

                                                                                                                                                                                    Final steps

                                                                                                                                                                                    -

                                                                                                                                                                                    To complete the setup I have removed any demo content from the site and activated my plugin in the plugins administration page.

                                                                                                                                                                                    -

                                                                                                                                                                                    In the tests/acceptance.suite.yml file and in the tests/functional.suite.yml file, the configuration file for the acceptance and functional suites respectively, the WPDb module configuration contains a dump configuration parameter:

                                                                                                                                                                                    -
                                                                                                                                                                                    class_name: AcceptanceTester
                                                                                                                                                                                    -modules:
                                                                                                                                                                                    -    enabled:
                                                                                                                                                                                    -        - WPDb
                                                                                                                                                                                    -    config:
                                                                                                                                                                                    -        WPDb:
                                                                                                                                                                                    -            dump: 'tests/_data/dump.sql'
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    The dump parameter is inherited by the WPDb module from the Codeception Db module and defines the SQL dump file that should be loaded before, and between, tests to reset the testing environment to a base known state.

                                                                                                                                                                                    -

                                                                                                                                                                                    As for any other database-related operation wp-browser will not create the dump for me. -I use MySQL binary to export the database state (a dump) with the command:

                                                                                                                                                                                    -
                                                                                                                                                                                    mysqldump -u root -h 127.0.0.1 -P 3306 wordpress > /Users/luca/Sites/wordpress/wp-content/plugins/acme-plugin/tests/_data/dump.sql
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    I could use any other combination of tools to produce the dump; using mysql binary is not a requirement.

                                                                                                                                                                                    -

                                                                                                                                                                                    Graphic interfaces like SequelPro, Adminer and the like would be perfectly fine.

                                                                                                                                                                                    -

                                                                                                                                                                                    Pre-flight check

                                                                                                                                                                                    -

                                                                                                                                                                                    There is one last check I need to make before jumping into the creation of tests: making sure all the paths and credentials I've configured wp-browser with are correct.

                                                                                                                                                                                    -

                                                                                                                                                                                    The bootstrap process generated four suites for me: acceptance, functional, integration and unit. If you have modified the default suite names during the setup your suites names might differ though.

                                                                                                                                                                                    -

                                                                                                                                                                                    To test the setup I will run each suite and make sure it can run correctly empty of any test. To run a suite of tests I will use the codecept run command:

                                                                                                                                                                                    -
                                                                                                                                                                                    codecept run acceptance
                                                                                                                                                                                    -codecept run functional
                                                                                                                                                                                    -codecept run integration
                                                                                                                                                                                    -codecept run unit
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    How comes I'm not using the command codecept run (without specifying the suite names)? See the FAQ entry.

                                                                                                                                                                                    -

                                                                                                                                                                                    Pre-flight check

                                                                                                                                                                                    -

                                                                                                                                                                                    If you cannot run all the suites without issues then check your configuration settings again, read the errors and see If you entered a wrong value

                                                                                                                                                                                    - - - - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - -
                                                                                                                                                                                    - -
                                                                                                                                                                                    - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - - - - - - - \ No newline at end of file diff --git a/docs/public/v3/contributing/index.html b/docs/public/v3/contributing/index.html deleted file mode 100644 index 946728f1b..000000000 --- a/docs/public/v3/contributing/index.html +++ /dev/null @@ -1,380 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - Contributing to wp-browser - wp-browser docs - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
                                                                                                                                                                                    - -
                                                                                                                                                                                    - - - - - - -
                                                                                                                                                                                    - - -
                                                                                                                                                                                    - -
                                                                                                                                                                                    - - - - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - - - - - -

                                                                                                                                                                                    Contributing to wp-browser

                                                                                                                                                                                    -

                                                                                                                                                                                    There are many ways you can contribute to the project and most of them do not involve having an intimate knowledge of - Codeception or wp-browser internals.

                                                                                                                                                                                    -

                                                                                                                                                                                    Reporting an issue

                                                                                                                                                                                    -

                                                                                                                                                                                    It can be done from here.

                                                                                                                                                                                    -

                                                                                                                                                                                    Whenever you find yourself struggling with something, anything, while using wp-browser, please report an issue.

                                                                                                                                                                                    -

                                                                                                                                                                                    If your issue is not a real issue it will be quickly closed but still provide two values:

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    1. it will remain in the repository issues archive making it searchable for any other user having the same, or similar, issue
                                                                                                                                                                                    2. -
                                                                                                                                                                                    3. it might shine a light on missing documentation, API or clarity in general. - Take the time to fill in the issue template provided and provide as many details as you can.
                                                                                                                                                                                    4. -
                                                                                                                                                                                    -

                                                                                                                                                                                    Reporting a bug

                                                                                                                                                                                    -

                                                                                                                                                                                    The project pulls a number of components together and will have bugs.
                                                                                                                                                                                    -If you run into one of them then provide as much detail as possible when opening the issue.
                                                                                                                                                                                    -Beside what the issue template will ask feel free to provide as much additional detail as you can.

                                                                                                                                                                                    -

                                                                                                                                                                                    Requesting documentation

                                                                                                                                                                                    -

                                                                                                                                                                                    If you feel the documentation is lacking or missing something entirely please -report it. No documentation can possibly cover any case ever but there's a good chance you're not alone with the feeling that something is amiss.

                                                                                                                                                                                    -

                                                                                                                                                                                    Requesting new features

                                                                                                                                                                                    -

                                                                                                                                                                                    I've not used all the tools, environments and possible setups wp-browser could cover.

                                                                                                                                                                                    -

                                                                                                                                                                                    If you feel wp-browser is missing a feature open an issue and try to provide as many details as possible:

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • What problem would the new feature solve?
                                                                                                                                                                                    • -
                                                                                                                                                                                    • Is it possible to do what you would like the new feature to do with the existing API?
                                                                                                                                                                                    • -
                                                                                                                                                                                    • Could you provide an example of the API/configuration you would like to be able to use? - A new feature can be as small as a new module method or as large as a new module entirely: do not be afraid to ask.
                                                                                                                                                                                    • -
                                                                                                                                                                                    -

                                                                                                                                                                                    Pull requests

                                                                                                                                                                                    -

                                                                                                                                                                                    If you encounter any of the issues above and have a proposed fix for it then open a pull request alongside an issue.

                                                                                                                                                                                    -

                                                                                                                                                                                    Any pull-request has to pass tests before being merged and I might add code to your pull request to add tests or - update them; I will work with you on the pull request if required.

                                                                                                                                                                                    -

                                                                                                                                                                                    Just know it's really appreciated.

                                                                                                                                                                                    - - - - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - -
                                                                                                                                                                                    - -
                                                                                                                                                                                    - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - - - - - - - \ No newline at end of file diff --git a/docs/public/v3/events-api/index.html b/docs/public/v3/events-api/index.html deleted file mode 100644 index c13bae0bc..000000000 --- a/docs/public/v3/events-api/index.html +++ /dev/null @@ -1,391 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - Events api - wp-browser docs - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
                                                                                                                                                                                    - -
                                                                                                                                                                                    - - - - - - -
                                                                                                                                                                                    - - -
                                                                                                                                                                                    - -
                                                                                                                                                                                    - - - - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - - - - - -

                                                                                                                                                                                    Events api

                                                                                                                                                                                    - -

                                                                                                                                                                                    Events API

                                                                                                                                                                                    -

                                                                                                                                                                                    Codeception comes with a set of events modules and extensions can subscribe to.

                                                                                                                                                                                    -

                                                                                                                                                                                    Codeception Events API is, but, only available to Modules and Extensions, and while that might be good for most cases, it might not cover a number of edge cases.

                                                                                                                                                                                    -

                                                                                                                                                                                    Similarly to WordPress add_action function, wp-browser provides the tad\WPBrowser\addListener function:

                                                                                                                                                                                    -
                                                                                                                                                                                    function addListener($eventName, callable $listener, $priority = 0);
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    The priority works the reverse way as it does in WordPress: highest number will be processed first!

                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Again similarly to WordPress do_action function, the tad\WPBrowser\dispatch function:

                                                                                                                                                                                    -
                                                                                                                                                                                    function dispatch($eventName, $origin = null, array $context = []);
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    This is the kind of API that is better shown with an example, though.

                                                                                                                                                                                    -

                                                                                                                                                                                    Example

                                                                                                                                                                                    -

                                                                                                                                                                                    In this example I'm writing acceptance tests and would like to avoid the performance hit that the cleanup configuration parameter of the Db, or WPDb, module implies.
                                                                                                                                                                                    -The cleanup parameter will trigger the drop of all tables in the test database and the re-import of the SQL dump file, or files, between each test.
                                                                                                                                                                                    -This will ensure a clean starting fixture between tests, but for larger setup fixtures this might be a long operation that wastes precious seconds when, say, the only change is the addition of 3 posts, as in this example.

                                                                                                                                                                                    -

                                                                                                                                                                                    The Events API allows implementing a tailored clean-up procedure that can avoid costly clean ups between tests.

                                                                                                                                                                                    -

                                                                                                                                                                                    In the suite bootstrap file, e.g. tests/acceptance/_bootstrap.php, I add a listener on the my-plugin-test/setup-posts event.
                                                                                                                                                                                    -The event will contain information about what post IDs I've set up in the tests and will provide an instance of the tester object to handle database manipulation.
                                                                                                                                                                                    -With that information, the costly cleanup procedure can be avoided.

                                                                                                                                                                                    -
                                                                                                                                                                                    <?php
                                                                                                                                                                                    -
                                                                                                                                                                                    -$registerPostsCleanup = static function (tad\WPBrowser\Events\WpbrowserEvent $event) {
                                                                                                                                                                                    -    $ids = $event->get('ids', []);
                                                                                                                                                                                    -    /** @var \EventsTester $db */
                                                                                                                                                                                    -    $db = $event->get('db');
                                                                                                                                                                                    -
                                                                                                                                                                                    -    // When tests are done, then remove all the posts we've created at the start of the test, if any.
                                                                                                                                                                                    -    tad\WPBrowser\addListener(
                                                                                                                                                                                    -        Codeception\Events::TEST_AFTER,
                                                                                                                                                                                    -        static function () use ($ids, $db) {
                                                                                                                                                                                    -            foreach ($ids as $id) {
                                                                                                                                                                                    -                $db->dontHavePostInDatabase([ 'ID' => $id ], true);
                                                                                                                                                                                    -                // Ensure the clean up did happen correctly.
                                                                                                                                                                                    -                $db->dontSeePostInDatabase([ 'ID' => $id ]);
                                                                                                                                                                                    -                $db->dontSeePostMetaInDatabase([ 'post_id' => $id ]);
                                                                                                                                                                                    -            }
                                                                                                                                                                                    -        }
                                                                                                                                                                                    -    );
                                                                                                                                                                                    -};
                                                                                                                                                                                    -
                                                                                                                                                                                    -// Listen for this event to register the posts to remove, along with their custom fields, after the test.
                                                                                                                                                                                    -tad\WPBrowser\addListener('test-event-1/setup-posts', $registerPostsCleanup);
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    In this simple test I'm adding 3 posts [using the factory provided by the WPLoader module in loadOnly mode][2] and want to make sure those, and the relative meta, are removed at the end of the tests. -The WPDb module, extending the Db module from Codeception, will remove the inserted rows, but will not take care of modified rows, or rows not inserted by the WPDb module.

                                                                                                                                                                                    -

                                                                                                                                                                                    Mirroring the requirement of the clean up function I've defined above, I'm passing the post IDs of the posts I've created and the current tester to provide the clean up function with database handling capabilities.

                                                                                                                                                                                    -
                                                                                                                                                                                    <?php
                                                                                                                                                                                    -/** @var Codeception\Scenario $scenario */
                                                                                                                                                                                    -$I = new AcceptanceTester($scenario);
                                                                                                                                                                                    -$I->wantTo('add posts and clean them up using the Events API');
                                                                                                                                                                                    -
                                                                                                                                                                                    -/*
                                                                                                                                                                                    - * Use WordPress methods, thanks to the `WPLoader` module, to use WordPress, or our own, API to insert posts.
                                                                                                                                                                                    - * This will prevent, but, `WPDb` from removing the inserted rows and clean up, so we remove the posts and meta
                                                                                                                                                                                    - * with an event and our custom clean-up function.
                                                                                                                                                                                    - */
                                                                                                                                                                                    -$ids = $I->factory()->post->create_many(3, [ 'post_type' => 'some_post_type' ]);
                                                                                                                                                                                    -
                                                                                                                                                                                    -tad\WPBrowser\dispatch('test-event-1/setup-posts', __FILE__, [
                                                                                                                                                                                    -    'ids' => $ids,
                                                                                                                                                                                    -    'db'  => $I
                                                                                                                                                                                    -]);
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - -
                                                                                                                                                                                    - -
                                                                                                                                                                                    - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - - - - - - - \ No newline at end of file diff --git a/docs/public/v3/extensions/index.html b/docs/public/v3/extensions/index.html deleted file mode 100644 index dc0df9b85..000000000 --- a/docs/public/v3/extensions/index.html +++ /dev/null @@ -1,474 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - Extensions - wp-browser docs - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
                                                                                                                                                                                    - -
                                                                                                                                                                                    - - - - - - -
                                                                                                                                                                                    - - -
                                                                                                                                                                                    - -
                                                                                                                                                                                    - - - - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - - - - - -

                                                                                                                                                                                    Extensions

                                                                                                                                                                                    -

                                                                                                                                                                                    The Codeception testing framework can be extended in a number of ways.

                                                                                                                                                                                    -

                                                                                                                                                                                    The one this project leverages the most are modules but [extensions are another way].

                                                                                                                                                                                    -

                                                                                                                                                                                    Modules extend the functionality of Codeception in the context of the tests, while extensions extend its interaction capacities; this is by no means a strict rule but that's usually the case.

                                                                                                                                                                                    -

                                                                                                                                                                                    The package contains two additional extensions to facilitate testers' life.

                                                                                                                                                                                    -

                                                                                                                                                                                    Symlinker

                                                                                                                                                                                    -

                                                                                                                                                                                    The tad\WPBrowser\Extension\Symlinker extension provides an automation to have the Codeception root directory symbolically linked in a WordPress local installation.

                                                                                                                                                                                    -

                                                                                                                                                                                    Since version 3.9 WordPress supports this feature (with some precautions) and the extension takes charge of:

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • symbolically linking a plugin or theme folder in the specified destination before any suite boots up
                                                                                                                                                                                    • -
                                                                                                                                                                                    • unlinking that symbolic link after all of the suites did run
                                                                                                                                                                                    • -
                                                                                                                                                                                    -

                                                                                                                                                                                    It's the equivalent of doing something like this from the command line (on a Mac):

                                                                                                                                                                                    -
                                                                                                                                                                                    ln -s /my/central/plugin/folder/my-plugin /my/local/wordpress/installation/wp-content/plugins/my-plugin
                                                                                                                                                                                    -/my/central/plugin/folder/my-plugin/vendor/bin/codecept run
                                                                                                                                                                                    -rm -rf /my/local/wordpress/installation/wp-content/plugins/my-plugin
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    The extension needs small configuration in the codeception.yml file:

                                                                                                                                                                                    -
                                                                                                                                                                                    extensions:
                                                                                                                                                                                    -    enabled:
                                                                                                                                                                                    -        - tad\WPBrowser\Extension\Symlinker
                                                                                                                                                                                    -    config:
                                                                                                                                                                                    -        tad\WPBrowser\Extension\Symlinker:
                                                                                                                                                                                    -            mode: plugin
                                                                                                                                                                                    -            destination: /my/local/wordpress/installation/wp-content/plugins
                                                                                                                                                                                    -            rootFolder: /some/plugin/folder
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    The arguments are:

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • mode - can be plugin or theme and indicates whether the current Codeception root folder being symlinked is a plugin or a theme one
                                                                                                                                                                                    • -
                                                                                                                                                                                    • destination - the absolute path to the WordPress local installation plugins or themes folder; to take the never ending variety of possible setups into account the extension will make no checks on the nature of the destination: could be any folder.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • rootFolder - optional absolute path to the WordPress plugin or theme to be symlinked root folder; will default to the Codeception root folder
                                                                                                                                                                                    • -
                                                                                                                                                                                    -

                                                                                                                                                                                    Copier

                                                                                                                                                                                    -

                                                                                                                                                                                    The tad\WPBrowser\Extension\Copier extension provides an automation to have specific files and folders copied to specified destination files and folders before the suites run.

                                                                                                                                                                                    -

                                                                                                                                                                                    While WordPress handles symbolic linking pretty well there are some cases, like themes and drop-ins, where there is a need for "real" files to be put in place.

                                                                                                                                                                                    -

                                                                                                                                                                                    One of such cases is, currently, one where Docker is used to to host and serve the code under test: symbolically linked files cannot be bound inside a container and Docker containers will fail to start in this case.

                                                                                                                                                                                    -

                                                                                                                                                                                    The extension follows the standard Codeception extension activation and has one configuration parameter only:

                                                                                                                                                                                    -
                                                                                                                                                                                    extensions:
                                                                                                                                                                                    -    enabled:
                                                                                                                                                                                    -        - tad\WPBrowser\Extension\Copier
                                                                                                                                                                                    -    config:
                                                                                                                                                                                    -        tad\WPBrowser\Extension\Copier:
                                                                                                                                                                                    -            files:
                                                                                                                                                                                    -                tests/_data/required-drop-in.php: /var/www/wordpress/wp-content/drop-in.php
                                                                                                                                                                                    -                tests/_data/themes/dummy: /var/www/wordpress/wp-content/themes/dummy
                                                                                                                                                                                    -                /Users/Me/Repos/required-plugin: /var/www/wordpress/wp-content/plugins/required-plugin.php
                                                                                                                                                                                    -                /Users/Me/Repos/mu-plugin.php: ../../../../wp-content/mu-plugins/mu-plugin.php
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    The extension will handle absolute and relative paths for sources and destinations and will resolve relative paths from the project root folder.

                                                                                                                                                                                    -

                                                                                                                                                                                    When copying directories the extension will only create the destination folder and not the folder tree required; in the example configuration above the last entry specifies that a mu-plugin.php file should be copied to the mu-plugins folder: that mu-plugins folder must be there already.

                                                                                                                                                                                    -

                                                                                                                                                                                    Environments support

                                                                                                                                                                                    -

                                                                                                                                                                                    Being able to symlink a plugin or theme folder into a WordPress installation for testing purposes could make sense when trying to test, as an example, a plugin in a single site and in multi site environment.

                                                                                                                                                                                    -

                                                                                                                                                                                    Codeception supports environments and the extension does as well specifying a destination for each.

                                                                                                                                                                                    -

                                                                                                                                                                                    As an example the acceptance.suite.yml file might be configured to support single and multisite environments:

                                                                                                                                                                                    -
                                                                                                                                                                                    env:
                                                                                                                                                                                    -    single:
                                                                                                                                                                                    -        modules:
                                                                                                                                                                                    -            config:
                                                                                                                                                                                    -                WPBrowser:
                                                                                                                                                                                    -                    url: 'http://wp.dev'
                                                                                                                                                                                    -                WPDb:
                                                                                                                                                                                    -                    dsn: 'mysql:host=127.0.0.1;dbname=wp'
                                                                                                                                                                                    -    multisite:
                                                                                                                                                                                    -        modules:
                                                                                                                                                                                    -            config:
                                                                                                                                                                                    -                WPBrowser:
                                                                                                                                                                                    -                    url: 'http://mu.dev'
                                                                                                                                                                                    -                WPDb:
                                                                                                                                                                                    -                    dsn: 'mysql:host=127.0.0.1;dbname=mu'
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    In the codeception.yml file specifying a destination for each supported environment will tell the extension to symbolically link the plugin or theme file to different locations according to the current environment:

                                                                                                                                                                                    -
                                                                                                                                                                                    extensions:
                                                                                                                                                                                    -    enabled:
                                                                                                                                                                                    -        - tad\WPBrowser\Extension\Symlinker
                                                                                                                                                                                    -    config:
                                                                                                                                                                                    -        tad\WPBrowser\Extension\Symlinker:
                                                                                                                                                                                    -            mode: plugin
                                                                                                                                                                                    -            destination:
                                                                                                                                                                                    -                single: /var/www/wp/wp-content/plugins
                                                                                                                                                                                    -                multisite: /var/www/mu/wp-content/plugins
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    If no destination is specified for the current environment the extension will fallback to the first specified one.

                                                                                                                                                                                    -

                                                                                                                                                                                    A default destination can be specified to override this behaviour.

                                                                                                                                                                                    -
                                                                                                                                                                                    extensions:
                                                                                                                                                                                    -    enabled:
                                                                                                                                                                                    -        - tad\WPBrowser\Extension\Symlinker
                                                                                                                                                                                    -    config:
                                                                                                                                                                                    -        tad\WPBrowser\Extension\Symlinker:
                                                                                                                                                                                    -            mode: plugin
                                                                                                                                                                                    -            destination:
                                                                                                                                                                                    -                default: /var/www/default/wp-content/plugins
                                                                                                                                                                                    -                single: /var/www/wp/wp-content/plugins
                                                                                                                                                                                    -                multisite: /var/www/mu/wp-content/plugins
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    When running a suite specifying more than one environment like

                                                                                                                                                                                    -
                                                                                                                                                                                    codecept run acceptance --env foo,baz,multisite
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Then the extension will use the first matched one, in the case above the multisite destination will be used.

                                                                                                                                                                                    -

                                                                                                                                                                                    The rootFolder parameter too can be set to be environment-aware and it will follow the same logic as the destination:

                                                                                                                                                                                    -
                                                                                                                                                                                    extensions:
                                                                                                                                                                                    -    enabled:
                                                                                                                                                                                    -        - tad\WPBrowser\Extension\Symlinker
                                                                                                                                                                                    -    config:
                                                                                                                                                                                    -        tad\WPBrowser\Extension\Symlinker:
                                                                                                                                                                                    -            mode: plugin
                                                                                                                                                                                    -            rootFolder:
                                                                                                                                                                                    -                dev: /
                                                                                                                                                                                    -                dist: /dist
                                                                                                                                                                                    -                default: /
                                                                                                                                                                                    -            destination:
                                                                                                                                                                                    -                default: /var/www/dev/wp-content/plugins
                                                                                                                                                                                    -                dev: /var/www/dev/wp-content/plugins
                                                                                                                                                                                    -                dist: /var/www/dist/wp-content/plugins
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    When running a suite specifying more than one environment like

                                                                                                                                                                                    -
                                                                                                                                                                                    codecept run acceptance --env dist
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Then the extension will symlink the files from /dist into the /var/www/dist/wp-content/plugins folder.

                                                                                                                                                                                    -

                                                                                                                                                                                    Events

                                                                                                                                                                                    -

                                                                                                                                                                                    Due to some internal changes in Codeception 4.0, the internal API (really a collection of low-level hacks on my part) that allowed wp-browser to dispatch, and listen for, events in the modules has been removed.

                                                                                                                                                                                    -

                                                                                                                                                                                    If you want to leverage [the event system wp-browser provides] with Codeception default events (e.g. suite.init or test.before), then you will need to use this extension.

                                                                                                                                                                                    -

                                                                                                                                                                                    You will not need this extension if you're not using Codeception version 4.0.

                                                                                                                                                                                    -

                                                                                                                                                                                    You will need to enable it in your Codeception main configuration file (e.g. codeception.dist.yml).

                                                                                                                                                                                    -
                                                                                                                                                                                    extensions:
                                                                                                                                                                                    -    enabled:
                                                                                                                                                                                    -        - tad\WPBrowser\Extension\Events
                                                                                                                                                                                    -    config:
                                                                                                                                                                                    -      tad\WPBrowser\Extension\Events:
                                                                                                                                                                                    -        suites: ['acceptance']
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    The extension only configuration is the suites parameter that allows specifying the suites the extension should apply to.
                                                                                                                                                                                    -If the suites parameter is not specified, then the extension will apply to all suites.

                                                                                                                                                                                    - - - - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - -
                                                                                                                                                                                    - -
                                                                                                                                                                                    - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - - - - - - - \ No newline at end of file diff --git a/docs/public/v3/faq/index.html b/docs/public/v3/faq/index.html deleted file mode 100644 index eace8d08e..000000000 --- a/docs/public/v3/faq/index.html +++ /dev/null @@ -1,476 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - Faq - wp-browser docs - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
                                                                                                                                                                                    - -
                                                                                                                                                                                    - - - - - - -
                                                                                                                                                                                    - - -
                                                                                                                                                                                    - -
                                                                                                                                                                                    - - - - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - - - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - - - - - -

                                                                                                                                                                                    Faq

                                                                                                                                                                                    - -

                                                                                                                                                                                    Some common questions

                                                                                                                                                                                    -

                                                                                                                                                                                    There are questions I keep receiving via email, GitHub or in person at conferences.

                                                                                                                                                                                    -

                                                                                                                                                                                    I tried to address some of them here.

                                                                                                                                                                                    -

                                                                                                                                                                                    Is Codeception/wp-browser PHP 5.2 compatible?

                                                                                                                                                                                    -

                                                                                                                                                                                    No, Codeception, and wp-browser by extension, will require PHP 5.6 minimum.

                                                                                                                                                                                    -

                                                                                                                                                                                    This does not mean your code cannot be PHP 5.2 compatible: you can test your code using all the possibilities of newer PHP versions and still keep it PHP 5.2 compatible.

                                                                                                                                                                                    -

                                                                                                                                                                                    Just because you can doesn't mean you should though: this documentation will assume a minimum PHP version, for the example and test code, of PHP 5.6.

                                                                                                                                                                                    -

                                                                                                                                                                                    Can I run unit tests with wp-browser/Codeception?

                                                                                                                                                                                    -

                                                                                                                                                                                    Yes, with some distinctions.

                                                                                                                                                                                    -

                                                                                                                                                                                    In the WordPress ecosystem there's a tendency to call any kind of test a "unit test". Under that definition will fall tests that are not "unit" tests at all.

                                                                                                                                                                                    -

                                                                                                                                                                                    Without drowning into a long and painful battle for definitions this guide will use the following definitions for different levels of testing.

                                                                                                                                                                                    -

                                                                                                                                                                                    The next section will detail the conventions this documentation uses to define different levels of testing in more detail.

                                                                                                                                                                                    -

                                                                                                                                                                                    Isn't WordPress untestable?

                                                                                                                                                                                    -

                                                                                                                                                                                    No; it's sometimes difficult to test and not as straightforward as other PHP frameworks but it's definitely not untestable.

                                                                                                                                                                                    -

                                                                                                                                                                                    You are writing code that runs on WordPress, not the Core code for WordPress so the question should really be: will you write testable code?

                                                                                                                                                                                    -

                                                                                                                                                                                    It's up to you to decide at what level you want to make your code testable and how much you want to test it.

                                                                                                                                                                                    -

                                                                                                                                                                                    Do I need to use a specific local development environment to use wp-browser?

                                                                                                                                                                                    -

                                                                                                                                                                                    No. I've started using wp-browser on a vanilla PHP built-in server to, then, move to MAMP (or XAMP) and, from there, to other solutions.

                                                                                                                                                                                    -

                                                                                                                                                                                    I've configured and used wp-browser on Docker, Vagrant, VVV, Valet and various CI solutions.

                                                                                                                                                                                    -

                                                                                                                                                                                    To this day I keep using different setups on different machines and personally prefer Docker for its portability.

                                                                                                                                                                                    -

                                                                                                                                                                                    Can I only test plugins with wp-browser?

                                                                                                                                                                                    -

                                                                                                                                                                                    No, you can test any kind of WordPress application.

                                                                                                                                                                                    -

                                                                                                                                                                                    With "application" I mean any PHP software built on top of WordPress: plugins, themes, whole sites.

                                                                                                                                                                                    -

                                                                                                                                                                                    If I'm testing a site do I have to use the default WordPress file structure?

                                                                                                                                                                                    -

                                                                                                                                                                                    No, you can use any file structure you want.

                                                                                                                                                                                    -

                                                                                                                                                                                    Some wp-browser modules will need a little help to find your code but, so far, I've never been unable to set it up.

                                                                                                                                                                                    -

                                                                                                                                                                                    Can I use wp-browser even if my WordPress application doesn't use Composer?

                                                                                                                                                                                    -

                                                                                                                                                                                    Yes, although wp-browser, as a development tool, cannot be installed without Composer.

                                                                                                                                                                                    -

                                                                                                                                                                                    Should I use wp-browser to test my production servers?

                                                                                                                                                                                    -

                                                                                                                                                                                    No. Unless you know very well what you're doing that's a dangerous idea that might leave you with a broken site and an empty database.

                                                                                                                                                                                    -

                                                                                                                                                                                    As almost any testing tool, wp-browser should be used locally on local installations of WordPress that do not contain any valuable information.

                                                                                                                                                                                    -

                                                                                                                                                                                    How can I avoid the WPDb module from replacing the contents of my database?

                                                                                                                                                                                    -

                                                                                                                                                                                    You should always backup any database that contains any information you care about before running any test.

                                                                                                                                                                                    -

                                                                                                                                                                                    You can read the answer to this question in the WPDb module documentation.

                                                                                                                                                                                    -

                                                                                                                                                                                    Can I run all my tests with one command?

                                                                                                                                                                                    -

                                                                                                                                                                                    Theoretically: yes, in practice: no.

                                                                                                                                                                                    -

                                                                                                                                                                                    When you use codecept run Codeception will run all the tests from all the suites.

                                                                                                                                                                                    -

                                                                                                                                                                                    This, done in the context of other frameworks, will generally not create any problem but, in the context of WordPress it will.

                                                                                                                                                                                    -

                                                                                                                                                                                    While handling a single HTTP request WordPress will set, and use, a number of constants and globals and, likewise, will do plugins and themes that follow WordPress standards.

                                                                                                                                                                                    -

                                                                                                                                                                                    This means that the global context (variable scope) will be left "dirty" and contain "left-over" constants and globals from the previous tests.

                                                                                                                                                                                    -

                                                                                                                                                                                    An example is one where a test for the handling of Ajax requests sets the DOING_AJAX constant: this will be now set for any test after the one that set it thus breaking, or worse altering, all the following ones.

                                                                                                                                                                                    -

                                                                                                                                                                                    So, in short, run each suite separately.

                                                                                                                                                                                    -

                                                                                                                                                                                    Can I have more than one suite of one kind?

                                                                                                                                                                                    -

                                                                                                                                                                                    Yes, you should.

                                                                                                                                                                                    -

                                                                                                                                                                                    As an example you might have a frontend suite running acceptance tests on the site frontend and a backend suite running acceptance tests on the site backend.

                                                                                                                                                                                    -

                                                                                                                                                                                    Think of suites as a tool to organize your tests: there's a good measure between too organized and not organized at all.

                                                                                                                                                                                    -

                                                                                                                                                                                    I've used PHPUnit before for my unit tests, can I reuse that knowledge and code with wp-browser?

                                                                                                                                                                                    -

                                                                                                                                                                                    Yes.

                                                                                                                                                                                    -

                                                                                                                                                                                    Codeception uses PHPUnit as one of its main components and can run PHPUnit tests with little or no modification.

                                                                                                                                                                                    -

                                                                                                                                                                                    As such you can just move your existing PHPUnit tests in a dedicated suite and be ready to run in minutes.

                                                                                                                                                                                    -

                                                                                                                                                                                    I've already set up my tests to run using the Core PHPUnit-based test suite, can I keep using my tests?

                                                                                                                                                                                    -

                                                                                                                                                                                    Yes.

                                                                                                                                                                                    -

                                                                                                                                                                                    Codeception uses PHPUnit as one of its main components and can run PHPUnit tests with little or no modification.

                                                                                                                                                                                    -

                                                                                                                                                                                    One of the goals of wp-browser was to make it easier to test WordPress application at an integration level (or "WordPress unit" level).

                                                                                                                                                                                    -

                                                                                                                                                                                    As such migrating those tests could be a matter of minutes requiring no modification to the tests if not for moving some files and creating a dedicated suite.

                                                                                                                                                                                    -

                                                                                                                                                                                    Why is the project called wp-browser?

                                                                                                                                                                                    -

                                                                                                                                                                                    When I started working with Codeception to run my acceptance tests I kept creating steps that I would reuse over and over in my projects.

                                                                                                                                                                                    -

                                                                                                                                                                                    I packed them in a module extending the PHPBrowser module.

                                                                                                                                                                                    -

                                                                                                                                                                                    Being a natural talent in naming things I've called the module WPBrowser and published it. As I started relying on Codeception more and more I kept adding modules but the name remained.

                                                                                                                                                                                    - - - - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - -
                                                                                                                                                                                    - -
                                                                                                                                                                                    - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - - - - - - - \ No newline at end of file diff --git a/docs/public/v3/index.html b/docs/public/v3/index.html deleted file mode 100644 index b7fa2391c..000000000 --- a/docs/public/v3/index.html +++ /dev/null @@ -1,370 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - Index - wp-browser docs - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
                                                                                                                                                                                    - -
                                                                                                                                                                                    - - - - - - -
                                                                                                                                                                                    - - -
                                                                                                                                                                                    - -
                                                                                                                                                                                    - - - - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - - - - - -

                                                                                                                                                                                    Index

                                                                                                                                                                                    - -
                                                                                                                                                                                    -

                                                                                                                                                                                    This is the documentation for version 3 of the project. -The current version is version 4 and the documentation can be found here.

                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    The wp-browser project provides a Codeception based solution to test WordPress plugins, themes and whole sites at all levels of testing.

                                                                                                                                                                                    -

                                                                                                                                                                                    The purpose of this documentation is to help you set up, run and iterate over your project and test code using the powerful APIs provided by Codeception while trying to alleviate the pains of setting it up for WordPress projects.

                                                                                                                                                                                    -

                                                                                                                                                                                    Throughout the documentation you will find references to test terminology: I've tried to condense those into small, digestable chunks to provide a rough idea without and a limited context; where required I tried to provide links to dive deeper into the subjects.

                                                                                                                                                                                    -

                                                                                                                                                                                    Happy testing!

                                                                                                                                                                                    -

                                                                                                                                                                                    Table of contents

                                                                                                                                                                                    - - - - - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - -
                                                                                                                                                                                    - -
                                                                                                                                                                                    - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - - - - - - - \ No newline at end of file diff --git a/docs/public/v3/installation/index.html b/docs/public/v3/installation/index.html deleted file mode 100644 index 3c1a07bf6..000000000 --- a/docs/public/v3/installation/index.html +++ /dev/null @@ -1,365 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - Installation - wp-browser docs - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
                                                                                                                                                                                    - -
                                                                                                                                                                                    - - - - - - -
                                                                                                                                                                                    - - -
                                                                                                                                                                                    - -
                                                                                                                                                                                    - - - - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    - -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - - - - - -

                                                                                                                                                                                    Installation

                                                                                                                                                                                    - -

                                                                                                                                                                                    Installation

                                                                                                                                                                                    -

                                                                                                                                                                                    Where should I install wp-browser?

                                                                                                                                                                                    -

                                                                                                                                                                                    As a rule-of-thumb wp-browser should be installed in the root folder of your -project.

                                                                                                                                                                                    -

                                                                                                                                                                                    If your project is a plugin then it should be installed in the root folder of your plugin; if your project is a theme it should be installed in the root folder of your theme.

                                                                                                                                                                                    -

                                                                                                                                                                                    If your project is a site I'd, personally install it in the site root folder.

                                                                                                                                                                                    -

                                                                                                                                                                                    The purpose of installing wp-browser in the root folder of a project is to keep the code and its tests under version control together.

                                                                                                                                                                                    -

                                                                                                                                                                                    Exceptions apply but, for most projects, that's what I would do.

                                                                                                                                                                                    -

                                                                                                                                                                                    Initializing the Composer project

                                                                                                                                                                                    -

                                                                                                                                                                                    Since Composer is a requirement of wp-browser and the only way to install it you should, first thing, initialize the Composer project.

                                                                                                                                                                                    -

                                                                                                                                                                                    If you've already initialized the Composer project you can skip this section.

                                                                                                                                                                                    -

                                                                                                                                                                                    Once you've decided where to install wp-browser navigate to that folder using the terminal and type:

                                                                                                                                                                                    -
                                                                                                                                                                                    composer init
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Composer will take you through a number of questions to setup some meta information about your project.

                                                                                                                                                                                    -

                                                                                                                                                                                    Do not install any dependency yet when asked (unless you know what you're doing) and, as a suggestion, set wordpress-plugin as "Package Type".

                                                                                                                                                                                    -

                                                                                                                                                                                    Also, since WordPress is licensed under the GPL-2.0+ you might want to set the "License" of your project to GPL-2.0-or-later.

                                                                                                                                                                                    -

                                                                                                                                                                                    Installing wp-browser as a development dependency

                                                                                                                                                                                    -

                                                                                                                                                                                    Once you've initialized the Composer project it's time to require wp-browser ; you can read more about the usage of the require command on the Composer documentation.

                                                                                                                                                                                    -

                                                                                                                                                                                    wp-browser is a testing tool and, as such, should be installed as a project development dependency, not as a normal (production) one.

                                                                                                                                                                                    -

                                                                                                                                                                                    From the terminal type:

                                                                                                                                                                                    -
                                                                                                                                                                                    composer require --dev lucatume/wp-browser
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    This will install the latest stable version of wp-browser and, along with it, Codeception and PHPUnit in the vendor folder of your project.

                                                                                                                                                                                    -

                                                                                                                                                                                    Once that's done it's time to move to the setup and configuration of wp-browser.

                                                                                                                                                                                    - - - - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - -
                                                                                                                                                                                    - -
                                                                                                                                                                                    - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - - - - - - - \ No newline at end of file diff --git a/docs/public/v3/levels-of-testing/index.html b/docs/public/v3/levels-of-testing/index.html deleted file mode 100644 index 2eef3928f..000000000 --- a/docs/public/v3/levels-of-testing/index.html +++ /dev/null @@ -1,590 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - Levels of testing - wp-browser docs - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
                                                                                                                                                                                    - -
                                                                                                                                                                                    - - - - - - -
                                                                                                                                                                                    - - -
                                                                                                                                                                                    - -
                                                                                                                                                                                    - - - - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - - - - - -

                                                                                                                                                                                    Levels of testing

                                                                                                                                                                                    - -

                                                                                                                                                                                    What is a unit test? An acceptance test?

                                                                                                                                                                                    -

                                                                                                                                                                                    This page has no pretense to be THE source of truth about what is called how in the context of tests; the purpose of this page is to lay out the terminology that I'll use in the documentation to define the levels and component of testing. Wikipedia, forums and other documents online will offer alternate, and equally valid, definitions.

                                                                                                                                                                                    -

                                                                                                                                                                                    The signup page example

                                                                                                                                                                                    -

                                                                                                                                                                                    Let's assume I'm testing a WordPress plugin that adds mailing list management and subscription functionalities to a site.

                                                                                                                                                                                    -

                                                                                                                                                                                    The plugin provides a number of functions and, among them, it will add a sign-up page to receive users applications.

                                                                                                                                                                                    -

                                                                                                                                                                                    Acceptance tests

                                                                                                                                                                                    -

                                                                                                                                                                                    In brief: make assertions as a user would.

                                                                                                                                                                                    -

                                                                                                                                                                                    The user might be tech-savvy as much as I want her to be but still make assertions only on what feedback the site provides.

                                                                                                                                                                                    -

                                                                                                                                                                                    The code below tests a user can subscribe to the mailing list:

                                                                                                                                                                                    -
                                                                                                                                                                                    <?php
                                                                                                                                                                                    -// UserSuccessfulSignupTest.php
                                                                                                                                                                                    -
                                                                                                                                                                                    -// Add a page that contains the shortcode that will render the signup form.
                                                                                                                                                                                    -$I->havePageInDatabase( [
                                                                                                                                                                                    -    'post_name' => 'signup',
                                                                                                                                                                                    -    'post_content'=> 'Sign-up for our awesome thing! [signup]',
                                                                                                                                                                                    -] );
                                                                                                                                                                                    -
                                                                                                                                                                                    -// Go to the page.
                                                                                                                                                                                    -$I->amOnPage( '/signup' );
                                                                                                                                                                                    -
                                                                                                                                                                                    -// Submit the form as a user would submit it. 
                                                                                                                                                                                    -$I->submitForm( '#signup-form', [
                                                                                                                                                                                    -  'name' => 'Luca',
                                                                                                                                                                                    -  'email' => 'luca@theAverageDev.com',
                                                                                                                                                                                    -] );
                                                                                                                                                                                    -
                                                                                                                                                                                    -// Make sure I see a confirmation message. 
                                                                                                                                                                                    -$I->waitForElement( '#signup-confirmation' );
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Functional tests

                                                                                                                                                                                    -

                                                                                                                                                                                    In brief: make assertions as a developer would.

                                                                                                                                                                                    -

                                                                                                                                                                                    The test code below asserts front-end submissions are correctly processed from the developer perspective:

                                                                                                                                                                                    -
                                                                                                                                                                                    <?php
                                                                                                                                                                                    -// file tests/functional/SignupSubmissionCest.php
                                                                                                                                                                                    -
                                                                                                                                                                                    -class SignupSubmissionCest {
                                                                                                                                                                                    -
                                                                                                                                                                                    -    public function _before( FunctionalTester $I ) {
                                                                                                                                                                                    -        // Add a page that contains the shortcode that will render the signup form.
                                                                                                                                                                                    -        $I->havePageInDatabase( [
                                                                                                                                                                                    -            'post_name' => 'signup',
                                                                                                                                                                                    -            'post_content'=> 'Sign-up for our awesome thing! [signup]',
                                                                                                                                                                                    -        ] );
                                                                                                                                                                                    -
                                                                                                                                                                                    -        $I->amOnPage( '/signup' );
                                                                                                                                                                                    -    }
                                                                                                                                                                                    -
                                                                                                                                                                                    -    public function test_good_signup( FunctionalTester $I ) {
                                                                                                                                                                                    -        $I->sendAjaxPostRequest( '/wp-json/acme/v1/signup', [
                                                                                                                                                                                    -          '_wpnonce' => $I->grabAttributeFrom( '#signup-nonce', 'value' ),
                                                                                                                                                                                    -          'name' => 'Luca',
                                                                                                                                                                                    -          'email' => 'luca@theAverageDev.com',
                                                                                                                                                                                    -        ] );
                                                                                                                                                                                    -
                                                                                                                                                                                    -        $I->seeResponseCodeIsSuccessful();
                                                                                                                                                                                    -        $I->seeUserInDatabase( [ 'user_login' => 'luca', 'user_email' => 'luca@theaveragedev.com' ] );
                                                                                                                                                                                    -    }
                                                                                                                                                                                    -
                                                                                                                                                                                    -    public function test_bad_email_signup( FunctionalTester $I ) {
                                                                                                                                                                                    -        $I->sendAjaxPostRequest( '/wp-json/acme/v1/signup', [
                                                                                                                                                                                    -          '_wpnonce' => $I->grabAttributeFrom( '#signup-nonce', 'value' ),
                                                                                                                                                                                    -          'name' => 'Luca',
                                                                                                                                                                                    -          'email' => 'not-really-an-email',
                                                                                                                                                                                    -        ] );
                                                                                                                                                                                    -
                                                                                                                                                                                    -        $I->seeResponseCodeIs( 400 );
                                                                                                                                                                                    -        $I->dontSeeUserInDatabase( [ 'user_login' => 'luca', 'user_email' => 'not-really-an-email' ] );
                                                                                                                                                                                    -    }
                                                                                                                                                                                    -}
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    The code looks, initially, like an acceptance test, but differs in its action and assertion phase: in place of filling a form and clicking "Submit" it sends a POST request to a REST API endpoint and checks the effect of the submission in the database.

                                                                                                                                                                                    -

                                                                                                                                                                                    All of these actions fall squarely into what a developer would do, not into what a user could/should be able to do.

                                                                                                                                                                                    -

                                                                                                                                                                                    Furthermore, the format of the test is not the same as the one used in the acceptance test.

                                                                                                                                                                                    -

                                                                                                                                                                                    The acceptance test is written in the most eloquent testing format supported by Codeception, the Cept format, this test uses a more PHPUnit-like format, the Cest format.

                                                                                                                                                                                    -

                                                                                                                                                                                    While the first is easier to skim for non-developers the second harnesses the power of a re-using pieces of code, the page creation and navigation in the example, to optimize the test code.

                                                                                                                                                                                    -

                                                                                                                                                                                    Integration tests

                                                                                                                                                                                    -

                                                                                                                                                                                    In brief: test code modules in the context of a WordPress website.

                                                                                                                                                                                    -

                                                                                                                                                                                    In this type of test the WordPress, and additional plugins code, is loaded in the same variable scope as the tests; this is why in the example below I'm using classes (WP_REST_Request, WP_REST_Response) and methods (register_rest_route) defined by WordPress, not the plugin code.

                                                                                                                                                                                    -

                                                                                                                                                                                    The REST API request sent by the application form will be handled by a class, Acme\Signup\SubmissionHandler, that's been attached to the /wp-json/acme/v1/signup path:

                                                                                                                                                                                    -
                                                                                                                                                                                    <?php
                                                                                                                                                                                    -// file src/rest.php
                                                                                                                                                                                    -
                                                                                                                                                                                    -add_action( 'rest_api_init', function () {
                                                                                                                                                                                    -    register_rest_route( 'acme/v1', '/signup', array(
                                                                                                                                                                                    -        'methods' => 'POST',
                                                                                                                                                                                    -        'callback' => function( WP_Rest_Request $request ) {
                                                                                                                                                                                    -            $email_validator = new Acme\Signup\EmailValidator();
                                                                                                                                                                                    -            $handler = new Acme\Signup\SubmissionHandler( $email_validator );
                                                                                                                                                                                    -
                                                                                                                                                                                    -            return $handler->handle( $request );
                                                                                                                                                                                    -        },
                                                                                                                                                                                    -    ) );
                                                                                                                                                                                    -} );
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    I want to test the chain of classes and methods that's handling such a request in the context of a WordPress installation.

                                                                                                                                                                                    -

                                                                                                                                                                                    Integration is usually about testing "modules" of code: groups of classes and functions working together to provide a service or complete a task.

                                                                                                                                                                                    -

                                                                                                                                                                                    In the context of integration testing the class dependencies and/or the context are not mocked.

                                                                                                                                                                                    -
                                                                                                                                                                                    <?php
                                                                                                                                                                                    -// file tests/integration/SubmissionHandlingTest.php
                                                                                                                                                                                    -
                                                                                                                                                                                    -class SubmissionHandlingTest extends \Codeception\TestCase\WPTestCase {
                                                                                                                                                                                    -    public function test_good_request() {
                                                                                                                                                                                    -        $request = new WP_Rest_Request();
                                                                                                                                                                                    -        $request->set_body_params( [ 'name' => 'luca', 'email' => 'luca@theaveragedev.com' ] );
                                                                                                                                                                                    -        $handler = new  Acme\Signup\SubmissionHandler();
                                                                                                                                                                                    -
                                                                                                                                                                                    -        $response = $handler->handle( $request );
                                                                                                                                                                                    -
                                                                                                                                                                                    -        $this->assertIntsanceOf( WP_REST_Response::class, $response );
                                                                                                                                                                                    -        $this->assertEquals( 200, $response->get_status() );
                                                                                                                                                                                    -        $this->assertInstanceOf( Acme\Signup\Submission_Good::class, $handler->last_submission() );
                                                                                                                                                                                    -        $this->assertEquals( 'luca', $handler->last_submission()->name() );
                                                                                                                                                                                    -        $this->assertEquals( 'luca@theaveragedev.com', $handler->last_submission()->email() );
                                                                                                                                                                                    -    }
                                                                                                                                                                                    -
                                                                                                                                                                                    -    public function test_bad_email_request() {
                                                                                                                                                                                    -        $request = new WP_Rest_Request();
                                                                                                                                                                                    -        $request->set_body_params( [ 'name' => 'luca', 'email' => 'not-a-valid-email' ] );
                                                                                                                                                                                    -        $handler = new  Acme\Signup\SubmissionHandler();
                                                                                                                                                                                    -
                                                                                                                                                                                    -        $response = $handler->handle( $request );
                                                                                                                                                                                    -
                                                                                                                                                                                    -        $this->assertIntsanceOf( WP_REST_Response::class, $response );
                                                                                                                                                                                    -        $this->assertEquals( 400, $response->get_status() );
                                                                                                                                                                                    -        $this->assertInstanceOf( Acme\Signup\Submission_Bad::class, $handler->last_submission() );
                                                                                                                                                                                    -        $this->assertEquals( 'luca', $handler->last_submission()->name() );
                                                                                                                                                                                    -        $this->assertEquals( 'not-a-valid-email', $handler->last_submission()->email() );
                                                                                                                                                                                    -    }
                                                                                                                                                                                    -}
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    The test format used is the familiar PhpUnit one; the only difference is the base test class that's being extended (\Codeception\TestCase\WPTestCase) is one provided by wp-browser.

                                                                                                                                                                                    -

                                                                                                                                                                                    In the context of WordPress "integration" might also mean testing that filters used by the code have the expected effect.

                                                                                                                                                                                    -

                                                                                                                                                                                    Unit tests

                                                                                                                                                                                    -

                                                                                                                                                                                    In brief: test single classes or functions in isolation.

                                                                                                                                                                                    -

                                                                                                                                                                                    The email address is validated by the Acme\Signup\EmailValidator class.

                                                                                                                                                                                    -

                                                                                                                                                                                    In the test code below I want to make sure the validation works as intended.

                                                                                                                                                                                    -
                                                                                                                                                                                    <?php
                                                                                                                                                                                    -// file tests/unit/EmailValidatorTest.php
                                                                                                                                                                                    -
                                                                                                                                                                                    -class EmailValidatorTest extends Codeception\Test\Test {
                                                                                                                                                                                    -    public function test_good_email_validation() {
                                                                                                                                                                                    -        $validator = new Acme\Signup\EmailValidator();
                                                                                                                                                                                    -
                                                                                                                                                                                    -        $this->assertTrue( $validator->validate( 'luca@theaveragedev.com' ) ); 
                                                                                                                                                                                    -    }
                                                                                                                                                                                    -
                                                                                                                                                                                    -    public function test_bad_email_validation(){
                                                                                                                                                                                    -        $validator = new Acme\Signup\EmailValidator();
                                                                                                                                                                                    -
                                                                                                                                                                                    -        $this->assertTrue( $validator->validate( 'not-an-email' ) );
                                                                                                                                                                                    -    }
                                                                                                                                                                                    -
                                                                                                                                                                                    -    public function test_tricky_email_validation() {
                                                                                                                                                                                    -        $validator = new Acme\Signup\EmailValidator();
                                                                                                                                                                                    -
                                                                                                                                                                                    -        $this->assertTrue( $validator->validate( 'luca+signup@theaveragedev.com' ) ); 
                                                                                                                                                                                    -    }
                                                                                                                                                                                    -
                                                                                                                                                                                    -    public function test_validation_with_service(){
                                                                                                                                                                                    -        // Stub the validation service.
                                                                                                                                                                                    -        $validation_service = $this->prophesize( Acme\Signup\ValidationService::class );
                                                                                                                                                                                    -        $validation_service->validate( 'luca@theaveragedev.com' )->willReturn( true );
                                                                                                                                                                                    -        $validation_service->validate( 'lucas@theaveragedev.com' )->willReturn( false );
                                                                                                                                                                                    -        // Build the validator and set it to use the mock validation service.
                                                                                                                                                                                    -        $validator = new Acme\Signup\EmailValidator();
                                                                                                                                                                                    -        $validator->use_service( $validation_service->reveal() );
                                                                                                                                                                                    -
                                                                                                                                                                                    -        $this->assertTrue( $validator->validate( 'luca@theaveragedev.com' ) );
                                                                                                                                                                                    -        $this->assertFalse( $validator->validate( 'lucas@theaveragedev.com' ) );
                                                                                                                                                                                    -    }
                                                                                                                                                                                    -}
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Unit tests is where stubbing/mocking/spying of dependencies is used to gain total control over the input and context the class is using.

                                                                                                                                                                                    -

                                                                                                                                                                                    In the last test method I'm doing exactly that testing the email validator with an external validation service.

                                                                                                                                                                                    -

                                                                                                                                                                                    In the example I'm using the Prophecy mock engine that comes with PHPUnit along with its own mocking/stubbing/spying solutions.

                                                                                                                                                                                    -

                                                                                                                                                                                    There are other mocking engines (e.g Mockery) that could be used.

                                                                                                                                                                                    -

                                                                                                                                                                                    WordPress "unit" tests

                                                                                                                                                                                    -

                                                                                                                                                                                    In brief: test single classes or functions that require WordPress code in as much isolation as possible.

                                                                                                                                                                                    -

                                                                                                                                                                                    This is what most people referring to "unit tests" in the context of WordPress is talking about.

                                                                                                                                                                                    -

                                                                                                                                                                                    The purpose of this kind of tests is to test one class of a WordPress application, or one function, that requires a WordPress-defined function or class with a unit testing approach.

                                                                                                                                                                                    -

                                                                                                                                                                                    In the example below I'm testing the Acme\Signup\SubmissionHandler class on a "unit" level making sure it will mark a request as bad if the email is not a valid one.

                                                                                                                                                                                    -
                                                                                                                                                                                    <?php
                                                                                                                                                                                    -// file tests/unit/SubmissionHandlerTest.php
                                                                                                                                                                                    -class SubmissionHandlerTest extends Codeception\Test\Test {
                                                                                                                                                                                    -    protected  $request;
                                                                                                                                                                                    -    protected $validator;
                                                                                                                                                                                    -
                                                                                                                                                                                    -    public function setUp() {
                                                                                                                                                                                    -        // Mock the request.
                                                                                                                                                                                    -        $this->request = $this->prophesize( WP_REST_Request::class );
                                                                                                                                                                                    -        // Spy on the validator.
                                                                                                                                                                                    -        $this->validator = $this->prophesize( Acme\Signup\EmailValidator::class );
                                                                                                                                                                                    -    }
                                                                                                                                                                                    -
                                                                                                                                                                                    -    public function test_email_is_validated_by_default() {
                                                                                                                                                                                    -        $this->request->get_param( 'name' )->willReturn( 'luca' );
                                                                                                                                                                                    -        $this->request->get_param( 'email' )->willReturn( 'luca@theaveragedev.com' );
                                                                                                                                                                                    -
                                                                                                                                                                                    -        $handler = new Acme\Signup\SubmissionHandler( $this->validator->reveal() );
                                                                                                                                                                                    -        $handler->set_validator( $this->validator );
                                                                                                                                                                                    -        $response = $handler->handle( $this->request->reveal() );
                                                                                                                                                                                    -
                                                                                                                                                                                    -        $this->assertInstanceOf( WP_REST_Response::class, $response );
                                                                                                                                                                                    -        // Verify on the validator spy.
                                                                                                                                                                                    -        $this->validator->validate( 'luca@theaveragedev.com' )->shouldHaveBeenCalled();
                                                                                                                                                                                    -    }
                                                                                                                                                                                    -
                                                                                                                                                                                    -    public function test_will_not_validate_email_if_missing() {
                                                                                                                                                                                    -        $this->request->get_param( 'name' )->willReturn( 'luca' );
                                                                                                                                                                                    -        $this->request->get_param( 'email' )->willReturn( '' );
                                                                                                                                                                                    -
                                                                                                                                                                                    -        $handler = new Acme\Signup\SubmissionHandler( $this->validator->reveal() );
                                                                                                                                                                                    -        $handler->set_validator( $this->validator );
                                                                                                                                                                                    -        $response = $handler->handle( $this->request->reveal() );
                                                                                                                                                                                    -
                                                                                                                                                                                    -        $this->assertInstanceOf( WP_REST_Response::class, $response );
                                                                                                                                                                                    -        // Verify on the validator spy.
                                                                                                                                                                                    -        $this->validator->validate( Argument::any() )->shouldNotHaveBeenCalled();
                                                                                                                                                                                    -    }
                                                                                                                                                                                    -}
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    The class uses the WP_REST_Request and WP_Rest_Response classes as input and output and will probably, internally, use more functions defined by WordPress.

                                                                                                                                                                                    -

                                                                                                                                                                                    One solution to avoid loading WordPress, could be to rewrite test versions of each and all the WordPress functions and classes needed by all the classes I want to unit test; this would require updating each time the classes requirements change.

                                                                                                                                                                                    -

                                                                                                                                                                                    Furthermore internationalization (e.g. __()) and filtering (e.g apply_filters) functions would not need to be mocked if not in specific cases and would pretty much be copy and paste versions of the WordPres ones.

                                                                                                                                                                                    -

                                                                                                                                                                                    Loading single pieces of WordPress is a dangerous and brittle endeavour and it's not supported by the -framework.

                                                                                                                                                                                    -

                                                                                                                                                                                    To avoid all this WordPress "unit tests" pay the price of having to bootstrap WordPress, thus requiring a database connection.

                                                                                                                                                                                    -

                                                                                                                                                                                    This kind of test setup and level is the one you can see in the PHPUnit Core suite of WordPress itself.

                                                                                                                                                                                    - - - - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - -
                                                                                                                                                                                    - -
                                                                                                                                                                                    - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - - - - - - - \ No newline at end of file diff --git a/docs/public/v3/migration/from-version-2-to-version-3/index.html b/docs/public/v3/migration/from-version-2-to-version-3/index.html deleted file mode 100644 index 4b050e90c..000000000 --- a/docs/public/v3/migration/from-version-2-to-version-3/index.html +++ /dev/null @@ -1,331 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - From version 2 to version 3 - wp-browser docs - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
                                                                                                                                                                                    - -
                                                                                                                                                                                    - - - - - - -
                                                                                                                                                                                    - - -
                                                                                                                                                                                    - -
                                                                                                                                                                                    - - - - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - - - - - -

                                                                                                                                                                                    From version 2 to version 3

                                                                                                                                                                                    - -

                                                                                                                                                                                    Migrating projects from version 2 of wp-browser to version 3

                                                                                                                                                                                    -

                                                                                                                                                                                    Version 3 of wp-browser removed, to allow for broader compatibility with PHP and Composer versions, some of its -dependencies and modified some of its methods.
                                                                                                                                                                                    -Here is a list of changes and the suggested courses of action:

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • Removed symfony/process to launch and manage external processes; re-add it your project development -requirements using composer require --dev symfony/process.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • Removed the wp-cli/wp-cli-bundle dependency; if you were relying on non-core - packages, then re-add it to your project development requirements using composer require --dev wp-cli/wp-cli-bundle.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • Removed the WithWpCli::executeBackgroundWpCliCommand trait method, and, as a consequence, the -WPCLI::executeBackgroundWpCliCommand module method; you could have used the latter, if this was the case, then -require the symfony/process as explained above and launch processes in background using its API; find out more.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • Refactored the WPCLI module to build and escape string command lines differently; the handling of command-line arguments -for the WPCLI module has been modified to make it a bit more consistent and robust; as a consequence, you might experience -some breakages in string commands that used to work correctly before; should this be the case then either modify -your code to provide the command in array format (taking care of the correct escaping in your code), or make sure to -pass a correctly structured command string to the WPCLI module.
                                                                                                                                                                                    • -
                                                                                                                                                                                    - - - - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - -
                                                                                                                                                                                    - -
                                                                                                                                                                                    - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - - - - - - - \ No newline at end of file diff --git a/docs/public/v3/modules/WPBrowser/index.html b/docs/public/v3/modules/WPBrowser/index.html deleted file mode 100644 index c6b599607..000000000 --- a/docs/public/v3/modules/WPBrowser/index.html +++ /dev/null @@ -1,724 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - WPBrowser module - wp-browser docs - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
                                                                                                                                                                                    - -
                                                                                                                                                                                    - - - - - - -
                                                                                                                                                                                    - - -
                                                                                                                                                                                    - -
                                                                                                                                                                                    - - - - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - - - - - -

                                                                                                                                                                                    WPBrowser module

                                                                                                                                                                                    -

                                                                                                                                                                                    This module should be used in acceptance and functional tests, see levels of testing for more information.

                                                                                                                                                                                    -

                                                                                                                                                                                    This module extends the PHPBrowser module adding WordPress-specific configuration parameters and methods.

                                                                                                                                                                                    -

                                                                                                                                                                                    The module simulates a user interaction with the site without Javascript support; if you need to test your project with Javascript support use the WPWebDriver module.

                                                                                                                                                                                    -

                                                                                                                                                                                    Module requirements for Codeception 4.0+

                                                                                                                                                                                    -

                                                                                                                                                                                    This module requires the codeception/module-phpbrowser Composer package to work when wp-browser is used with Codeception 4.0.

                                                                                                                                                                                    -

                                                                                                                                                                                    To install the package run:

                                                                                                                                                                                    -
                                                                                                                                                                                    composer require --dev codeception/module-phpbrowser:^1.0
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Configuration

                                                                                                                                                                                    -

                                                                                                                                                                                    Since this module extends the PHPBrowser module provided by Codeception, please refer to the PHPBrowser configuration section for more information about the base configuration parameters.

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • url required - Start URL of your WordPress project, e.g. http://wp.test.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • headers - Default headers are set before each test; this might be useful to simulate a specific user agent during the tests or to identify the request source. Note that the headers defined in the config should be prefaced with HTTP_ in your wp-config.php file. This can be used to select which database to use.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • handler (default: curl) - The Guzzle handler to use. By default curl is used, also possible to pass stream, or any valid class name as Handler.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • middleware - The Guzzle middlewares to add. An array of valid callables is required; see here for more information.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • curl - curl options; only applied if using the curl handler; more options are available.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • adminUsername required - This is the login name, not the "nice" name, of the administrator user of the WordPress test site. This will be used to fill the username field in WordPress login page.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • adminPassword required - This is the the password of the administrator use of the WordPress test site. This will be used to fill the password in WordPress login page.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • adminPath required - The path, relative to the WordPress test site home URL, to the administration area, usually /wp-admin.
                                                                                                                                                                                    • -
                                                                                                                                                                                    -

                                                                                                                                                                                    Example configuration

                                                                                                                                                                                    -
                                                                                                                                                                                      modules:
                                                                                                                                                                                    -      enabled:
                                                                                                                                                                                    -          - WPBrowser
                                                                                                                                                                                    -      config:
                                                                                                                                                                                    -          WPBrowser:
                                                                                                                                                                                    -              url: 'http://wordpress.localhost'
                                                                                                                                                                                    -              adminUsername: 'admin'
                                                                                                                                                                                    -              adminPassword: 'password'
                                                                                                                                                                                    -              adminPath: '/wp-admin'
                                                                                                                                                                                    -              headers:
                                                                                                                                                                                    -                X_TEST_REQUEST: 1
                                                                                                                                                                                    -                X_WPBROWSER_REQUEST: 1
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Read here how to use the headers information to automatically change the database during acceptance and functional tests.

                                                                                                                                                                                    - - -

                                                                                                                                                                                    Public API

                                                                                                                                                                                    - - -

                                                                                                                                                                                    activatePlugin

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    In the plugin administration screen activates a plugin clicking the "Activate" link. The method will not handle authentication to the admin area.

                                                                                                                                                                                    - -
                                                                                                                                                                                    // Activate a plugin.
                                                                                                                                                                                    -  $I->loginAsAdmin();
                                                                                                                                                                                    -  $I->amOnPluginsPage();
                                                                                                                                                                                    -  $I->activatePlugin('hello-dolly');
                                                                                                                                                                                    -  // Activate a list of plugins.
                                                                                                                                                                                    -  $I->loginAsAdmin();
                                                                                                                                                                                    -  $I->amOnPluginsPage();
                                                                                                                                                                                    -  $I->activatePlugin(['hello-dolly','another-plugin']);
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string/\Codeception\Module\array $pluginSlug - The plugin slug, like "hello-dolly" or a list of plugin slugs.
                                                                                                                                                                                    - -

                                                                                                                                                                                    amEditingPostWithId

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Go to the admin page to edit the post with the specified ID. The method will not handle authentication the admin area.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $I->loginAsAdmin();
                                                                                                                                                                                    -  $postId = $I->havePostInDatabase();
                                                                                                                                                                                    -  $I->amEditingPostWithId($postId);
                                                                                                                                                                                    -  $I->fillField('post_title', 'Post title');
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • int $id - The post ID.
                                                                                                                                                                                    - -

                                                                                                                                                                                    amOnAdminAjaxPage

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Go to the admin-ajax.php page to start a synchronous, and blocking, GET AJAX request. The method will not handle authentication, nonces or authorization.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $I->amOnAdminAjaxPage(['action' => 'my-action', 'data' => ['id' => 23], 'nonce' => $nonce]);
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string/\Codeception\Module\array $queryVars - A string or array of query variables to append to the AJAX path.
                                                                                                                                                                                    - -

                                                                                                                                                                                    amOnAdminPage

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Go to a page in the admininstration area of the site. This method will not handle authentication to the administration area.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $I->loginAs('user', 'password');
                                                                                                                                                                                    -  // Go to the plugins management screen.
                                                                                                                                                                                    -  $I->amOnAdminPage('/plugins.php');
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string $page - The path, relative to the admin area URL, to the page.
                                                                                                                                                                                    - -

                                                                                                                                                                                    amOnCronPage

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Go to the cron page to start a synchronous, and blocking, GET request to the cron script.

                                                                                                                                                                                    - -
                                                                                                                                                                                    // Triggers the cron job with an optional query argument.
                                                                                                                                                                                    -  $I->amOnCronPage('/?some-query-var=some-value');
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string/\Codeception\Module\array $queryVars - A string or array of query variables to append to the AJAX path.
                                                                                                                                                                                    - -

                                                                                                                                                                                    amOnPagesPage

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Go the "Pages" administration screen. The method will not handle authentication.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $I->loginAsAdmin();
                                                                                                                                                                                    -  $I->amOnPagesPage();
                                                                                                                                                                                    -  $I->see('Add New');
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    amOnPluginsPage

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Go to the plugins administration screen. The method will not handle authentication.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $I->loginAsAdmin();
                                                                                                                                                                                    -  $I->amOnPluginsPage();
                                                                                                                                                                                    -  $I->activatePlugin('hello-dolly');
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    deactivatePlugin

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    In the plugin administration screen deactivate a plugin clicking the "Deactivate" link. The method will not handle authentication and navigation to the plugins administration page.

                                                                                                                                                                                    - -
                                                                                                                                                                                    // Deactivate one plugin.
                                                                                                                                                                                    -  $I->loginAsAdmin();
                                                                                                                                                                                    -  $I->amOnPluginsPage();
                                                                                                                                                                                    -  $I->deactivatePlugin('hello-dolly');
                                                                                                                                                                                    -  // Deactivate a list of plugins.
                                                                                                                                                                                    -  $I->loginAsAdmin();
                                                                                                                                                                                    -  $I->amOnPluginsPage();
                                                                                                                                                                                    -  $I->deactivatePlugin(['hello-dolly', 'my-plugin']);
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string/\Codeception\Module\array $pluginSlug - The plugin slug, like "hello-dolly", or a list of plugin slugs.
                                                                                                                                                                                    - -

                                                                                                                                                                                    dontSeePluginInstalled

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Assert a plugin is not installed in the plugins administration screen. The method will not handle authentication and navigation to the plugin administration screen.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $I->loginAsAdmin();
                                                                                                                                                                                    -  $I->amOnPluginsPage();
                                                                                                                                                                                    -  $I->dontSeePluginInstalled('my-plugin');
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string $pluginSlug - The plugin slug, like "hello-dolly".
                                                                                                                                                                                    - -

                                                                                                                                                                                    grabCookiesWithPattern

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Returns all the cookies whose name matches a regex pattern.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $I->loginAs('customer','password');
                                                                                                                                                                                    -  $I->amOnPage('/shop');
                                                                                                                                                                                    -  $cartCookies = $I->grabCookiesWithPattern("#^shop_cart\\.*#");
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string $cookiePattern - The regular expression pattern to use for the matching.
                                                                                                                                                                                    - -

                                                                                                                                                                                    grabWordPressTestCookie

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Returns WordPress default test cookie object if present.

                                                                                                                                                                                    - -
                                                                                                                                                                                    // Grab the default WordPress test cookie.
                                                                                                                                                                                    -  $wpTestCookie = $I->grabWordPressTestCookie();
                                                                                                                                                                                    -  // Grab a customized version of the test cookie.
                                                                                                                                                                                    -  $myTestCookie = $I->grabWordPressTestCookie('my_test_cookie');
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string $name - Optional, overrides the default cookie name.
                                                                                                                                                                                    - -

                                                                                                                                                                                    logOut

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Navigate to the default WordPress logout page and click the logout link.

                                                                                                                                                                                    - -
                                                                                                                                                                                    // Log out using the `wp-login.php` form and return to the current page.
                                                                                                                                                                                    -  $I->logOut(true);
                                                                                                                                                                                    -  // Log out using the `wp-login.php` form and remain there.
                                                                                                                                                                                    -  $I->logOut(false);
                                                                                                                                                                                    -  // Log out using the `wp-login.php` form and move to another page.
                                                                                                                                                                                    -  $I->logOut('/some-other-page');
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • bool/bool/string $redirectTo - Whether to redirect to another (optionally specified) page after the logout.
                                                                                                                                                                                    - -

                                                                                                                                                                                    loginAs

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Login as the specified user. The method will not follow redirection, after the login, to any page.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $I->loginAs('user', 'password');
                                                                                                                                                                                    -  $I->amOnAdminPage('/');
                                                                                                                                                                                    -  $I->see('Dashboard');
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string $username - The user login name.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • string $password - The user password in plain text.
                                                                                                                                                                                    - -

                                                                                                                                                                                    loginAsAdmin

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Login as the administrator user using the credentials specified in the module configuration. The method will not follow redirection, after the login, to any page.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $I->loginAsAdmin();
                                                                                                                                                                                    -  $I->amOnAdminPage('/');
                                                                                                                                                                                    -  $I->see('Dashboard');
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    seeErrorMessage

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    In an administration screen look for an error admin notice. The check is class-based to decouple from internationalization. The method will not handle authentication and navigation the administration area. .notice.notice-error ones.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $I->loginAsAdmin()
                                                                                                                                                                                    -  $I->amOnAdminPage('/');
                                                                                                                                                                                    -  $I->seeErrorMessage('.my-plugin');
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string/string/\Codeception\Module\array $classes - A list of classes the notice should have other than the
                                                                                                                                                                                    - -

                                                                                                                                                                                    seeMessage

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    In an administration screen look for an admin notice. The check is class-based to decouple from internationalization. The method will not handle authentication and navigation the administration area.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $I->loginAsAdmin()
                                                                                                                                                                                    -  $I->amOnAdminPage('/');
                                                                                                                                                                                    -  $I->seeMessage('.missing-api-token.my-plugin');
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string/\Codeception\Module\array/string $classes - A list of classes the message should have in addition to the .notice one.
                                                                                                                                                                                    - -

                                                                                                                                                                                    seePluginActivated

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Assert a plugin is activated in the plugin administration screen. The method will not handle authentication and navigation to the plugin administration screen.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $I->loginAsAdmin();
                                                                                                                                                                                    -  $I->amOnPluginsPage();
                                                                                                                                                                                    -  $I->seePluginActivated('my-plugin');
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string $pluginSlug - The plugin slug, like "hello-dolly".
                                                                                                                                                                                    - -

                                                                                                                                                                                    seePluginDeactivated

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Assert a plugin is not activated in the plugins administration screen. The method will not handle authentication and navigation to the plugin administration screen.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $I->loginAsAdmin();
                                                                                                                                                                                    -  $I->amOnPluginsPage();
                                                                                                                                                                                    -  $I->seePluginDeactivated('my-plugin');
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string $pluginSlug - The plugin slug, like "hello-dolly".
                                                                                                                                                                                    - -

                                                                                                                                                                                    seePluginInstalled

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Assert a plugin is installed, no matter its activation status, in the plugin administration screen. The method will not handle authentication and navigation to the plugin administration screen.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $I->loginAsAdmin();
                                                                                                                                                                                    -  $I->amOnPluginsPage();
                                                                                                                                                                                    -  $I->seePluginInstalled('my-plugin');
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string $pluginSlug - The plugin slug, like "hello-dolly".
                                                                                                                                                                                    - -

                                                                                                                                                                                    seeWpDiePage

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Checks that the current page is one generated by the wp_die function. The method will try to identify the page based on the default WordPress die page HTML attributes.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $I->loginAs('user', 'password');
                                                                                                                                                                                    -  $I->amOnAdminPage('/forbidden');
                                                                                                                                                                                    -  $I->seeWpDiePage();
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    This class extends \Codeception\Module\PhpBrowser

                                                                                                                                                                                    -

                                                                                                                                                                                    This class implements \Codeception\Lib\Interfaces\MultiSession, \Codeception\Lib\Interfaces\Remote, \Codeception\Lib\Interfaces\Web, \Codeception\Lib\Interfaces\PageSourceSaver, \Codeception\Lib\Interfaces\ElementLocator, \Codeception\Lib\Interfaces\ConflictsWithModule

                                                                                                                                                                                    - - - - - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - -
                                                                                                                                                                                    - -
                                                                                                                                                                                    - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - - - - - - - \ No newline at end of file diff --git a/docs/public/v3/modules/WPCLI/index.html b/docs/public/v3/modules/WPCLI/index.html deleted file mode 100644 index 477c2c224..000000000 --- a/docs/public/v3/modules/WPCLI/index.html +++ /dev/null @@ -1,627 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - WPCLI module - wp-browser docs - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
                                                                                                                                                                                    - -
                                                                                                                                                                                    - - - - - - -
                                                                                                                                                                                    - - -
                                                                                                                                                                                    - -
                                                                                                                                                                                    - - - - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - - - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - - - - - -

                                                                                                                                                                                    WPCLI module

                                                                                                                                                                                    -

                                                                                                                                                                                    This module should be used in acceptance and functional tests to setup, or verify, tests pre and post conditions using WP-CLI commands.
                                                                                                                                                                                    -This module allows invoking WP-CLI commands, refer to the official site for more information.

                                                                                                                                                                                    -

                                                                                                                                                                                    The module will use its own version of WP-CLI, not the one installed in the machine running the tests!

                                                                                                                                                                                    -

                                                                                                                                                                                    By default, wp-browser will only include the wp-cli/wp-cli package; this package contains the basic files to run WP-CLI and does not contain all the commands that come with a typical wp-cli installation.
                                                                                                                                                                                    -If, in your tests, you require all the commands that usually come installed with WP-CLI, then you should require the wp-cli/wp-cli-bundle package as a development dependency of your project, see below.

                                                                                                                                                                                    -

                                                                                                                                                                                    Fixing "not a registered command" issue

                                                                                                                                                                                    -

                                                                                                                                                                                    To keep the conflicts at a manageable level, the wp-browser project does not include all the commands WP-CLI usually comes bundled with.
                                                                                                                                                                                    -Running, in the context of an automated test, a WP-CLI command that would work on your machine, e.g. wp plugin list --status=active, will not work on a default installation of wp-browser and you will get the following error message:

                                                                                                                                                                                    -
                                                                                                                                                                                    [ModuleException] WPCLI: wp-cli terminated with status [1] and output [Error: 'plugin' is not a registered wp command. See 'wp help' for available commands.]
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    To resolve the message just add the package you require as a development dependency or add the whole WP-CLI bundle:

                                                                                                                                                                                    -
                                                                                                                                                                                    composer require --dev wp-cli/wp-cli-bundle
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    The package will make all the default WP-CLI commands available to the WP-CLI version used in tests.

                                                                                                                                                                                    -

                                                                                                                                                                                    Module requirements for Codeception 4.0+

                                                                                                                                                                                    -

                                                                                                                                                                                    This module requires the codeception/module-cli Composer package to work when wp-browser is used with Codeception 4.0.

                                                                                                                                                                                    -

                                                                                                                                                                                    To install the package run:

                                                                                                                                                                                    -
                                                                                                                                                                                    composer require --dev codeception/module-cli:^1.0
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Detecting requests coming from this module

                                                                                                                                                                                    -

                                                                                                                                                                                    When it runs this module will set the WPBROWSER_HOST_REQUEST environment variable.
                                                                                                                                                                                    -You can detect and use that information to, as an example, use the correct database in your test site wp-config.php file:

                                                                                                                                                                                    -
                                                                                                                                                                                    <?php
                                                                                                                                                                                    -if ( 
                                                                                                                                                                                    -    // Custom header.
                                                                                                                                                                                    -    isset( $_SERVER['HTTP_X_TESTING'] )
                                                                                                                                                                                    -    // Custom user agent.
                                                                                                                                                                                    -    || ( isset( $_SERVER['HTTP_USER_AGENT'] ) && $_SERVER['HTTP_USER_AGENT'] === 'wp-browser' )
                                                                                                                                                                                    -    // The env var set by the WPClIr or WordPress modules.
                                                                                                                                                                                    -    || getenv( 'WPBROWSER_HOST_REQUEST' )
                                                                                                                                                                                    -) {
                                                                                                                                                                                    -    // Use the test database if the request comes from a test.
                                                                                                                                                                                    -    define( 'DB_NAME', 'wordpress_test' );
                                                                                                                                                                                    -} else {
                                                                                                                                                                                    -    // Else use the default one.
                                                                                                                                                                                    -    define( 'DB_NAME', 'wordpress' );
                                                                                                                                                                                    -}
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Configuration

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • path required - the absolute, or relative, path to the WordPress root folder. This will be mapped to the --path argument of the wp-cli binary.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • throw - defaults to true to throw an exception when a wp-cli command does not return an exit status of 0; if set to false then the exit status of the commands will be returned as is.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • timeout - defaults to 60 (seconds) to set each process execution timeout to a certain value; set to null, false or 0 to disable timeout completely.
                                                                                                                                                                                    • -
                                                                                                                                                                                    -

                                                                                                                                                                                    Additionally the module configuration will forward any configuration parameter to wp-cli as a flag or option. -In the example configuration below the allow-root flag and the some-option option will be passed to wp-cli directly and prepended to the command as global options.

                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Note: these extract configuration flags and options will be prepended to all commands executed by wp-cli!

                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Environment configuration

                                                                                                                                                                                    -

                                                                                                                                                                                    The wp-cli binary supports a set of environment variables to modify its behavior.

                                                                                                                                                                                    -

                                                                                                                                                                                    These environment variables can be set on the commands ran by the WPCLI module using the optional env array in the module configuration.
                                                                                                                                                                                    -The example configuration below shows all of them with some example values.
                                                                                                                                                                                    -Most of the times you won't need any of these, but they are there for more fine-grained control over the module operations.

                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    The module is not validating the environment variables in any way! Those values will be evaluated by wp-cli at runtime and might generate errors if not correctly configured.

                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Example configuration

                                                                                                                                                                                    -
                                                                                                                                                                                    modules:
                                                                                                                                                                                    -    enabled:
                                                                                                                                                                                    -        - WPCLI
                                                                                                                                                                                    -    config:
                                                                                                                                                                                    -        WPCLI:
                                                                                                                                                                                    -            path: /Users/Luca/Sites/wp
                                                                                                                                                                                    -            throw: true
                                                                                                                                                                                    -            timeout: 60
                                                                                                                                                                                    -            # This will be prepended to the command, `wp --allow-root <command>`.
                                                                                                                                                                                    -            allow-root: true
                                                                                                                                                                                    -            # This will be prepended to the command, `wp --some-option=some-value <command>`.
                                                                                                                                                                                    -            some-option: some-value
                                                                                                                                                                                    -            env:
                                                                                                                                                                                    -                # Any one of these, if provided, will be set as environment variable for the the cli command process. 
                                                                                                                                                                                    -                # See https://make.wordpress.org/cli/handbook/config/#environment-variables for information.
                                                                                                                                                                                    -                # Equivalent to `WP_CLI_STRICT_ARGS_MODE=1 wp <command>'.
                                                                                                                                                                                    -                strict-args: true
                                                                                                                                                                                    -                # Equivalent to `WP_CLI_CACHE_DIR=/tmp/wp-cli-cache wp <command>'.
                                                                                                                                                                                    -                cache-dir: '/tmp/wp-cli-cache'
                                                                                                                                                                                    -                # Equivalent to `WP_CLI_CONFIG_PATH=/app/public wp <command>'.
                                                                                                                                                                                    -                config-path: '/app/public'
                                                                                                                                                                                    -                # Equivalent to `WP_CLI_CUSTOM_SHELL=/bin/zsh wp <command>'.
                                                                                                                                                                                    -                custom-shell: '/bin/zsh'
                                                                                                                                                                                    -                # Equivalent to `WP_CLI_DISABLE_AUTO_CHECK_UPDATE=1 wp <command>'.
                                                                                                                                                                                    -                disable-auto-update: true
                                                                                                                                                                                    -                # Equivalent to `WP_CLI_PACKAGES_DIR=/wp-cli/packages wp <command>'.
                                                                                                                                                                                    -                packages-dir: '/wp-cli/packages'
                                                                                                                                                                                    -                # Equivalent to `WP_CLI_PHP=/usr/local/bin/php/7.2/php wp <command>'.
                                                                                                                                                                                    -                php: '/usr/local/bin/php/7.2/php'
                                                                                                                                                                                    -                # Equivalent to `WP_CLI_PHP_ARGS='foo=bar some=23' wp <command>'.
                                                                                                                                                                                    -                php-args: 'foo=bar some=23'
                                                                                                                                                                                    -
                                                                                                                                                                                    - - -

                                                                                                                                                                                    Public API

                                                                                                                                                                                    - - -

                                                                                                                                                                                    buildFullCommand

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Builds the full command to run including the PHP binary and the wp-cli boot file path.

                                                                                                                                                                                    - -
                                                                                                                                                                                    // This method is defined in the WithWpCli trait.
                                                                                                                                                                                    -  // Set the wp-cli path, `$this` is a test case.
                                                                                                                                                                                    -  $this->setUpWpCli( '/var/www/html' );
                                                                                                                                                                                    -  // Builds the full wp-cli command, including the `path` variable.
                                                                                                                                                                                    -  $fullCommand =  $this->buildFullCommand(['core', 'version']);
                                                                                                                                                                                    -  // The full command can then be used to run it with another process handler.
                                                                                                                                                                                    -  $wpCliProcess = new Process($fullCommand);
                                                                                                                                                                                    -  $wpCliProcess->run();
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • \Codeception\Module\array/string $command - The command to run.
                                                                                                                                                                                    - -

                                                                                                                                                                                    cli

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Executes a wp-cli command targeting the test WordPress installation. minus wp. For back-compatibility purposes you can still pass the commandline as a string, but the array format is the preferred and supported method.

                                                                                                                                                                                    - -
                                                                                                                                                                                    // Activate a plugin via wp-cli in the test WordPress site.
                                                                                                                                                                                    -  $I->cli(['plugin', 'activate', 'my-plugin']);
                                                                                                                                                                                    -  // Change a user password.
                                                                                                                                                                                    -  $I->cli(['user', 'update', 'luca', '--user_pass=newpassword']);
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string/string/\Codeception\Module\array $userCommand - The string of command and parameters as it would be passed to wp-cli
                                                                                                                                                                                    - -

                                                                                                                                                                                    cliToArray

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Returns the output of a wp-cli command as an array optionally allowing a callback to process the output. minus wp. For back-compatibility purposes you can still pass the commandline as a string, but the array format is the preferred and supported method.

                                                                                                                                                                                    - -
                                                                                                                                                                                    // Return a list of inactive themes, like ['twentyfourteen', 'twentyfifteen'].
                                                                                                                                                                                    -  $inactiveThemes = $I->cliToArray(['theme', 'list', '--status=inactive', '--field=name']);
                                                                                                                                                                                    -  // Get the list of installed plugins and only keep the ones starting with "foo".
                                                                                                                                                                                    -  $fooPlugins = $I->cliToArray(['plugin', 'list', '--field=name'], function($output){
                                                                                                                                                                                    -  return array_filter(explode(PHP_EOL, $output), function($name){
                                                                                                                                                                                    -  return strpos(trim($name), 'foo') === 0;
                                                                                                                                                                                    -  });
                                                                                                                                                                                    -  });
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string/string/\Codeception\Module\array $userCommand - The string of command and parameters as it would be passed to wp-cli
                                                                                                                                                                                    • -
                                                                                                                                                                                    • \callable $splitCallback - An optional callback function to split the results array.
                                                                                                                                                                                    - -

                                                                                                                                                                                    cliToString

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Returns the output of a wp-cli command as a string. minus wp. For back-compatibility purposes you can still pass the commandline as a string, but the array format is the preferred and supported method.

                                                                                                                                                                                    - -
                                                                                                                                                                                    // Return the current site administrator email, using string command format.
                                                                                                                                                                                    -  $adminEmail = $I->cliToString('option get admin_email');
                                                                                                                                                                                    -  // Get the list of active plugins in JSON format, two ways.
                                                                                                                                                                                    -  $activePlugins = $I->cliToString(['plugin', 'list','--status=active', '--format=json']);
                                                                                                                                                                                    -  $activePlugins = $I->cliToString(['option', 'get', 'active_plugins' ,'--format=json']);
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string/\Codeception\Module\array $userCommand - The string of command and parameters as it would be passed to wp-cli
                                                                                                                                                                                    - -

                                                                                                                                                                                    dontSeeInShellOutput

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Checks that output from last command doesn't contain text.

                                                                                                                                                                                    - -
                                                                                                                                                                                    // Return the current site administrator email, using string command format.
                                                                                                                                                                                    -  $I->cli('plugin list --status=active');
                                                                                                                                                                                    -  $I->dontSeeInShellOutput('my-inactive/plugin.php');
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string $text - The text to assert is not in the output.
                                                                                                                                                                                    - -

                                                                                                                                                                                    seeInShellOutput

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Checks that output from last command contains text.

                                                                                                                                                                                    - -
                                                                                                                                                                                    // Return the current site administrator email, using string command format.
                                                                                                                                                                                    -  $I->cli('option get admin_email');
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string $text - The text to assert is in the output.
                                                                                                                                                                                    - -

                                                                                                                                                                                    seeResultCodeIs

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Checks the result code from the last command.

                                                                                                                                                                                    - -
                                                                                                                                                                                    // Return the current site administrator email, using string command format.
                                                                                                                                                                                    -  $I->cli('option get admin_email');
                                                                                                                                                                                    -  $I->seeResultCodeIs(0);
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • int $code - The desired result code.
                                                                                                                                                                                    - -

                                                                                                                                                                                    seeResultCodeIsNot

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Checks the result code from the last command.

                                                                                                                                                                                    - -
                                                                                                                                                                                    // Return the current site administrator email, using string command format.
                                                                                                                                                                                    -  $I->cli('invalid command');
                                                                                                                                                                                    -  $I->seeResultCodeIsNot(0);
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • int $code - The result code the command should not have exited with.
                                                                                                                                                                                    - -

                                                                                                                                                                                    seeShellOutputMatches

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Checks that output from the last command matches a given regular expression.

                                                                                                                                                                                    - -
                                                                                                                                                                                    // Return the current site administrator email, using string command format.
                                                                                                                                                                                    -  $I->cli('option get admin_email');
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string $regex - The regex pattern, including delimiters, to assert the output matches against.
                                                                                                                                                                                    - -

                                                                                                                                                                                    This class extends \Codeception\Module

                                                                                                                                                                                    - - - - - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - -
                                                                                                                                                                                    - -
                                                                                                                                                                                    - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - - - - - - - \ No newline at end of file diff --git a/docs/public/v3/modules/WPDb/index.html b/docs/public/v3/modules/WPDb/index.html deleted file mode 100644 index 30198a87e..000000000 --- a/docs/public/v3/modules/WPDb/index.html +++ /dev/null @@ -1,2893 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - WPDb module - wp-browser docs - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
                                                                                                                                                                                    - -
                                                                                                                                                                                    - - - - - - -
                                                                                                                                                                                    - - -
                                                                                                                                                                                    - -
                                                                                                                                                                                    - - - - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - - - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - - - - - -

                                                                                                                                                                                    WPDb module

                                                                                                                                                                                    -

                                                                                                                                                                                    This module should be used in acceptance and functional tests, see levels of testing for more information.
                                                                                                                                                                                    -This module extends the Db module adding WordPress-specific configuration parameters and methods.
                                                                                                                                                                                    -The module provides methods to read, write and update the WordPress database directly, without relying on WordPress methods, using WordPress functions or triggering WordPress filters.

                                                                                                                                                                                    -

                                                                                                                                                                                    Module requirements for Codeception 4.0+

                                                                                                                                                                                    -

                                                                                                                                                                                    This module requires the codeception/module-db Composer package to work when wp-browser is used with Codeception 4.0.

                                                                                                                                                                                    -

                                                                                                                                                                                    To install the package run:

                                                                                                                                                                                    -
                                                                                                                                                                                    composer require --dev codeception/module-db:^1.0
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Backup your content

                                                                                                                                                                                    -

                                                                                                                                                                                    This module, like the Codeception Db one it extends, by default will load a database dump in the database it's using.
                                                                                                                                                                                    -This means that the database contents will be replaced by the dump contents on each run of a suite using the module.
                                                                                                                                                                                    -You can set the populate and cleanup parameters to false to prevent this default behavior but it's usually not what you need in an automated test.
                                                                                                                                                                                    -Make a backup of any database you're using in tests that contains any information you care about before you run any test!

                                                                                                                                                                                    -

                                                                                                                                                                                    Change the database used depending on whether you're running tests or not

                                                                                                                                                                                    -

                                                                                                                                                                                    The chore of having to plug different databases, or backup them, depending on whether you're manually testing the site or automatically testing can be mitigated switching them automatically depending on the browser user agent or request headers.
                                                                                                                                                                                    -This module was born to be used in acceptance and functional tests (see levels of testing for more information) and will often be coupled with modules like the WPBrowser one or the WPWebDriver one.
                                                                                                                                                                                    -Depending on which of the two modules is being used in the suite there are different ways to automate the "database switching".

                                                                                                                                                                                    -

                                                                                                                                                                                    Automatically changing database based on the browser user agent

                                                                                                                                                                                    -

                                                                                                                                                                                    If you would like to automate the "switching above" below you will find an example setup.
                                                                                                                                                                                    -Update the test site wp-config.php file from this:

                                                                                                                                                                                    -
                                                                                                                                                                                    define( 'DB_NAME', 'wordpress' );
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    to this:

                                                                                                                                                                                    -
                                                                                                                                                                                    <?php
                                                                                                                                                                                    -if ( 
                                                                                                                                                                                    -    // Custom header.
                                                                                                                                                                                    -    isset( $_SERVER['HTTP_X_TESTING'] )
                                                                                                                                                                                    -    // Custom user agent.
                                                                                                                                                                                    -    || ( isset( $_SERVER['HTTP_USER_AGENT'] ) && $_SERVER['HTTP_USER_AGENT'] === 'wp-browser' )
                                                                                                                                                                                    -    // The env var set by the WPClIr or WordPress modules.
                                                                                                                                                                                    -    || getenv( 'WPBROWSER_HOST_REQUEST' )
                                                                                                                                                                                    -) {
                                                                                                                                                                                    -    // Use the test database if the request comes from a test.
                                                                                                                                                                                    -    define( 'DB_NAME', 'wordpress_test' );
                                                                                                                                                                                    -} else {
                                                                                                                                                                                    -    // Else use the default one.
                                                                                                                                                                                    -    define( 'DB_NAME', 'wordpress' );
                                                                                                                                                                                    -}
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    If you're using the WPWebDriver module set the user agent in the browser, in this example I'm setting the user agent in Chromedriver:

                                                                                                                                                                                    -
                                                                                                                                                                                    class_name: AcceptanceTester
                                                                                                                                                                                    -modules:
                                                                                                                                                                                    -    enabled:
                                                                                                                                                                                    -        - \Helper\Acceptance
                                                                                                                                                                                    -        - WPDb
                                                                                                                                                                                    -        - WPWebDriver
                                                                                                                                                                                    -    config:
                                                                                                                                                                                    -        WPDb:
                                                                                                                                                                                    -            dsn: 'mysql:host=%WP_DB_HOST%;dbname=%WP_DB_NAME%'
                                                                                                                                                                                    -            user: %WP_DB_USER%
                                                                                                                                                                                    -            password: %WP_DB_PASSWORD%
                                                                                                                                                                                    -            dump: tests/_data/dump.sql
                                                                                                                                                                                    -            populate: true
                                                                                                                                                                                    -            cleanup: false
                                                                                                                                                                                    -            url: '%WP_URL%'
                                                                                                                                                                                    -            tablePrefix: %WP_TABLE_PREFIX%
                                                                                                                                                                                    -            urlReplacement: true
                                                                                                                                                                                    -        WPWebDriver:
                                                                                                                                                                                    -            url: '%WP_URL%'
                                                                                                                                                                                    -            adminUsername: '%WP_ADMIN_USERNAME%'
                                                                                                                                                                                    -            adminPassword: '%WP_ADMIN_PASSWORD%'
                                                                                                                                                                                    -            adminPath: '%WP_ADMIN_PATH%'
                                                                                                                                                                                    -            browser: chrome
                                                                                                                                                                                    -            host: localhost
                                                                                                                                                                                    -            port: 4444
                                                                                                                                                                                    -            window_size: false
                                                                                                                                                                                    -            wait: 5
                                                                                                                                                                                    -            capabilities:
                                                                                                                                                                                    -                # Used in more recent releases of Selenium.
                                                                                                                                                                                    -                "goog:chromeOptions":
                                                                                                                                                                                    -                    args: ["--no-sandbox", "--headless", "--disable-gpu", "--user-agent=wp-browser"]
                                                                                                                                                                                    -                # Support the old format for back-compatibility purposes. 
                                                                                                                                                                                    -                "chromeOptions":
                                                                                                                                                                                    -                    args: ["--no-sandbox", "--headless", "--disable-gpu", "--user-agent=wp-browser"]
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    If you're using the WPBrowser module send a specific header in the context of test requests:

                                                                                                                                                                                    -
                                                                                                                                                                                    class_name: AcceptanceTester
                                                                                                                                                                                    -modules:
                                                                                                                                                                                    -    enabled:
                                                                                                                                                                                    -        - \Helper\Acceptance
                                                                                                                                                                                    -        - WPDb
                                                                                                                                                                                    -        - WPBrowser
                                                                                                                                                                                    -    config:
                                                                                                                                                                                    -        WPDb:
                                                                                                                                                                                    -              dsn: 'mysql:host=%DB_HOST%;dbname=%WP_DB_NAME%'
                                                                                                                                                                                    -              user: %WP_DB_USER%
                                                                                                                                                                                    -              password: %WP_DB_PASSWORD%
                                                                                                                                                                                    -              dump: 'tests/_data/dump.sql'
                                                                                                                                                                                    -              populate: true
                                                                                                                                                                                    -              cleanup: true
                                                                                                                                                                                    -              reconnect: false
                                                                                                                                                                                    -              url: '%WP_URL%'
                                                                                                                                                                                    -              tablePrefix: 'wp_'
                                                                                                                                                                                    -        WPBrowser:
                                                                                                                                                                                    -              url: '%WP_URL%'
                                                                                                                                                                                    -              adminUsername: 'admin'
                                                                                                                                                                                    -              adminPassword: 'admin'
                                                                                                                                                                                    -              adminPath: '/wp-admin'
                                                                                                                                                                                    -              headers: 
                                                                                                                                                                                    -                X-Testing: 'wp-browser'
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Configuration

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • dsn required - the database POD DSN connection details; read more on PHP PDO documentation. If the database is accessible (as is the case on the latest version of [Local by Flywheel][http://localwp.com]) via unix socket, then the string to insert here should look like this mysql:unix_socket=/path/to/the/mysql.sock;dbname=wordpress.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • user required - the database user.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • password required - the database password.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • url required - the full URL, including the HTTP scheme, of the website whose database is being accessed. WordPress uses hard-codece URLs in the database, that URL will be set by this module when applying the SQL dump file during population or cleanup.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • dump required - defaults to null; sets the path, relative to the project root folder, or absolute to the SQL dump file that will be used to set the tests initial database fixture. If set to null then the populate, cleanup and populator parameters will be ignored.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • populate - defaults to true to empty the target database and import the SQL dump(s) specified in the dump argument before the test suite is started.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • cleanup - defaults to true empty the target database and import the SQL dump(s) specified in the dump argument before each test.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • urlReplacement - defaults to true to replace, while using the built-in, PHP-based, dump import solution the hard-coded WordPress URL in the database with the specified one.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • originalUrl - specifies the original URL hard-coded into the version controlled SQL dump files. This can help prevent some URL replacement issues when the urlReplacement configuration parameter is set to true.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • populator - defaults to null, if set to an executable shell command then that command will be used to populate the database in place of the built-in PHP solution; URL replacement will not apply in this case. Read more about this on Codeception documentation.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • reconnect - defaults to true to force the module to reconnect to the database before each test in place of only connecting at the start of the tests.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • waitlock - defaults to 10; wait lock (in seconds) that the database session should use for DDL statements.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • tablePrefix - defaults to wp_; sets the prefix of the tables that the module will manipulate.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • letAdminEmailVerification - defaults to an empty value to remove the Administrator Email Verification screen introduced in WordPress 5.3. Set to true to not remove the screen and show it when an administrator user first logs in.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • letCron - defaults to an empty value to avoid wp-cron from being spawned during tests. Setting this to true will let wp-cron requests to fire during tests.
                                                                                                                                                                                    • -
                                                                                                                                                                                    -

                                                                                                                                                                                    Example configuration

                                                                                                                                                                                    -
                                                                                                                                                                                    modules:
                                                                                                                                                                                    -  enabled:
                                                                                                                                                                                    -      - WPDb
                                                                                                                                                                                    -  config:
                                                                                                                                                                                    -      WPDb:
                                                                                                                                                                                    -          dsn: 'mysql:host=localhost;dbname=wordpress'
                                                                                                                                                                                    -          user: 'root'
                                                                                                                                                                                    -          password: 'password'
                                                                                                                                                                                    -          dump: 'tests/_data/dump.sql'
                                                                                                                                                                                    -          populate: true
                                                                                                                                                                                    -          cleanup: true
                                                                                                                                                                                    -          waitlock: 10
                                                                                                                                                                                    -          url: 'http://wordpress.localhost'
                                                                                                                                                                                    -          urlReplacement: true
                                                                                                                                                                                    -          tablePrefix: 'wp_'
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Using the module with the WPLoader one

                                                                                                                                                                                    -

                                                                                                                                                                                    This module is often used in conjunction with the WPLoader one to use WordPress-defined functions, classes and methods in acceptance or functional tests.
                                                                                                                                                                                    -The WPLoader module should be set to only load WordPress and this module should be listed, in the modules.enabled section of the suite configuration file before the WPLoader one:

                                                                                                                                                                                    -
                                                                                                                                                                                    modules:
                                                                                                                                                                                    -  enabled:
                                                                                                                                                                                    -      - WPDb # this before...
                                                                                                                                                                                    -      - WPLoader # ...this one.
                                                                                                                                                                                    -  config:
                                                                                                                                                                                    -      WPDb:
                                                                                                                                                                                    -        # ...
                                                                                                                                                                                    -      WPLoader:
                                                                                                                                                                                    -        loadOnly: true
                                                                                                                                                                                    -        # ... 
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    This will avoid issues where the WPLoader module could exit, terminating the test run, due to an inconsistent database state.

                                                                                                                                                                                    - - -

                                                                                                                                                                                    Public API

                                                                                                                                                                                    - - -

                                                                                                                                                                                    countRowsInDatabase

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Returns the number of table rows matching a criteria.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $I->haveManyPostsInDatabase(3, ['post_status' => 'draft' ]);
                                                                                                                                                                                    -  $I->haveManyPostsInDatabase(3, ['post_status' => 'private' ]);
                                                                                                                                                                                    -  // Make sure there are now the expected number of draft posts.
                                                                                                                                                                                    -  $postsTable = $I->grabPostsTableName();
                                                                                                                                                                                    -  $draftsCount = $I->countRowsInDatabase($postsTable, ['post_status' => 'draft']);
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string $table - The table to count the rows in.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • array/\Codeception\Module\array/array $criteria - Search criteria, if empty all table rows will be counted.
                                                                                                                                                                                    - -

                                                                                                                                                                                    dontHaveAttachmentFilesInDatabase

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Removes all the files attached with an attachment post, it will not remove the database entries. Requires the WPFilesystem module to be loaded in the suite.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $posts = $I->grabPostsTableName();
                                                                                                                                                                                    -  $attachmentIds = $I->grabColumnFromDatabase($posts, 'ID', ['post_type' => 'attachment']);
                                                                                                                                                                                    -  // This will only remove the files, not the database entries.
                                                                                                                                                                                    -  $I->dontHaveAttachmentFilesInDatabase($attachmentIds);
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • \Codeception\Module\array/int $attachmentIds - An attachment post ID or an array of attachment post IDs.
                                                                                                                                                                                    - -

                                                                                                                                                                                    dontHaveAttachmentInDatabase

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Removes an attachment from the posts table. table. the suite.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $postmeta = $I->grabpostmetatablename();
                                                                                                                                                                                    -  $thumbnailId = $I->grabFromDatabase($postmeta, 'meta_value', [
                                                                                                                                                                                    -  'post_id' => $id,
                                                                                                                                                                                    -  'meta_key'=>'thumbnail_id'
                                                                                                                                                                                    -  ]);
                                                                                                                                                                                    -  // Remove only the database entry (including postmeta) but not the files.
                                                                                                                                                                                    -  $I->dontHaveAttachmentInDatabase($thumbnailId);
                                                                                                                                                                                    -  // Remove the database entry (including postmeta) and the files.
                                                                                                                                                                                    -  $I->dontHaveAttachmentInDatabase($thumbnailId, true, true);
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • \Codeception\Module\array/array $criteria - An array of search criteria to find the attachment post in the posts
                                                                                                                                                                                    • -
                                                                                                                                                                                    • bool $purgeMeta - If set to true then the meta for the attachment will be purged too.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • bool $removeFiles - Remove all files too, requires the WPFilesystem module to be loaded in
                                                                                                                                                                                    - -

                                                                                                                                                                                    dontHaveBlogInDatabase

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Removes one ore more blogs from the database.

                                                                                                                                                                                    - -
                                                                                                                                                                                    // Remove the blog, all its tables and files.
                                                                                                                                                                                    -  $I->dontHaveBlogInDatabase(['path' => 'test/one']);
                                                                                                                                                                                    -  // Remove the blog entry, not the tables though.
                                                                                                                                                                                    -  $I->dontHaveBlogInDatabase(['blog_id' => $blogId]);
                                                                                                                                                                                    -  // Remove multiple blogs.
                                                                                                                                                                                    -  $I->dontHaveBlogInDatabase(['domain' => 'test']);
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • \Codeception\Module\array/array $criteria - An array of search criteria to find the blog rows in the blogs table.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • bool $removeTables - Remove the blog tables.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • bool $removeUploads - Remove the blog uploads; requires the WPFilesystem module.
                                                                                                                                                                                    - -

                                                                                                                                                                                    dontHaveCommentInDatabase

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Removes an entry from the comments table.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $I->dontHaveCommentInDatabase(['comment_post_ID' => 23, 'comment_url' => 'http://example.copm']);
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • \Codeception\Module\array/array $criteria - An array of search criteria.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • bool $purgeMeta - If set to true then the meta for the comment will be purged too.
                                                                                                                                                                                    - -

                                                                                                                                                                                    dontHaveCommentMetaInDatabase

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Removes a post comment meta from the database

                                                                                                                                                                                    - -
                                                                                                                                                                                    // Remove all meta for the comment with an ID of 23.
                                                                                                                                                                                    -  $I->dontHaveCommentMetaInDatabase(['comment_id' => 23]);
                                                                                                                                                                                    -  // Remove the `count` comment meta for the comment with an ID of 23.
                                                                                                                                                                                    -  $I->dontHaveCommentMetaInDatabase(['comment_id' => 23, 'meta_key' => 'count']);
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • \Codeception\Module\array/array $criteria - An array of search criteria.
                                                                                                                                                                                    - -

                                                                                                                                                                                    dontHaveInDatabase

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Deletes a database entry. criteria.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $I->dontHaveInDatabase('custom_table', ['book_ID' => 23, 'book_genre' => 'fiction']);
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string $table - The table name.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • \Codeception\Module\array/array $criteria - An associative array of the column names and values to use as deletion
                                                                                                                                                                                    - -

                                                                                                                                                                                    dontHaveLinkInDatabase

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Removes a link from the database.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $I->dontHaveLinkInDatabase(['link_url' => 'http://example.com']);
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • \Codeception\Module\array/array $criteria - An array of search criteria.
                                                                                                                                                                                    - -

                                                                                                                                                                                    dontHaveOptionInDatabase

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Removes an entry from the options table.

                                                                                                                                                                                    - -
                                                                                                                                                                                    // Remove the `foo` option.
                                                                                                                                                                                    -  $I->dontHaveOptionInDatabase('foo');
                                                                                                                                                                                    -  // Remove the 'bar' option only if it has the `baz` value.
                                                                                                                                                                                    -  $I->dontHaveOptionInDatabase('bar', 'baz');
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string $key - The option name.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • mixed/null $value - If set the option will only be removed if its value matches the passed one.
                                                                                                                                                                                    - -

                                                                                                                                                                                    dontHavePostInDatabase

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Removes an entry from the posts table.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $posts = $I->haveManyPostsInDatabase(3, ['post_title' => 'Test {{n}}']);
                                                                                                                                                                                    -  $I->dontHavePostInDatabase(['post_title' => 'Test 2']);
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • \Codeception\Module\array/array $criteria - An array of search criteria.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • bool $purgeMeta - If set to true then the meta for the post will be purged too.
                                                                                                                                                                                    - -

                                                                                                                                                                                    dontHavePostMetaInDatabase

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Removes an entry from the postmeta table.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $postId = $I->havePostInDatabase(['meta_input' => ['rating' => 23]]);
                                                                                                                                                                                    -  $I->dontHavePostMetaInDatabase(['post_id' => $postId, 'meta_key' => 'rating']);
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • \Codeception\Module\array/array $criteria - An array of search criteria.
                                                                                                                                                                                    - -

                                                                                                                                                                                    dontHavePostThumbnailInDatabase

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Remove the thumbnail (featured image) from a post, if any. Please note: the method will NOT remove the attachment post, post meta and file.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $attachmentId = $I->haveAttachmentInDatabase(codecept_data_dir('some-image.png'));
                                                                                                                                                                                    -  $postId = $I->havePostInDatabase();
                                                                                                                                                                                    -  // Attach the thumbnail to the post.
                                                                                                                                                                                    -  $I->havePostThumbnailInDatabase($postId, $attachmentId);
                                                                                                                                                                                    -  // Remove the thumbnail from the post.
                                                                                                                                                                                    -  $I->dontHavePostThumbnailInDatabase($postId);
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • int $postId - The post ID to remove the thumbnail (featured image) from.
                                                                                                                                                                                    - -

                                                                                                                                                                                    dontHaveSiteOptionInDatabase

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Removes a site option from the database.

                                                                                                                                                                                    - -
                                                                                                                                                                                    // Remove the `foo_count` option.
                                                                                                                                                                                    -  $I->dontHaveSiteOptionInDatabase('foo_count');
                                                                                                                                                                                    -  // Remove the `foo_count` option only if its value is `23`.
                                                                                                                                                                                    -  $I->dontHaveSiteOptionInDatabase('foo_count', 23);
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string $key - The option name.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • mixed/null $value - If set the option will only be removed it its value matches the specified one.
                                                                                                                                                                                    - -

                                                                                                                                                                                    dontHaveSiteTransientInDatabase

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Removes a site transient from the database.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $I->dontHaveSiteTransientInDatabase(['my_plugin_site_buffer']);
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string $key - The name of the transient to delete.
                                                                                                                                                                                    - -

                                                                                                                                                                                    dontHaveTableInDatabase

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Removes a table from the database. The case where a table does not exist is handled without raising an error.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $ordersTable = $I->grabPrefixedTableNameFor('orders');
                                                                                                                                                                                    -  $I->dontHaveTableInDatabase($ordersTable);
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string $fullTableName - The full table name, including the table prefix.
                                                                                                                                                                                    - -

                                                                                                                                                                                    dontHaveTermInDatabase

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Removes a term from the database.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $I->dontHaveTermInDatabase(['name' => 'romance']);
                                                                                                                                                                                    -  $I->dontHaveTermInDatabase(['slug' => 'genre--romance']);
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • \Codeception\Module\array/array $criteria - An array of search criteria.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • bool $purgeMeta - Whether the terms meta should be purged along side with the meta or not.
                                                                                                                                                                                    - -

                                                                                                                                                                                    dontHaveTermMetaInDatabase

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Removes a term meta from the database.

                                                                                                                                                                                    - -
                                                                                                                                                                                    // Remove the "karma" key.
                                                                                                                                                                                    -  $I->dontHaveTermMetaInDatabase(['term_id' => $termId, 'meta_key' => 'karma']);
                                                                                                                                                                                    -  // Remove all meta for the term.
                                                                                                                                                                                    -  $I->dontHaveTermMetaInDatabase(['term_id' => $termId]);
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • \Codeception\Module\array/array $criteria - An array of search criteria.
                                                                                                                                                                                    - -

                                                                                                                                                                                    dontHaveTermRelationshipInDatabase

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Removes an entry from the term_relationships table.

                                                                                                                                                                                    - -
                                                                                                                                                                                    // Remove the relation between a post and a category.
                                                                                                                                                                                    -  $I->dontHaveTermRelationshipInDatabase(['object_id' => $postId, 'term_taxonomy_id' => $ttaxId]);
                                                                                                                                                                                    -  // Remove all terms for a post.
                                                                                                                                                                                    -  $I->dontHaveTermMetaInDatabase(['object_id' => $postId]);
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • \Codeception\Module\array/array $criteria - An array of search criteria.
                                                                                                                                                                                    - -

                                                                                                                                                                                    dontHaveTermTaxonomyInDatabase

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Removes an entry from the term_taxonomy table.

                                                                                                                                                                                    - -
                                                                                                                                                                                    // Remove a specific term from the genre taxonomy.
                                                                                                                                                                                    -  $I->dontHaveTermTaxonomyInDatabase(['term_id' => $postId, 'taxonomy' => 'genre']);
                                                                                                                                                                                    -  // Remove all terms for a taxonomy.
                                                                                                                                                                                    -  $I->dontHaveTermTaxonomyInDatabase(['taxonomy' => 'genre']);
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • \Codeception\Module\array/array $criteria - An array of search criteria.
                                                                                                                                                                                    - -

                                                                                                                                                                                    dontHaveTransientInDatabase

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Removes a transient from the database.

                                                                                                                                                                                    - -
                                                                                                                                                                                    // Removes the `tweets` transient from the database, if set.
                                                                                                                                                                                    -  $I->dontHaveTransientInDatabase('tweets');
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string $transient - The name of the transient to delete.
                                                                                                                                                                                    - -

                                                                                                                                                                                    dontHaveUserInDatabase

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Removes a user from the database.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $bob = $I->haveUserInDatabase('bob');
                                                                                                                                                                                    -  $alice = $I->haveUserInDatabase('alice');
                                                                                                                                                                                    -  // Remove Bob's user and meta.
                                                                                                                                                                                    -  $I->dontHaveUserInDatabase('bob');
                                                                                                                                                                                    -  // Remove Alice's user but not meta.
                                                                                                                                                                                    -  $I->dontHaveUserInDatabase($alice);
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • int/string $userIdOrLogin - The user ID or login name.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • bool $purgeMeta - Whether the user meta should be purged alongside the user or not.
                                                                                                                                                                                    - -

                                                                                                                                                                                    dontHaveUserInDatabaseWithEmail

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Removes a user(s) from the database using the user email address.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $luca = $I->haveUserInDatabase('luca', 'editor', ['user_email' => 'luca@example.org']);
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string $userEmail - The email of the user to remove.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • bool $purgeMeta - Whether the user meta should be purged alongside the user or not.
                                                                                                                                                                                    - -

                                                                                                                                                                                    dontHaveUserMetaInDatabase

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Removes an entry from the usermeta table.

                                                                                                                                                                                    - -
                                                                                                                                                                                    // Remove the `karma` user meta for a user.
                                                                                                                                                                                    -  $I->dontHaveUserMetaInDatabase(['user_id' => 23, 'meta_key' => 'karma']);
                                                                                                                                                                                    -  // Remove all the user meta for a user.
                                                                                                                                                                                    -  $I->dontHaveUserMetaInDatabase(['user_id' => 23]);
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • \Codeception\Module\array/array $criteria - An array of search criteria.
                                                                                                                                                                                    - -

                                                                                                                                                                                    dontSeeAttachmentInDatabase

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Checks that an attachment is not in the database.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $url = 'https://example.org/images/foo.png';
                                                                                                                                                                                    -  $I->dontSeeAttachmentInDatabase(['guid' => $url]);
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • \Codeception\Module\array/array $criteria - An array of search criteria.
                                                                                                                                                                                    - -

                                                                                                                                                                                    dontSeeBlogInDatabase

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Checks that a row is not present in the blogs table.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $I->haveManyBlogsInDatabase(2, ['path' => 'test-{{n}}'], false)
                                                                                                                                                                                    -  $I->dontSeeBlogInDatabase(['path' => '/test-3/'])
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • \Codeception\Module\array/array $criteria - An array of search criteria.
                                                                                                                                                                                    - -

                                                                                                                                                                                    dontSeeCommentInDatabase

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Checks that a comment is not in the database. Will look up the "comments" table.

                                                                                                                                                                                    - -
                                                                                                                                                                                    // Checks for one comment.
                                                                                                                                                                                    -  $I->dontSeeCommentInDatabase(['comment_ID' => 23]);
                                                                                                                                                                                    -  // Checks for comments from a user.
                                                                                                                                                                                    -  $I->dontSeeCommentInDatabase(['user_id' => 89]);
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • \Codeception\Module\array/array $criteria - The search criteria.
                                                                                                                                                                                    - -

                                                                                                                                                                                    dontSeeCommentMetaInDatabase

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Checks that a comment meta value is not in the database. Will look up the "commentmeta" table.

                                                                                                                                                                                    - -
                                                                                                                                                                                    // Delete a comment `karma` meta.
                                                                                                                                                                                    -  $I->dontSeeCommentMetaInDatabase(['comment_id' => 23, 'meta_key' => 'karma']);
                                                                                                                                                                                    -  // Delete all meta for a comment.
                                                                                                                                                                                    -  $I->dontSeeCommentMetaInDatabase(['comment_id' => 23]);
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • \Codeception\Module\array/array $criteria - An array of search criteria.
                                                                                                                                                                                    - -

                                                                                                                                                                                    dontSeeLinkInDatabase

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Checks that a link is not in the links database table.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $I->dontSeeLinkInDatabase(['link_url' => 'http://example.com']);
                                                                                                                                                                                    -  $I->dontSeeLinkInDatabase(['link_url' => 'http://example.com', 'link_name' => 'example']);
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • \Codeception\Module\array/array $criteria - An array of search criteria.
                                                                                                                                                                                    - -

                                                                                                                                                                                    dontSeeOptionInDatabase

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Checks that an option is not in the database for the current blog. If the value is an object or an array then the serialized option will be checked.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $I->dontHaveOptionInDatabase('posts_per_page');
                                                                                                                                                                                    -  $I->dontSeeOptionInDatabase('posts_per_page');
                                                                                                                                                                                    -  $I->dontSeeOptionInDatabase('posts_per_page', 23);
                                                                                                                                                                                    -  $I->dontSeeOptionInDatabase(['option_name' => 'posts_per_page']);
                                                                                                                                                                                    -  $I->dontSeeOptionInDatabase(['option_name' => 'posts_per_page', 'option_value' => 23]);
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • \Codeception\Module\array/string $criteriaOrName - An array of search criteria or the option name.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • mixed/null $value - The optional value to try and match, only used if the option name is provided.
                                                                                                                                                                                    - -

                                                                                                                                                                                    dontSeePageInDatabase

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Checks that a page is not in the database.

                                                                                                                                                                                    - -
                                                                                                                                                                                    // Assert a page with an ID does not exist.
                                                                                                                                                                                    -  $I->dontSeePageInDatabase(['ID' => 23]);
                                                                                                                                                                                    -  // Assert a page with a slug and ID.
                                                                                                                                                                                    -  $I->dontSeePageInDatabase(['post_name' => 'test', 'ID' => 23]);
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • \Codeception\Module\array/array $criteria - An array of search criteria.
                                                                                                                                                                                    - -

                                                                                                                                                                                    dontSeePostInDatabase

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Checks that a post is not in the database.

                                                                                                                                                                                    - -
                                                                                                                                                                                    // Asserts a post with title 'Test' is not in the database.
                                                                                                                                                                                    -  $I->dontSeePostInDatabase(['post_title' => 'Test']);
                                                                                                                                                                                    -  // Asserts a post with title 'Test' and content 'Test content' is not in the database.
                                                                                                                                                                                    -  $I->dontSeePostInDatabase(['post_title' => 'Test', 'post_content' => 'Test content']);
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • \Codeception\Module\array/array $criteria - An array of search criteria.
                                                                                                                                                                                    - -

                                                                                                                                                                                    dontSeePostMetaInDatabase

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Checks that a post meta value does not exist. If the meta value is an object or an array then the check will be made on its serialized version.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $postId = $I->havePostInDatabase(['meta_input' => ['foo' => 'bar']]);
                                                                                                                                                                                    -  $I->dontSeePostMetaInDatabase(['post_id' => $postId, 'meta_key' => 'woot']);
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • \Codeception\Module\array/array $criteria - An array of search criteria.
                                                                                                                                                                                    - -

                                                                                                                                                                                    dontSeePostWithTermInDatabase

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Checks that a post to term relation does not exist in the database. The method will check the "term_relationships" table.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $fiction = $I->haveTermInDatabase('fiction', 'genre');
                                                                                                                                                                                    -  $nonFiction = $I->haveTermInDatabase('non-fiction', 'genre');
                                                                                                                                                                                    -  $postId = $I->havePostInDatabase(['tax_input' => ['genre' => ['fiction']]]);
                                                                                                                                                                                    -  $I->dontSeePostWithTermInDatabase($postId, $nonFiction['term_taxonomy_id], );
                                                                                                                                                                                    -  passed this parameter will be interpreted as a `term_id`, else as a
                                                                                                                                                                                    -  the
                                                                                                                                                                                    -  term order.
                                                                                                                                                                                    -  to build a `taxonomy_term_id` from the `term_id`.
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • int $post_id - The post ID.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • int $term_taxonomy_id - The term term_id or term_taxonomy_id; if the $taxonomy argument is
                                                                                                                                                                                    • -
                                                                                                                                                                                    • int/null $term_order - The order the term applies to the post, defaults to null to not use
                                                                                                                                                                                    • -
                                                                                                                                                                                    • string/null $taxonomy - The taxonomy the term_id is for; if passed this parameter will be used
                                                                                                                                                                                    - -

                                                                                                                                                                                    dontSeeSiteOptionInDatabase

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Checks that a site option is not in the database.

                                                                                                                                                                                    - -
                                                                                                                                                                                    // Check that the option is not set in the database.
                                                                                                                                                                                    -  $I->dontSeeSiteOptionInDatabase('foo_count');
                                                                                                                                                                                    -  // Check that the option is not set with a specific value.
                                                                                                                                                                                    -  $I->dontSeeSiteOptionInDatabase('foo_count', 23);
                                                                                                                                                                                    -  $I->dontSeeSiteOptionInDatabase(['option_name => 'foo_count', 'option_value' => 23]);
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • \Codeception\Module\array/string $criteriaOrName - An array of search criteria or the option name.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • mixed/null $value - The optional value to try and match, only used if the option name is provided.
                                                                                                                                                                                    - -

                                                                                                                                                                                    dontSeeTableInDatabase

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Checks that a table is not in the database.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $options = $I->grabPrefixedTableNameFor('options');
                                                                                                                                                                                    -  $I->dontHaveTableInDatabase($options)
                                                                                                                                                                                    -  $I->dontSeeTableInDatabase($options);
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string $table - The full table name, including the table prefix.
                                                                                                                                                                                    - -

                                                                                                                                                                                    dontSeeTermInDatabase

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Makes sure a term is not in the database. Looks up both the terms table and the term_taxonomy tables. and the term_taxonomy tables.

                                                                                                                                                                                    - -
                                                                                                                                                                                    // Asserts a 'fiction' term is not in the database.
                                                                                                                                                                                    -  $I->dontSeeTermInDatabase(['name' => 'fiction']);
                                                                                                                                                                                    -  // Asserts a 'fiction' term with slug 'genre--fiction' is not in the database.
                                                                                                                                                                                    -  $I->dontSeeTermInDatabase(['name' => 'fiction', 'slug' => 'genre--fiction']);
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • \Codeception\Module\array/array $criteria - An array of criteria to search for the term, can be columns from the terms
                                                                                                                                                                                    - -

                                                                                                                                                                                    dontSeeTermMetaInDatabase

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Checks that a term meta is not in the database.

                                                                                                                                                                                    - -
                                                                                                                                                                                    list($termId, $termTaxonomyId) = $I->haveTermInDatabase('fiction', 'genre');
                                                                                                                                                                                    -  $I->haveTermMetaInDatabase($termId, 'rating', 4);
                                                                                                                                                                                    -  $I->dontSeeTermMetaInDatabase(['term_id' => $termId,'meta_key' => 'average_review']);
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • \Codeception\Module\array/array $criteria - An array of search criteria.
                                                                                                                                                                                    - -

                                                                                                                                                                                    dontSeeTermTaxonomyInDatabase

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Checks that a term taxonomy is not in the database.

                                                                                                                                                                                    - -
                                                                                                                                                                                    list($termId, $termTaxonomyId) = $I->haveTermInDatabase('fiction', 'genre');
                                                                                                                                                                                    -  $I->dontSeeTermTaxonomyInDatabase(['term_id' => $termId, 'taxonomy' => 'country']);
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • \Codeception\Module\array/array $criteria - An array of search criteria.
                                                                                                                                                                                    - -

                                                                                                                                                                                    dontSeeUserInDatabase

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Checks that a user is not in the database.

                                                                                                                                                                                    - -
                                                                                                                                                                                    // Asserts a user does not exist in the database.
                                                                                                                                                                                    -  $I->dontSeeUserInDatabase(['user_login' => 'luca']);
                                                                                                                                                                                    -  // Asserts a user with email and login is not in the database.
                                                                                                                                                                                    -  $I->dontSeeUserInDatabase(['user_login' => 'luca', 'user_email' => 'luca@theaveragedev.com']);
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • \Codeception\Module\array/array $criteria - An array of search criteria.
                                                                                                                                                                                    - -

                                                                                                                                                                                    dontSeeUserMetaInDatabase

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Check that a user meta value is not in the database.

                                                                                                                                                                                    - -
                                                                                                                                                                                    // Asserts a user does not have a 'karma' meta assigned.
                                                                                                                                                                                    -  $I->dontSeeUserMetaInDatabase(['user_id' => 23, 'meta_key' => 'karma']);
                                                                                                                                                                                    -  // Asserts no user has any 'karma' meta assigned.
                                                                                                                                                                                    -  $I->dontSeeUserMetaInDatabase(['meta_key' => 'karma']);
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • \Codeception\Module\array/array $criteria - An array of search criteria.
                                                                                                                                                                                    - -

                                                                                                                                                                                    getSiteDomain

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Returns the site domain inferred from the url set in the config.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $domain = $I->getSiteDomain();
                                                                                                                                                                                    -  // We should be redirected to the HTTPS version when visiting the HTTP version.
                                                                                                                                                                                    -  $I->amOnPage('http://' . $domain);
                                                                                                                                                                                    -  $I->seeCurrentUrlEquals('https://' . $domain);
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    getUsersTableName

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Returns the prefixed users table name.

                                                                                                                                                                                    - -
                                                                                                                                                                                    // Given a `wp_` table prefix returns `wp_users`.
                                                                                                                                                                                    -  $usersTable = $I->getUsersTableName();
                                                                                                                                                                                    -  // Given a `wp_` table prefix returns `wp_users`.
                                                                                                                                                                                    -  $I->useBlog(23);
                                                                                                                                                                                    -  $usersTable = $I->getUsersTableName();
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    grabAllFromDatabase

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Returns all entries matching a criteria from the database.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $books = $I->grabPrefixedTableNameFor('books');
                                                                                                                                                                                    -  $I->grabAllFromDatabase($books, 'title', ['genre' => 'fiction']);
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string $table - The table to grab the values from.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • string $column - The column to fetch.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • \Codeception\Module\array $criteria - The search criteria.
                                                                                                                                                                                    - -

                                                                                                                                                                                    grabAttachmentAttachedFile

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Returns the path, as stored in the database, of an attachment _wp_attached_file meta. The attached file is, usually, an attachment origal file.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $file = $I->grabAttachmentAttachedFile($attachmentId);
                                                                                                                                                                                    -  $fileInfo = new SplFileInfo($file);
                                                                                                                                                                                    -  $I->assertEquals('jpg', $fileInfo->getExtension());
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • int $attachmentPostId - The attachment post ID.
                                                                                                                                                                                    - -

                                                                                                                                                                                    grabAttachmentMetadata

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Returns the metadata array for an attachment post. This is the value of the _wp_attachment_metadata meta.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $metadata = $I->grabAttachmentMetadata($attachmentId);
                                                                                                                                                                                    -  $I->assertEquals(['thumbnail', 'medium', 'medium_large'], array_keys($metadata['sizes']);
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • int $attachmentPostId - The attachment post ID.
                                                                                                                                                                                    - -

                                                                                                                                                                                    grabBlogDomain

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Returns a blog domain given its ID.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $blogIds = $I->haveManyBlogsInDatabase(3);
                                                                                                                                                                                    -  $domains = array_map(function($blogId){
                                                                                                                                                                                    -  return $I->grabBlogDomain($blogId);
                                                                                                                                                                                    -  }, $blogIds);
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • int $blogId - The blog ID.
                                                                                                                                                                                    - -

                                                                                                                                                                                    grabBlogPath

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Grabs a blog domain from the blogs table.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $blogId = $I->haveBlogInDatabase('test');
                                                                                                                                                                                    -  $path = $I->grabBlogDomain($blogId);
                                                                                                                                                                                    -  $I->amOnSubdomain($path);
                                                                                                                                                                                    -  $I->amOnPage('/');
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • int $blogId - The blog ID.
                                                                                                                                                                                    - -

                                                                                                                                                                                    grabBlogTableName

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Returns the full name of a table for a blog from a multisite installation database.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $blogOptionTable = $I->grabBlogTableName($blogId, 'option');
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • int $blogId - The blog ID.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • string $table - The table name, without table prefix.
                                                                                                                                                                                    - -

                                                                                                                                                                                    grabBlogTableNames

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Returns a list of tables for a blog ID.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $blogId = $I->haveBlogInDatabase('test');
                                                                                                                                                                                    -  $tables = $I->grabBlogTableNames($blogId);
                                                                                                                                                                                    -  $options = array_filter($tables, function($tableName){
                                                                                                                                                                                    -  return str_pos($tableName, 'options') !== false;
                                                                                                                                                                                    -  });
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • int $blogId - The ID of the blog to fetch the tables for.
                                                                                                                                                                                    - -

                                                                                                                                                                                    grabBlogTablePrefix

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Returns the table prefix for a blog.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $blogId = $I->haveBlogInDatabase('test');
                                                                                                                                                                                    -  $blogTablePrefix = $I->getBlogTablePrefix($blogId);
                                                                                                                                                                                    -  $blogOrders = $I->blogTablePrefix . 'orders';
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • int $blogId - The blog ID.
                                                                                                                                                                                    - -

                                                                                                                                                                                    grabBlogVersionsTableName

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Gets the prefixed blog_versions table name.

                                                                                                                                                                                    - -
                                                                                                                                                                                    // Assuming a `wp_` table prefix it will return `wp_blog_versions`.
                                                                                                                                                                                    -  $blogVersionsTable = $I->grabBlogVersionsTableName();
                                                                                                                                                                                    -  $I->useBlog(23);
                                                                                                                                                                                    -  // Assuming a `wp_` table prefix it will return `wp_blog_versions`.
                                                                                                                                                                                    -  $blogVersionsTable = $I->grabBlogVersionsTableName();
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    grabBlogsTableName

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Gets the prefixed blogs table name.

                                                                                                                                                                                    - -
                                                                                                                                                                                    // Assuming a `wp_` table prefix it will return `wp_blogs`.
                                                                                                                                                                                    -  $blogVersionsTable = $I->grabBlogsTableName();
                                                                                                                                                                                    -  $I->useBlog(23);
                                                                                                                                                                                    -  // Assuming a `wp_` table prefix it will return `wp_blogs`.
                                                                                                                                                                                    -  $blogVersionsTable = $I->grabBlogsTableName();
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    grabCommentmetaTableName

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Returns the prefixed comment meta table name.

                                                                                                                                                                                    - -
                                                                                                                                                                                    // Get all the values of 'karma' for all comments.
                                                                                                                                                                                    -  $commentMeta = $I->grabCommentmetaTableName();
                                                                                                                                                                                    -  $I->grabAllFromDatabase($commentMeta, 'meta_value', ['meta_key' => 'karma']);
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    grabCommentsTableName

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Gets the comments table name.

                                                                                                                                                                                    - -
                                                                                                                                                                                    // Will be `wp_comments`.
                                                                                                                                                                                    -  $comments = $I->grabCommentsTableName();
                                                                                                                                                                                    -  // Will be `wp_23_comments`.
                                                                                                                                                                                    -  $I->useBlog(23);
                                                                                                                                                                                    -  $comments = $I->grabCommentsTableName();
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    grabLatestEntryByFromDatabase

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Returns the id value of the last table entry.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $I->haveManyPostsInDatabase();
                                                                                                                                                                                    -  $postsTable = $I->grabPostsTableName();
                                                                                                                                                                                    -  $last = $I->grabLatestEntryByFromDatabase($postsTable, 'ID');
                                                                                                                                                                                    -  items.
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string $tableName - The table to fetch the last insertion for.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • string $idColumn - The column that is used, in the table, to uniquely identify
                                                                                                                                                                                    - -

                                                                                                                                                                                    grabLinksTableName

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Returns the prefixed links table name.

                                                                                                                                                                                    - -
                                                                                                                                                                                    // Given a `wp_` table prefix returns `wp_links`.
                                                                                                                                                                                    -  $linksTable = $I->grabLinksTableName();
                                                                                                                                                                                    -  // Given a `wp_` table prefix returns `wp_23_links`.
                                                                                                                                                                                    -  $I->useBlog(23);
                                                                                                                                                                                    -  $linksTable = $I->grabLinksTableName();
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    grabOptionFromDatabase

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Gets an option value from the database.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $count = $I->grabOptionFromDatabase('foo_count');
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string $option_name - The name of the option to grab from the database.
                                                                                                                                                                                    - -

                                                                                                                                                                                    grabPostMetaFromDatabase

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Gets the value of one or more post meta values from the database.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $thumbnail_id = $I->grabPostMetaFromDatabase($postId, '_thumbnail_id', true);
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • int $postId - The post ID.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • string $metaKey - The key of the meta to retrieve.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • bool $single - Whether to return a single meta value or an array of all available meta values.
                                                                                                                                                                                    - -

                                                                                                                                                                                    grabPostmetaTableName

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Returns the prefixed post meta table name.

                                                                                                                                                                                    - -
                                                                                                                                                                                    // Returns 'wp_postmeta'.
                                                                                                                                                                                    -  $I->grabPostmetaTableName();
                                                                                                                                                                                    -  // Returns 'wp_23_postmeta'.
                                                                                                                                                                                    -  $I->useBlog(23);
                                                                                                                                                                                    -  $I->grabPostmetaTableName();
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    grabPostsTableName

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Gets the posts prefixed table name.

                                                                                                                                                                                    - -
                                                                                                                                                                                    // Given a `wp_` table prefix returns `wp_posts`.
                                                                                                                                                                                    -  $postsTable = $I->grabPostsTableName();
                                                                                                                                                                                    -  // Given a `wp_` table prefix returns `wp_23_posts`.
                                                                                                                                                                                    -  $I->useBlog(23);
                                                                                                                                                                                    -  $postsTable = $I->grabPostsTableName();
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    grabPrefixedTableNameFor

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Returns a prefixed table name for the current blog. If the table is not one to be prefixed (e.g. users) then the proper table name will be returned.

                                                                                                                                                                                    - -
                                                                                                                                                                                    // Will return wp_users.
                                                                                                                                                                                    -  $usersTable = $I->grabPrefixedTableNameFor('users');
                                                                                                                                                                                    -  // Will return wp_options.
                                                                                                                                                                                    -  $optionsTable = $I->grabPrefixedTableNameFor('options');
                                                                                                                                                                                    -  // Use a different blog and get its options table.
                                                                                                                                                                                    -  $I->useBlog(2);
                                                                                                                                                                                    -  $blogOptionsTable = $I->grabPrefixedTableNameFor('options');
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string $tableName - The table name, e.g. options.
                                                                                                                                                                                    - -

                                                                                                                                                                                    grabRegistrationLogTableName

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Gets the prefixed registration_log table name.

                                                                                                                                                                                    - -
                                                                                                                                                                                    // Assuming a `wp_` table prefix it will return `wp_registration_log`.
                                                                                                                                                                                    -  $blogVersionsTable = $I->grabRegistrationLogTableName();
                                                                                                                                                                                    -  $I->useBlog(23);
                                                                                                                                                                                    -  // Assuming a `wp_` table prefix it will return `wp_registration_log`.
                                                                                                                                                                                    -  $blogVersionsTable = $I->grabRegistrationLogTableName();
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    grabSignupsTableName

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Gets the prefixed signups table name.

                                                                                                                                                                                    - -
                                                                                                                                                                                    // Assuming a `wp_` table prefix it will return `wp_signups`.
                                                                                                                                                                                    -  $blogVersionsTable = $I->grabSignupsTableName();
                                                                                                                                                                                    -  $I->useBlog(23);
                                                                                                                                                                                    -  // Assuming a `wp_` table prefix it will return `wp_signups`.
                                                                                                                                                                                    -  $blogVersionsTable = $I->grabSignupsTableName();
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    grabSiteMetaTableName

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Gets the prefixed sitemeta table name.

                                                                                                                                                                                    - -
                                                                                                                                                                                    // Assuming a `wp_` table prefix it will return `wp_sitemeta`.
                                                                                                                                                                                    -  $blogVersionsTable = $I->grabSiteMetaTableName();
                                                                                                                                                                                    -  $I->useBlog(23);
                                                                                                                                                                                    -  // Assuming a `wp_` table prefix it will return `wp_sitemeta`.
                                                                                                                                                                                    -  $blogVersionsTable = $I->grabSiteMetaTableName();
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    grabSiteOptionFromDatabase

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Gets a site option from the database.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $fooCountOptionId = $I->haveSiteOptionInDatabase('foo_count','23');
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string $key - The name of the option to read from the database.
                                                                                                                                                                                    - -

                                                                                                                                                                                    grabSiteTableName

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Gets the prefixed site table name.

                                                                                                                                                                                    - -
                                                                                                                                                                                    // Assuming a `wp_` table prefix it will return `wp_site`.
                                                                                                                                                                                    -  $blogVersionsTable = $I->grabSiteTableName();
                                                                                                                                                                                    -  $I->useBlog(23);
                                                                                                                                                                                    -  // Assuming a `wp_` table prefix it will return `wp_site`.
                                                                                                                                                                                    -  $blogVersionsTable = $I->grabSiteTableName();
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    grabSiteTransientFromDatabase

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Gets a site transient from the database.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $I->grabSiteTransientFromDatabase('total_comments');
                                                                                                                                                                                    -  $I->grabSiteTransientFromDatabase('api_data');
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string $key - The site transient to fetch the value for, w/o the _site_transient_ prefix.
                                                                                                                                                                                    - -

                                                                                                                                                                                    grabSiteUrl

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Returns the current site URL as specified in the module configuration.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $shopPath = $I->grabSiteUrl('/shop');
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string $path - A path that should be appended to the site URL.
                                                                                                                                                                                    - -

                                                                                                                                                                                    grabTablePrefix

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Returns the table prefix, namespaced for secondary blogs if selected.

                                                                                                                                                                                    - -
                                                                                                                                                                                    // Assuming a table prefix of `wp_` it will return `wp_`;
                                                                                                                                                                                    -  $tablePrefix = $I->grabTablePrefix();
                                                                                                                                                                                    -  $I->useBlog(23);
                                                                                                                                                                                    -  // Assuming a table prefix of `wp_` it will return `wp_23_`;
                                                                                                                                                                                    -  $tablePrefix = $I->grabTablePrefix();
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    grabTermIdFromDatabase

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Gets a term ID from the database. Looks up the prefixed terms table, e.g. wp_terms.

                                                                                                                                                                                    - -
                                                                                                                                                                                    // Return the 'fiction' term 'term_id'.
                                                                                                                                                                                    -  $termId = $I->grabTermIdFromDatabase(['name' => 'fiction']);
                                                                                                                                                                                    -  // Get a term ID by more stringent criteria.
                                                                                                                                                                                    -  $termId = $I->grabTermIdFromDatabase(['name' => 'fiction', 'slug' => 'genre--fiction']);
                                                                                                                                                                                    -  // Return the 'term_id' of the first term for a group.
                                                                                                                                                                                    -  $termId = $I->grabTermIdFromDatabase(['term_group' => 23]);
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • \Codeception\Module\array/array $criteria - An array of search criteria.
                                                                                                                                                                                    - -

                                                                                                                                                                                    grabTermMetaTableName

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Gets the terms meta table prefixed name.

                                                                                                                                                                                    - -
                                                                                                                                                                                    // Returns 'wp_termmeta'.
                                                                                                                                                                                    -  $I->grabTermMetaTableName();
                                                                                                                                                                                    -  // Returns 'wp_23_termmeta'.
                                                                                                                                                                                    -  $I->useBlog(23);
                                                                                                                                                                                    -  $I->grabTermMetaTableName();
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    grabTermRelationshipsTableName

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Gets the prefixed term relationships table name, e.g. wp_term_relationships.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $I->grabTermRelationshipsTableName();
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    grabTermTaxonomyIdFromDatabase

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Gets a term_taxonomy_id from the database. Looks up the prefixed terms_relationships table, e.g. wp_term_relationships.

                                                                                                                                                                                    - -
                                                                                                                                                                                    // Get the `term_taxonomy_id` for a term and a taxonomy.
                                                                                                                                                                                    -  $I->grabTermTaxonomyIdFromDatabase(['term_id' => $fictionId, 'taxonomy' => 'genre']);
                                                                                                                                                                                    -  // Get the `term_taxonomy_id` for the first term with a count of 23.
                                                                                                                                                                                    -  $I->grabTermTaxonomyIdFromDatabase(['count' => 23]);
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • \Codeception\Module\array/array $criteria - An array of search criteria.
                                                                                                                                                                                    - -

                                                                                                                                                                                    grabTermTaxonomyTableName

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Gets the prefixed term and taxonomy table name, e.g. wp_term_taxonomy.

                                                                                                                                                                                    - -
                                                                                                                                                                                    // Returns 'wp_term_taxonomy'.
                                                                                                                                                                                    -  $I->grabTermTaxonomyTableName();
                                                                                                                                                                                    -  // Returns 'wp_23_term_taxonomy'.
                                                                                                                                                                                    -  $I->useBlog(23);
                                                                                                                                                                                    -  $I->grabTermTaxonomyTableName();
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    grabTermsTableName

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Gets the prefixed terms table name, e.g. wp_terms.

                                                                                                                                                                                    - -
                                                                                                                                                                                    // Returns 'wp_terms'.
                                                                                                                                                                                    -  $I->grabTermsTableName();
                                                                                                                                                                                    -  // Returns 'wp_23_terms'.
                                                                                                                                                                                    -  $I->useBlog(23);
                                                                                                                                                                                    -  $I->grabTermsTableName();
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    grabUserIdFromDatabase

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Gets the a user ID from the database using the user login.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $userId = $I->grabUserIdFromDatabase('luca');
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string $userLogin - The user login name.
                                                                                                                                                                                    - -

                                                                                                                                                                                    grabUserMetaFromDatabase

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Gets a user meta from the database.

                                                                                                                                                                                    - -
                                                                                                                                                                                    // Returns a user 'karma' value.
                                                                                                                                                                                    -  $I->grabUserMetaFromDatabase($userId, 'karma');
                                                                                                                                                                                    -  // Returns an array, the unserialized version of the value stored in the database.
                                                                                                                                                                                    -  $I->grabUserMetaFromDatabase($userId, 'api_data');
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • int $userId - The ID of th user to get the meta for.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • string $meta_key - The meta key to fetch the value for.
                                                                                                                                                                                    - -

                                                                                                                                                                                    grabUsermetaTableName

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Returns the prefixed users meta table name.

                                                                                                                                                                                    - -
                                                                                                                                                                                    // Given a `wp_` table prefix returns `wp_usermeta`.
                                                                                                                                                                                    -  $usermetaTable = $I->grabUsermetaTableName();
                                                                                                                                                                                    -  // Given a `wp_` table prefix returns `wp_usermeta`.
                                                                                                                                                                                    -  $I->useBlog(23);
                                                                                                                                                                                    -  $usermetaTable = $I->grabUsermetaTableName();
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    grabUsersTableName

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Returns the prefixed users table name.

                                                                                                                                                                                    - -
                                                                                                                                                                                    // Given a `wp_` table prefix returns `wp_users`.
                                                                                                                                                                                    -  $usersTable = $I->grabUsersTableName();
                                                                                                                                                                                    -  // Given a `wp_` table prefix returns `wp_users`.
                                                                                                                                                                                    -  $I->useBlog(23);
                                                                                                                                                                                    -  $usersTable = $I->grabUsersTableName();
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    haveAttachmentInDatabase

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Creates the database entries representing an attachment and moves the attachment file to the right location. timestamp that should be used to build the "year/time" uploads sub-folder structure. override the image sizes created by default.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $file = codecept_data_dir('images/test.png');
                                                                                                                                                                                    -  $attachmentId = $I->haveAttachmentInDatabase($file);
                                                                                                                                                                                    -  $image = codecept_data_dir('images/test-2.png');
                                                                                                                                                                                    -  $lastWeekAttachment = $I->haveAttachmentInDatabase($image, '-1 week');
                                                                                                                                                                                    -  Requires the WPFilesystem module.
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string $file - The absolute path to the attachment file.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • string/string/int $date - Either a string supported by the strtotime function or a UNIX
                                                                                                                                                                                    • -
                                                                                                                                                                                    • array/\Codeception\Module\array/array $overrides - An associative array of values overriding the default ones.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • \Codeception\Module\array> $imageSizes - An associative array in the format [ => [,]] to
                                                                                                                                                                                    - -

                                                                                                                                                                                    haveBlogInDatabase

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Inserts a blog in the blogs table.

                                                                                                                                                                                    - -
                                                                                                                                                                                    // Create the `test` subdomain blog.
                                                                                                                                                                                    -  $blogId = $I->haveBlogInDatabase('test', ['administrator' => $userId]);
                                                                                                                                                                                    -  // Create the `/test` subfolder blog.
                                                                                                                                                                                    -  $blogId = $I->haveBlogInDatabase('test', ['administrator' => $userId], false);
                                                                                                                                                                                    -  or subfolder (`true`)
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string $domainOrPath - The subdomain or the path to the be used for the blog.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • array/\Codeception\Module\array/array $overrides - An array of values to override the defaults.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • bool $subdomain - Whether the new blog should be created as a subdomain (true)
                                                                                                                                                                                    - -

                                                                                                                                                                                    haveCommentInDatabase

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Inserts a comment in the database.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $I->haveCommentInDatabase($postId, ['comment_content' => 'Test Comment', 'comment_karma' => 23]);
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • int $comment_post_ID - The id of the post the comment refers to.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • array/\Codeception\Module\array/array $data - The comment data overriding default and random generated values.
                                                                                                                                                                                    - -

                                                                                                                                                                                    haveCommentMetaInDatabase

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Inserts a comment meta field in the database. Array and object meta values will be serialized.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $I->haveCommentMetaInDatabase($commentId, 'api_ID', 23);
                                                                                                                                                                                    -  // The value will be serialized.
                                                                                                                                                                                    -  $apiData = ['ID' => 23, 'user' => 89, 'origin' => 'twitter'];
                                                                                                                                                                                    -  $I->haveCommentMetaInDatabase($commentId, 'api_data', $apiData);
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • int $comment_id - The ID of the comment to insert the meta for.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • string $meta_key - The key of the comment meta to insert.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • mixed $meta_value - The value of the meta to insert, if serializable it will be serialized.
                                                                                                                                                                                    - -

                                                                                                                                                                                    haveLinkInDatabase

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Inserts a link in the database.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $linkId = $I->haveLinkInDatabase(['link_url' => 'http://example.org']);
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • array/\Codeception\Module\array/array $overrides - The data to insert.
                                                                                                                                                                                    - -

                                                                                                                                                                                    haveManyBlogsInDatabase

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Inserts many blogs in the database. by the count.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $blogIds = $I->haveManyBlogsInDatabase(3, ['domain' =>'test-{{n}}']);
                                                                                                                                                                                    -  foreach($blogIds as $blogId){
                                                                                                                                                                                    -  $I->useBlog($blogId);
                                                                                                                                                                                    -  $I->haveManuPostsInDatabase(3);
                                                                                                                                                                                    -  }
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • int $count - The number of blogs to create.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • array/\Codeception\Module\array/array $overrides - An array of values to override the default ones; {{n}} will be replaced
                                                                                                                                                                                    • -
                                                                                                                                                                                    • bool $subdomain - Whether the new blogs should be created as a subdomain or subfolder.
                                                                                                                                                                                    - -

                                                                                                                                                                                    haveManyCommentsInDatabase

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Inserts many comments in the database.

                                                                                                                                                                                    - -
                                                                                                                                                                                    // Insert 3 random comments for a post.
                                                                                                                                                                                    -  $I->haveManyCommentsInDatabase(3, $postId);
                                                                                                                                                                                    -  // Insert 3 random comments for a post.
                                                                                                                                                                                    -  $I->haveManyCommentsInDatabase(3, $postId, ['comment_content' => 'Comment {{n}}']);
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • int $count - The number of comments to insert.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • int $comment_post_ID - The comment parent post ID.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • array/\Codeception\Module\array/array $overrides - An associative array to override the defaults.
                                                                                                                                                                                    - -

                                                                                                                                                                                    haveManyLinksInDatabase

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Inserts many links in the database links table.

                                                                                                                                                                                    - -
                                                                                                                                                                                    // Insert 3 randomly generated links in the database.
                                                                                                                                                                                    -  $linkIds = $I->haveManyLinksInDatabase(3);
                                                                                                                                                                                    -  // Inserts links in the database replacing the `n` placeholder.
                                                                                                                                                                                    -  $linkIds = $I->haveManyLinksInDatabase(3, ['link_url' => 'http://example.org/test-{{n}}']);
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • int $count - The number of links to insert.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • array/\Codeception\Module\array/array $overrides - Overrides for the default arguments.
                                                                                                                                                                                    - -

                                                                                                                                                                                    haveManyPostsInDatabase

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Inserts many posts in the database returning their IDs. An array of values to override the defaults. The {{n}} placeholder can be used to have the post count inserted in its place; e.g. Post Title - {{n}} will be set to Post Title - 0 for the first post, Post Title - 1 for the second one and so on. The same applies to meta values as well.

                                                                                                                                                                                    - -
                                                                                                                                                                                    // Insert 3 random posts.
                                                                                                                                                                                    -  $I->haveManyPostsInDatabase(3);
                                                                                                                                                                                    -  // Insert 3 posts with generated titles.
                                                                                                                                                                                    -  $I->haveManyPostsInDatabase(3, ['post_title' => 'Test post {{n}}']);
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • int $count - The number of posts to insert.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • array/\Codeception\Module\array/array $overrides
                                                                                                                                                                                    - -

                                                                                                                                                                                    haveManyTermsInDatabase

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Inserts many terms in the database.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $terms = $I->haveManyTermsInDatabase(3, 'genre-{{n}}', 'genre');
                                                                                                                                                                                    -  $termIds = array_column($terms, 0);
                                                                                                                                                                                    -  $termTaxonomyIds = array_column($terms, 1);
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • int $count - The number of terms to insert.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • string $name - The term name template, can include the {{n}} placeholder.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • string $taxonomy - The taxonomy to insert the terms for.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • array/\Codeception\Module\array/array $overrides - An associative array of default overrides.
                                                                                                                                                                                    - -

                                                                                                                                                                                    haveManyUsersInDatabase

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Inserts many users in the database.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $subscribers = $I->haveManyUsersInDatabase(5, 'user-{{n}}');
                                                                                                                                                                                    -  $editors = $I->haveManyUsersInDatabase(
                                                                                                                                                                                    -  5,
                                                                                                                                                                                    -  'user-{{n}}',
                                                                                                                                                                                    -  'editor',
                                                                                                                                                                                    -  ['user_email' => 'user-{{n}}@example.org']
                                                                                                                                                                                    -  );
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • int $count - The number of users to insert.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • string $user_login - The user login name.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • string $role - The user role.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • array/\Codeception\Module\array/array $overrides - An array of values to override the default ones.
                                                                                                                                                                                    - -

                                                                                                                                                                                    haveMenuInDatabase

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Creates and adds a menu to a theme location in the database.

                                                                                                                                                                                    - -
                                                                                                                                                                                    list($termId, $termTaxId) = $I->haveMenuInDatabase('test', 'sidebar');
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string $slug - The menu slug.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • string $location - The theme menu location the menu will be assigned to.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • array/\Codeception\Module\array/array $overrides - An array of values to override the defaults.
                                                                                                                                                                                    - -

                                                                                                                                                                                    haveMenuItemInDatabase

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Adds a menu element to a menu for the current theme. post meta.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $I->haveMenuInDatabase('test', 'sidebar');
                                                                                                                                                                                    -  $I->haveMenuItemInDatabase('test', 'Test one', 0);
                                                                                                                                                                                    -  $I->haveMenuItemInDatabase('test', 'Test two', 1);
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string $menuSlug - The menu slug the item should be added to.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • string $title - The menu item title.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • int/null $menuOrder - An optional menu order, 1 based.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • array/\Codeception\Module\array/array $meta - An associative array that will be prefixed with _menu_item_ for the item
                                                                                                                                                                                    - -

                                                                                                                                                                                    haveOptionInDatabase

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Inserts an option in the database.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $I->haveOptionInDatabase('posts_per_page', 23);
                                                                                                                                                                                    -  $I->haveOptionInDatabase('my_plugin_options', ['key_one' => 'value_one', 'key_two' => 89]);
                                                                                                                                                                                    -  If the option value is an object or an array then the value will be serialized.
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string $option_name - The option name.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • mixed $option_value - The option value; if an array or object it will be serialized.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • string $autoload - Weather the option should be autoloaded by WordPress or not.
                                                                                                                                                                                    - -

                                                                                                                                                                                    havePageInDatabase

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Inserts a page in the database.

                                                                                                                                                                                    - -
                                                                                                                                                                                    // Creates a test page in the database with random values.
                                                                                                                                                                                    -  $randomPageId = $I->havePageInDatabase();
                                                                                                                                                                                    -  // Creates a test page in the database defining its title.
                                                                                                                                                                                    -  $testPageId = $I->havePageInDatabase(['post_title' => 'Test page']);
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • array/\Codeception\Module\array/array $overrides - An array of values to override the default ones.
                                                                                                                                                                                    - -

                                                                                                                                                                                    havePostInDatabase

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Inserts a post in the database. values.

                                                                                                                                                                                    - -
                                                                                                                                                                                    // Insert a post with random values in the database.
                                                                                                                                                                                    -  $randomPostId = $I->havePostInDatabase();
                                                                                                                                                                                    -  // Insert a post with specific values in the database.
                                                                                                                                                                                    -  $I->havePostInDatabase([
                                                                                                                                                                                    -  'post_type' => 'book',
                                                                                                                                                                                    -  'post_title' => 'Alice in Wonderland',
                                                                                                                                                                                    -  'meta_input' => [
                                                                                                                                                                                    -  'readers_count' => 23
                                                                                                                                                                                    -  ],
                                                                                                                                                                                    -  'tax_input' => [
                                                                                                                                                                                    -  ['genre' => 'fiction']
                                                                                                                                                                                    -  ]
                                                                                                                                                                                    -  ]);
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • array/\Codeception\Module\array/array $data - An associative array of post data to override default and random generated
                                                                                                                                                                                    - -

                                                                                                                                                                                    havePostThumbnailInDatabase

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Assigns the specified attachment ID as thumbnail (featured image) to a post.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $attachmentId = $I->haveAttachmentInDatabase(codecept_data_dir('some-image.png'));
                                                                                                                                                                                    -  $postId = $I->havePostInDatabase();
                                                                                                                                                                                    -  $I->havePostThumbnailInDatabase($postId, $attachmentId);
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • int $postId - The post ID to assign the thumbnail (featured image) to.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • int $thumbnailId - The post ID of the attachment.
                                                                                                                                                                                    - -

                                                                                                                                                                                    havePostmetaInDatabase

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Adds one or more meta key and value couples in the database for a post.

                                                                                                                                                                                    - -
                                                                                                                                                                                    // Set the post-meta for a post.
                                                                                                                                                                                    -  $I->havePostmetaInDatabase($postId, 'karma', 23);
                                                                                                                                                                                    -  // Set an array post-meta for a post, it will be serialized in the db.
                                                                                                                                                                                    -  $I->havePostmetaInDatabase($postId, 'data', ['one', 'two']);
                                                                                                                                                                                    -  // Use a loop to insert one meta per row.
                                                                                                                                                                                    -  foreach( ['one', 'two'] as $value){
                                                                                                                                                                                    -  $I->havePostmetaInDatabase($postId, 'data', $value);
                                                                                                                                                                                    -  }
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • int $postId - The post ID.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • string $meta_key - The meta key.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • mixed $meta_value - The value to insert in the database, objects and arrays will be serialized.
                                                                                                                                                                                    - -

                                                                                                                                                                                    haveSiteOptionInDatabase

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Inserts a site option in the database. If the value is an array or an object then the value will be serialized.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $fooCountOptionId = $I->haveSiteOptionInDatabase('foo_count','23');
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string $key - The name of the option to insert.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • mixed $value - The value to insert for the option.
                                                                                                                                                                                    - -

                                                                                                                                                                                    haveSiteTransientInDatabase

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Inserts a site transient in the database. If the value is an array or an object then the value will be serialized.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $I->haveSiteTransientInDatabase('total_comments_count', 23);
                                                                                                                                                                                    -  // This value will be serialized.
                                                                                                                                                                                    -  $I->haveSiteTransientInDatabase('api_data', ['user' => 'luca', 'token' => '11ae3ijns-j83']);
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string $key - The key of the site transient to insert, w/o the _site_transient_ prefix.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • mixed $value - The value to insert; if serializable the value will be serialized.
                                                                                                                                                                                    - -

                                                                                                                                                                                    haveTermInDatabase

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Inserts a term in the database.

                                                                                                                                                                                    - -
                                                                                                                                                                                    // Insert a random 'genre' term in the database.
                                                                                                                                                                                    -  $I->haveTermInDatabase('non-fiction', 'genre');
                                                                                                                                                                                    -  // Insert a term in the database with term meta.
                                                                                                                                                                                    -  $I->haveTermInDatabase('fiction', 'genre', [
                                                                                                                                                                                    -  'slug' => 'genre--fiction',
                                                                                                                                                                                    -  'meta' => [
                                                                                                                                                                                    -  'readers_count' => 23
                                                                                                                                                                                    -  ]
                                                                                                                                                                                    -  ]);
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string $name - The term name, e.g. "Fuzzy".
                                                                                                                                                                                    • -
                                                                                                                                                                                    • string $taxonomy - The term taxonomy
                                                                                                                                                                                    • -
                                                                                                                                                                                    • array/\Codeception\Module\array/array $overrides - An array of values to override the default ones.
                                                                                                                                                                                    - -

                                                                                                                                                                                    haveTermMetaInDatabase

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Inserts a term meta row in the database. Objects and array meta values will be serialized.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $I->haveTermMetaInDatabase($fictionId, 'readers_count', 23);
                                                                                                                                                                                    -  // Insert some meta that will be serialized.
                                                                                                                                                                                    -  $I->haveTermMetaInDatabase($fictionId, 'flags', [3, 4, 89]);
                                                                                                                                                                                    -  // Use a loop to insert one meta per row.
                                                                                                                                                                                    -  foreach([3, 4, 89] as $value) {
                                                                                                                                                                                    -  $I->haveTermMetaInDatabase($fictionId, 'flag', $value);
                                                                                                                                                                                    -  }
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • int $term_id - The ID of the term to insert the meta for.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • string $meta_key - The key of the meta to insert.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • mixed $meta_value - The value of the meta to insert, if serializable it will be serialized.
                                                                                                                                                                                    - -

                                                                                                                                                                                    haveTermRelationshipInDatabase

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Creates a term relationship in the database. No check about the consistency of the insertion is made. E.g. a post could be assigned a term from a taxonomy that's not registered for that post type.

                                                                                                                                                                                    - -
                                                                                                                                                                                    // Assign the `fiction` term to a book.
                                                                                                                                                                                    -  $I->haveTermRelationshipInDatabase($bookId, $fictionId);
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • int $object_id - A post ID, a user ID or anything that can be assigned a taxonomy term.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • int $term_taxonomy_id - The term_taxonomy_id of the term and taxonomy to create a relation with.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • int $term_order - Defaults to 0.
                                                                                                                                                                                    - -

                                                                                                                                                                                    haveTransientInDatabase

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Inserts a transient in the database. If the value is an array or an object then the value will be serialized. Since the transients are set in the context of tests it's not possible to set an expiration directly.

                                                                                                                                                                                    - -
                                                                                                                                                                                    // Store an array in the `tweets` transient.
                                                                                                                                                                                    -  $I->haveTransientInDatabase('tweets', $tweets);
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string $transient - The transient name.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • mixed $value - The transient value.
                                                                                                                                                                                    - -

                                                                                                                                                                                    haveUserCapabilitiesInDatabase

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Sets a user capabilities in the database.

                                                                                                                                                                                    - -
                                                                                                                                                                                    // Assign one user a role in a blog.
                                                                                                                                                                                    -  $blogId = $I->haveBlogInDatabase('test');
                                                                                                                                                                                    -  $editor = $I->haveUserInDatabase('luca', 'editor');
                                                                                                                                                                                    -  $capsIds = $I->haveUserCapabilitiesInDatabase($editor, [$blogId => 'editor']);
                                                                                                                                                                                    -  // Assign a user two roles in blog 1.
                                                                                                                                                                                    -  $capsIds = $I->haveUserCapabilitiesInDatabase($userId, ['editor', 'subscriber']);
                                                                                                                                                                                    -  // Assign one user different roles in different blogs.
                                                                                                                                                                                    -  $capsIds = $I->haveUserCapabilitiesInDatabase($userId, [$blogId1 => 'editor', $blogId2 => 'author']);
                                                                                                                                                                                    -  // Assign a user a role and an additional capability in blog 1.
                                                                                                                                                                                    -  $I->haveUserCapabilitiesInDatabase($userId, ['editor' => true, 'edit_themes' => true]);
                                                                                                                                                                                    -  // Assign a user a mix of roles and capabilities in different blogs.
                                                                                                                                                                                    -  $capsIds = $I->haveUserCapabilitiesInDatabase(
                                                                                                                                                                                    -  $userId,
                                                                                                                                                                                    -  [
                                                                                                                                                                                    -  $blogId1 => ['editor' => true, 'edit_themes' => true],
                                                                                                                                                                                    -  $blogId2 => ['administrator' => true, 'edit_themes' => false]
                                                                                                                                                                                    -  ]
                                                                                                                                                                                    -  );
                                                                                                                                                                                    -  associative array of blog IDs/roles for a multisite
                                                                                                                                                                                    -  installation (e.g. `[1 => 'administrator`, 2 =>
                                                                                                                                                                                    -  'subscriber']`).
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • int $userId - The ID of the user to set the capabilities of.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • string/\Codeception\Module\array/\Codeception\Module\array $role - Either a role string (e.g. administrator),an
                                                                                                                                                                                    - -

                                                                                                                                                                                    haveUserInDatabase

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Inserts a user and its meta in the database. defaults to subscriber. If more than one role is specified, then the first role in the list will be the user primary role and the wp_user_level will be set to that role. in the users and usermeta table.

                                                                                                                                                                                    - -
                                                                                                                                                                                    // Create an editor user in blog 1 w/ specific email.
                                                                                                                                                                                    -  $userId = $I->haveUserInDatabase('luca', 'editor', ['user_email' => 'luca@example.org']);
                                                                                                                                                                                    -  // Create a subscriber user in blog 1.
                                                                                                                                                                                    -  $subscriberId = $I->haveUserInDatabase('subscriber');
                                                                                                                                                                                    -  // Create a user editor in blog 1, author in blog 2, administrator in blog 3.
                                                                                                                                                                                    -  $userWithMeta = $I->haveUserInDatabase('luca',
                                                                                                                                                                                    -  [
                                                                                                                                                                                    -  1 => 'editor',
                                                                                                                                                                                    -  2 => 'author',
                                                                                                                                                                                    -  3 => 'administrator'
                                                                                                                                                                                    -  ], [
                                                                                                                                                                                    -  'user_email' => 'luca@example.org'
                                                                                                                                                                                    -  'meta' => ['a meta_key' => 'a_meta_value']
                                                                                                                                                                                    -  ]
                                                                                                                                                                                    -  );
                                                                                                                                                                                    -  // Create editor in blog 1 w/ `edit_themes` cap, author in blog 2, admin in blog 3 w/o `manage_options` cap.
                                                                                                                                                                                    -  $userWithMeta = $I->haveUserInDatabase('luca',
                                                                                                                                                                                    -  [
                                                                                                                                                                                    -  1 => ['editor', 'edit_themes'],
                                                                                                                                                                                    -  2 => 'author',
                                                                                                                                                                                    -  3 => ['administrator' => true, 'manage_options' => false]
                                                                                                                                                                                    -  ]
                                                                                                                                                                                    -  );
                                                                                                                                                                                    -  // Create a user w/o role.
                                                                                                                                                                                    -  $userId = $I->haveUserInDatabase('luca', '');
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string $user_login - The user login name.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • string/string/\Codeception\Module\array $role - The user role slug(s), e.g. administrator or ['author', 'editor'];
                                                                                                                                                                                    • -
                                                                                                                                                                                    • array/\Codeception\Module\array/array $overrides - An associative array of column names and values overriding defaults
                                                                                                                                                                                    - -

                                                                                                                                                                                    haveUserLevelsInDatabase

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Sets the user access level meta in the database for a user. IDs/roles for a multisite installation (e.g. [1 => 'administrator, 2 => 'subscriber']`).

                                                                                                                                                                                    - -
                                                                                                                                                                                    $userId = $I->haveUserInDatabase('luca', 'editor');
                                                                                                                                                                                    -  $moreThanAnEditorLessThanAnAdmin = 8;
                                                                                                                                                                                    -  $I->haveUserLevelsInDatabase($userId, $moreThanAnEditorLessThanAnAdmin);
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • int $userId - The ID of the user to set the level for.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • \Codeception\Module\array/string $role - Either a role string (e.g. administrator) or an array of blog
                                                                                                                                                                                    - -

                                                                                                                                                                                    haveUserMetaInDatabase

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Sets a user meta in the database.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $userId = $I->haveUserInDatabase('luca', 'editor');
                                                                                                                                                                                    -  $I->haveUserMetaInDatabase($userId, 'karma', 23);
                                                                                                                                                                                    -  values will trigger the insertion of multiple rows.
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • int $userId - The user ID.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • string $meta_key - The meta key to set the value for.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • mixed $meta_value - Either a single value or an array of values; objects will be serialized while array of
                                                                                                                                                                                    - -

                                                                                                                                                                                    importSql

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Loads a set SQL code lines in the current database.

                                                                                                                                                                                    - -
                                                                                                                                                                                    // Import a SQL string.
                                                                                                                                                                                    -  $I->importSql([$sqlString]);
                                                                                                                                                                                    -  // Import a set of SQL strings.
                                                                                                                                                                                    -  $I->importSql($sqlStrings);
                                                                                                                                                                                    -  // Import a prepared set of SQL strings.
                                                                                                                                                                                    -  $preparedSqlStrings = array_map(function($line){
                                                                                                                                                                                    -  return str_replace('{{date}}', date('Y-m-d H:i:s'), $line);
                                                                                                                                                                                    -  }, $sqlTemplate);
                                                                                                                                                                                    -  $I->importSql($preparedSqlStrings);
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • \Codeception\Module\array/array $sql - The SQL strings to load.
                                                                                                                                                                                    - -

                                                                                                                                                                                    importSqlDumpFile

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Import the SQL dump file if populate is enabled.

                                                                                                                                                                                    - -
                                                                                                                                                                                    // Import a dump file passing the absolute path.
                                                                                                                                                                                    -  $I->importSqlDumpFile(codecept_data_dir('dumps/start.sql'));
                                                                                                                                                                                    -  Specifying a dump file that file will be imported.
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string/null $dumpFile - The dump file that should be imported in place of the default one.
                                                                                                                                                                                    - -

                                                                                                                                                                                    seeAttachmentInDatabase

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Checks for an attachment in the database.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $url = 'https://example.org/images/foo.png';
                                                                                                                                                                                    -  $I->seeAttachmentInDatabase(['guid' => $url]);
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • \Codeception\Module\array/array $criteria - An array of search criteria.
                                                                                                                                                                                    - -

                                                                                                                                                                                    seeBlogInDatabase

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Checks for a blog in the blogs table.

                                                                                                                                                                                    - -
                                                                                                                                                                                    // Search for a blog by `blog_id`.
                                                                                                                                                                                    -  $I->seeBlogInDatabase(['blog_id' => 23]);
                                                                                                                                                                                    -  // Search for all blogs on a path.
                                                                                                                                                                                    -  $I->seeBlogInDatabase(['path' => '/sub-path/']);
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • \Codeception\Module\array/array $criteria - An array of search criteria.
                                                                                                                                                                                    - -

                                                                                                                                                                                    seeCommentInDatabase

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Checks for a comment in the database. Will look up the "comments" table.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $I->seeCommentInDatabase(['comment_ID' => 23]);
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • \Codeception\Module\array/array $criteria - An array of search criteria.
                                                                                                                                                                                    - -

                                                                                                                                                                                    seeCommentMetaInDatabase

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Checks that a comment meta value is in the database. Will look up the "commentmeta" table.

                                                                                                                                                                                    - -
                                                                                                                                                                                    // Assert a specified meta for a comment exists.
                                                                                                                                                                                    -  $I->seeCommentMetaInDatabase(['comment_ID' => $commentId, 'meta_key' => 'karma', 'meta_value' => 23]);
                                                                                                                                                                                    -  // Assert the comment has at least one meta set.
                                                                                                                                                                                    -  $I->seeCommentMetaInDatabase(['comment_ID' => $commentId]);
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • \Codeception\Module\array/array $criteria - An array of search criteria.
                                                                                                                                                                                    - -

                                                                                                                                                                                    seeLinkInDatabase

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Checks for a link in the links table of the database.

                                                                                                                                                                                    - -
                                                                                                                                                                                    // Asserts a link exists by name.
                                                                                                                                                                                    -  $I->seeLinkInDatabase(['link_name' => 'my-link']);
                                                                                                                                                                                    -  // Asserts at least one link exists for the user.
                                                                                                                                                                                    -  $I->seeLinkInDatabase(['link_owner' => $userId]);
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • \Codeception\Module\array/array $criteria - An array of search criteria.
                                                                                                                                                                                    - -

                                                                                                                                                                                    seeOptionInDatabase

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Checks if an option is in the database for the current blog, either by criteria or by name and value. If checking for an array or an object then the serialized version will be checked for.

                                                                                                                                                                                    - -
                                                                                                                                                                                    // Checks an option is in the database.
                                                                                                                                                                                    -  $I->seeOptionInDatabase('tables_version');
                                                                                                                                                                                    -  // Checks an option is in the database and has a specific value.
                                                                                                                                                                                    -  $I->seeOptionInDatabase('tables_version', '1.0');
                                                                                                                                                                                    -  $I->seeOptionInDatabase(['option_name' => 'tables_version', 'option_value' => 1.0']);
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • \Codeception\Module\array/string $criteriaOrName - An array of search criteria or the option name.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • mixed/null $value - The optional value to try and match, only used if the option name is provided.
                                                                                                                                                                                    - -

                                                                                                                                                                                    seePageInDatabase

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Checks for a page in the database.

                                                                                                                                                                                    - -
                                                                                                                                                                                    // Asserts a page with an exists in the database.
                                                                                                                                                                                    -  $I->seePageInDatabase(['ID' => 23]);
                                                                                                                                                                                    -  // Asserts a page with a slug and ID exists in the database.
                                                                                                                                                                                    -  $I->seePageInDatabase(['post_title' => 'Test Page', 'ID' => 23]);
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • \Codeception\Module\array/array $criteria - An array of search criteria.
                                                                                                                                                                                    - -

                                                                                                                                                                                    seePostInDatabase

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Checks for a post in the database.

                                                                                                                                                                                    - -
                                                                                                                                                                                    // Assert a post exists in the database.
                                                                                                                                                                                    -  $I->seePostInDatabase(['ID' => 23]);
                                                                                                                                                                                    -  // Assert a post with a slug and ID exists in the database.
                                                                                                                                                                                    -  $I->seePostInDatabase(['post_content' => 'test content', 'ID' => 23]);
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • \Codeception\Module\array/array $criteria - An array of search criteria.
                                                                                                                                                                                    - -

                                                                                                                                                                                    seePostMetaInDatabase

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Checks for a post meta value in the database for the current blog. If the meta_value is an object or an array then the check will be made for serialized values.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $postId = $I->havePostInDatabase(['meta_input' => ['foo' => 'bar']];
                                                                                                                                                                                    -  $I->seePostMetaInDatabase(['post_id' => '$postId', 'meta_key' => 'foo']);
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • \Codeception\Module\array/array $criteria - An array of search criteria.
                                                                                                                                                                                    - -

                                                                                                                                                                                    seePostWithTermInDatabase

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Checks that a post to term relation exists in the database. The method will check the "term_relationships" table.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $fiction = $I->haveTermInDatabase('fiction', 'genre');
                                                                                                                                                                                    -  $postId = $I->havePostInDatabase(['tax_input' => ['genre' => ['fiction']]]);
                                                                                                                                                                                    -  $I->seePostWithTermInDatabase($postId, $fiction['term_taxonomy_id']);
                                                                                                                                                                                    -  passed this parameter will be interpreted as a `term_id`, else as a
                                                                                                                                                                                    -  the
                                                                                                                                                                                    -  term order.
                                                                                                                                                                                    -  to build a `taxonomy_term_id` from the `term_id`.
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • int $post_id - The post ID.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • int $term_taxonomy_id - The term term_id or term_taxonomy_id; if the $taxonomy argument is
                                                                                                                                                                                    • -
                                                                                                                                                                                    • int/null $term_order - The order the term applies to the post, defaults to null to not use
                                                                                                                                                                                    • -
                                                                                                                                                                                    • string/null $taxonomy - The taxonomy the term_id is for; if passed this parameter will be used
                                                                                                                                                                                    - -

                                                                                                                                                                                    seeSiteOptionInDatabase

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Checks that a site option is in the database.

                                                                                                                                                                                    - -
                                                                                                                                                                                    // Check that the option is set in the database.
                                                                                                                                                                                    -  $I->seeSiteOptionInDatabase('foo_count');
                                                                                                                                                                                    -  // Check that the option is set and has a specific value.
                                                                                                                                                                                    -  $I->seeSiteOptionInDatabase('foo_count', 23);
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • \Codeception\Module\array/string $criteriaOrName - An array of search criteria or the option name.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • mixed/null $value - The optional value to try and match, only used if the option name is provided.
                                                                                                                                                                                    - -

                                                                                                                                                                                    seeSiteSiteTransientInDatabase

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Checks that a site option is in the database.

                                                                                                                                                                                    - -
                                                                                                                                                                                    // Check a transient exists.
                                                                                                                                                                                    -  $I->seeSiteSiteTransientInDatabase('total_counts');
                                                                                                                                                                                    -  // Check a transient exists and has a specific value.
                                                                                                                                                                                    -  $I->seeSiteSiteTransientInDatabase('total_counts', 23);
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string $key - The name of the transient to check for, w/o the _site_transient_ prefix.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • mixed/null $value - If provided then the assertion will include the value.
                                                                                                                                                                                    - -

                                                                                                                                                                                    seeTableInDatabase

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Checks that a table is in the database.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $options = $I->grabPrefixedTableNameFor('options');
                                                                                                                                                                                    -  $I->seeTableInDatabase($options);
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string $table - The full table name, including the table prefix.
                                                                                                                                                                                    - -

                                                                                                                                                                                    seeTermInDatabase

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Checks for a term in the database. Looks up the terms and term_taxonomy prefixed tables. and the term_taxonomy tables.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $I->seeTermInDatabase(['slug' => 'genre--fiction']);
                                                                                                                                                                                    -  $I->seeTermInDatabase(['name' => 'Fiction', 'slug' => 'genre--fiction']);
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • \Codeception\Module\array/array $criteria - An array of criteria to search for the term, can be columns from the terms
                                                                                                                                                                                    - -

                                                                                                                                                                                    seeTermMetaInDatabase

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Checks for a term meta in the database.

                                                                                                                                                                                    - -
                                                                                                                                                                                    list($termId, $termTaxonomyId) = $I->haveTermInDatabase('fiction', 'genre');
                                                                                                                                                                                    -  $I->haveTermMetaInDatabase($termId, 'rating', 4);
                                                                                                                                                                                    -  $I->seeTermMetaInDatabase(['term_id' => $termId,'meta_key' => 'rating', 'meta_value' => 4]);
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • \Codeception\Module\array/array $criteria - An array of search criteria.
                                                                                                                                                                                    - -

                                                                                                                                                                                    seeTermRelationshipInDatabase

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Checks for a term relationship in the database.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $postId = $I->havePostInDatabase(['tax_input' => ['category' => 'one']]);
                                                                                                                                                                                    -  $I->seeTermRelationshipInDatabase(['object_id' => $postId, 'term_taxonomy_id' => $oneTermTaxId]);
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • \Codeception\Module\array/array $criteria - An array of search criteria.
                                                                                                                                                                                    - -

                                                                                                                                                                                    seeTermTaxonomyInDatabase

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Checks for a taxonomy taxonomy in the database.

                                                                                                                                                                                    - -
                                                                                                                                                                                    list($termId, $termTaxonomyId) = $I->haveTermInDatabase('fiction', 'genre');
                                                                                                                                                                                    -  $I->seeTermTaxonomyInDatabase(['term_id' => $termId, 'taxonomy' => 'genre']);
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • \Codeception\Module\array/array $criteria - An array of search criteria.
                                                                                                                                                                                    - -

                                                                                                                                                                                    seeUserInDatabase

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Checks that a user is in the database. The method will check the "users" table.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $I->seeUserInDatabase([
                                                                                                                                                                                    -  "user_email" => "test@example.org",
                                                                                                                                                                                    -  "user_login" => "login name"
                                                                                                                                                                                    -  ])
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • \Codeception\Module\array/array $criteria - An array of search criteria.
                                                                                                                                                                                    - -

                                                                                                                                                                                    seeUserMetaInDatabase

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Checks for a user meta value in the database.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $I->seeUserMetaInDatabase(['user_id' => 23, 'meta_key' => 'karma']);
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • \Codeception\Module\array/array $criteria - An array of search criteria.
                                                                                                                                                                                    - -

                                                                                                                                                                                    useBlog

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Sets the blog to be used. This has nothing to do with WordPress switch_to_blog function, this code will affect the table prefixes used.

                                                                                                                                                                                    - -
                                                                                                                                                                                    // Switch to the blog with ID 23.
                                                                                                                                                                                    -  $I->useBlog(23);
                                                                                                                                                                                    -  // Switch back to the main blog.
                                                                                                                                                                                    -  $I->useMainBlog();
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • int $blogId - The ID of the blog to use.
                                                                                                                                                                                    - -

                                                                                                                                                                                    useMainBlog

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Sets the current blog to the main one (blog_id 1).

                                                                                                                                                                                    - -
                                                                                                                                                                                    // Switch to the blog with ID 23.
                                                                                                                                                                                    -  $I->useBlog(23);
                                                                                                                                                                                    -  // Switch back to the main blog.
                                                                                                                                                                                    -  $I->useMainBlog();
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    useTheme

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Sets the current theme options.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $I->useTheme('twentyseventeen');
                                                                                                                                                                                    -  $I->useTheme('child-of-twentyseventeen', 'twentyseventeen');
                                                                                                                                                                                    -  $I->useTheme('acme', 'acme', 'Acme Theme');
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string $stylesheet - The theme stylesheet slug, e.g. twentysixteen.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • string $template - The theme template slug, e.g. twentysixteen, defaults to $stylesheet.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • string $themeName - The theme name, e.g. Acme, defaults to the "title" version of
                                                                                                                                                                                    - -

                                                                                                                                                                                    This class extends \Codeception\Module\Db

                                                                                                                                                                                    -

                                                                                                                                                                                    This class implements \Codeception\Lib\Interfaces\Db

                                                                                                                                                                                    - - - - - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - -
                                                                                                                                                                                    - -
                                                                                                                                                                                    - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - - - - - - - \ No newline at end of file diff --git a/docs/public/v3/modules/WPFilesystem/index.html b/docs/public/v3/modules/WPFilesystem/index.html deleted file mode 100644 index 85dbcecba..000000000 --- a/docs/public/v3/modules/WPFilesystem/index.html +++ /dev/null @@ -1,1118 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - WPFilesystem module - wp-browser docs - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
                                                                                                                                                                                    - -
                                                                                                                                                                                    - - - - - - -
                                                                                                                                                                                    - - -
                                                                                                                                                                                    - -
                                                                                                                                                                                    - - - - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - - - - - -

                                                                                                                                                                                    WPFilesystem module

                                                                                                                                                                                    -

                                                                                                                                                                                    This module should be used in acceptance and functional tests, see levels of testing for more information.
                                                                                                                                                                                    -This module extends the Filesystem module adding WordPress-specific configuration parameters and methods.
                                                                                                                                                                                    -The module provides methods to read, write and update the WordPress filesystem directly, without relying on WordPress methods, using WordPress functions or triggering WordPress filters.
                                                                                                                                                                                    -This module also provides methods to scaffold plugins and themes on the fly in the context of tests and auto-remove them after each test.

                                                                                                                                                                                    -

                                                                                                                                                                                    Module requirements for Codeception 4.0+

                                                                                                                                                                                    -

                                                                                                                                                                                    This module requires the codeception/module-filesystem Composer package to work when wp-browser is used with Codeception 4.0.

                                                                                                                                                                                    -

                                                                                                                                                                                    To install the package run:

                                                                                                                                                                                    -
                                                                                                                                                                                    composer require --dev codeception/module-filesystem:^1.0
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Configuration

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • wpRootFolder required The absolute, or relative to the project root folder, path to the root WordPress installation folder. The WordPress installation root folder is the one that contains the wp-load.php file.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • themes - defaults to /wp-content/themes; the path, relative to the the WordPress installation root folder, to the themes folder.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • plugins - defaults to /wp-content/plugins; the path, relative to the WordPress installation root folder, to the plugins folder.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • mu-plugins - defaults to wp-content/mu-plugins; the path, relative to the WordPress installation root folder, to the must-use plugins folder.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • uploads - defaults to /wp-content/uploads; the path, relative to the WordPress installation root folder, to the uploads folder.
                                                                                                                                                                                    • -
                                                                                                                                                                                    -

                                                                                                                                                                                    Example configuration

                                                                                                                                                                                    -
                                                                                                                                                                                    modules:
                                                                                                                                                                                    -    enabled:
                                                                                                                                                                                    -        - WPFilesystem
                                                                                                                                                                                    -    config:
                                                                                                                                                                                    -        WPFilesystem:
                                                                                                                                                                                    -            wpRootFolder: "/var/www/wordpress"
                                                                                                                                                                                    -
                                                                                                                                                                                    - - -

                                                                                                                                                                                    Public API

                                                                                                                                                                                    - - -

                                                                                                                                                                                    amInMuPluginPath

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Sets the current working folder to a folder in a mu-plugin.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $I->amInMuPluginPath('mu-plugin');
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string $path - The path to the folder, relative to the mu-plugins root folder.
                                                                                                                                                                                    - -

                                                                                                                                                                                    amInPluginPath

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Sets the current working folder to a folder in a plugin.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $I->amInPluginPath('my-plugin');
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string $path - The folder path, relative to the root uploads folder, to change to.
                                                                                                                                                                                    - -

                                                                                                                                                                                    amInThemePath

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Sets the current working folder to a folder in a theme.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $I->amInThemePath('my-theme');
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string $path - The path to the theme folder, relative to themes root folder.
                                                                                                                                                                                    - -

                                                                                                                                                                                    amInUploadsPath

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Enters, changing directory, to the uploads folder in the local filesystem.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $I->amInUploadsPath('/logs');
                                                                                                                                                                                    -  $I->seeFileFound('shop.log');
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string $path - The path, relative to the site uploads folder.
                                                                                                                                                                                    - -

                                                                                                                                                                                    cleanMuPluginDir

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Cleans, emptying it, a folder in a mu-plugin folder.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $I->cleanMuPluginDir('mu-plugin1/foo');
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string $dir - The path to the directory, relative to the mu-plugins root folder.
                                                                                                                                                                                    - -

                                                                                                                                                                                    cleanPluginDir

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Cleans, emptying it, a folder in a plugin folder.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $I->cleanPluginDir('my-plugin/foo');
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string $dir - The path to the folder, relative to the plugins root folder.
                                                                                                                                                                                    - -

                                                                                                                                                                                    cleanThemeDir

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Clears, emptying it, a folder in a theme folder.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $I->cleanThemeDir('my-theme/foo');
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string $dir - The path to the folder, relative to the themese root folder.
                                                                                                                                                                                    - -

                                                                                                                                                                                    cleanUploadsDir

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Clears a folder in the uploads folder. The date argument can be a string compatible with strtotime or a Unix timestamp that will be used to build the Y/m uploads subfolder path.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $I->cleanUploadsDir('some/folder');
                                                                                                                                                                                    -  $I->cleanUploadsDir('some/folder', 'today');
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string $dir - The path to the directory to delete, relative to the uploads folder.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • string/int/[\DateTime](http://php.net/manual/en/class.datetime.php) $date - The date of the uploads to delete, will default to now.
                                                                                                                                                                                    - -

                                                                                                                                                                                    copyDirToMuPlugin

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Copies a folder to a folder in a mu-plugin.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $I->copyDirToMuPlugin(codecept_data_dir('foo'), 'mu-plugin/foo');
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string $src - The path to the source file to copy.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • string $pluginDst - The path to the destination folder, relative to the mu-plugins root folder.
                                                                                                                                                                                    - -

                                                                                                                                                                                    copyDirToPlugin

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Copies a folder to a folder in a plugin.

                                                                                                                                                                                    - -
                                                                                                                                                                                    // Copy the 'foo' folder to the 'foo' folder in the plugin.
                                                                                                                                                                                    -  $I->copyDirToPlugin(codecept_data_dir('foo'), 'my-plugin/foo');
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string $src - The path to the source directory to copy.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • string $pluginDst - The destination path, relative to the plugins root folder.
                                                                                                                                                                                    - -

                                                                                                                                                                                    copyDirToTheme

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Copies a folder in a theme folder.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $I->copyDirToTheme(codecept_data_dir('foo'), 'my-theme');
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string $src - The path to the source file.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • string $themeDst - The path to the destination folder, relative to the themes root folder.
                                                                                                                                                                                    - -

                                                                                                                                                                                    copyDirToUploads

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Copies a folder to the uploads folder. The date argument can be a string compatible with strtotime or a Unix timestamp that will be used to build the Y/m uploads subfolder path.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $I->copyDirToUploads(codecept_data_dir('foo'), 'uploadsFoo');
                                                                                                                                                                                    -  $I->copyDirToUploads(codecept_data_dir('foo'), 'uploadsFoo', 'today');
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string $src - The path to the source file, relative to the current uploads folder.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • string $dst - The path to the destination file, relative to the current uploads folder.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • string/int/[\DateTime](http://php.net/manual/en/class.datetime.php) $date - The date of the uploads to delete, will default to now.
                                                                                                                                                                                    - -

                                                                                                                                                                                    deleteMuPluginFile

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Deletes a file in a mu-plugin folder.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $I->deleteMuPluginFile('mu-plugin1/some-file.txt');
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string $file - The path to the file, relative to the mu-plugins root folder.
                                                                                                                                                                                    - -

                                                                                                                                                                                    deletePluginFile

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Deletes a file in a plugin folder.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $I->deletePluginFile('my-plugin/some-file.txt');
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string $file - The folder path, relative to the plugins root folder.
                                                                                                                                                                                    - -

                                                                                                                                                                                    deleteThemeFile

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Deletes a file in a theme folder.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $I->deleteThemeFile('my-theme/some-file.txt');
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string $file - The path to the file to delete, relative to the themes root folder.
                                                                                                                                                                                    - -

                                                                                                                                                                                    deleteUploadedDir

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Deletes a dir in the uploads folder. The date argument can be a string compatible with strtotime or a Unix timestamp that will be used to build the Y/m uploads subfolder path.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $I->deleteUploadedDir('folder');
                                                                                                                                                                                    -  $I->deleteUploadedDir('folder', 'today');
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string $dir - The path to the directory to delete, relative to the uploads folder.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • string/int/[\DateTime](http://php.net/manual/en/class.datetime.php) $date - The date of the uploads to delete, will default to now.
                                                                                                                                                                                    - -

                                                                                                                                                                                    deleteUploadedFile

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Deletes a file in the uploads folder. The date argument can be a string compatible with strtotime or a Unix timestamp that will be used to build the Y/m uploads subfolder path.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $I->deleteUploadedFile('some-file.txt');
                                                                                                                                                                                    -  $I->deleteUploadedFile('some-file.txt', 'today');
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string $file - The file path, relative to the uploads folder or the current folder.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • string/int $date - A string compatible with strtotime or a Unix timestamp.
                                                                                                                                                                                    - -

                                                                                                                                                                                    dontSeeInMuPluginFile

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Checks that a file in a mu-plugin folder does not contain a string.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $I->dontSeeInMuPluginFile('mu-plugin1/some-file.txt', 'foo');
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string $file - The path to the file, relative to the mu-plugins root folder.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • string $contents - The contents to check the file for.
                                                                                                                                                                                    - -

                                                                                                                                                                                    dontSeeInPluginFile

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Checks that a file in a plugin folder does not contain a string.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $I->dontSeeInPluginFile('my-plugin/some-file.txt', 'foo');
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string $file - The path to the file, relative to the plugins root folder.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • string $contents - The contents to check the file for.
                                                                                                                                                                                    - -

                                                                                                                                                                                    dontSeeInThemeFile

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Checks that a file in a theme folder does not contain a string.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $I->dontSeeInThemeFile('my-theme/some-file.txt', 'foo');
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string $file - The path to the file, relative to the themes root folder.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • string $contents - The contents to check the file for.
                                                                                                                                                                                    - -

                                                                                                                                                                                    dontSeeInUploadedFile

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Checks that a file in the uploads folder does contain a string. The date argument can be a string compatible with strtotime or a Unix timestamp that will be used to build the Y/m uploads subfolder path.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $I->dontSeeInUploadedFile('some-file.txt', 'foo');
                                                                                                                                                                                    -  $I->dontSeeInUploadedFile('some-file.txt','foo', 'today');
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string $file - The file path, relative to the uploads folder or the current folder.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • string $contents - The not expected file contents or part of them.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • string/int $date - A string compatible with strtotime or a Unix timestamp.
                                                                                                                                                                                    - -

                                                                                                                                                                                    dontSeeMuPluginFileFound

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Checks that a file is not found in a mu-plugin folder.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $I->dontSeeMuPluginFileFound('mu-plugin1/some-file.txt');
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string $file - The path to the file, relative to the mu-plugins folder.
                                                                                                                                                                                    - -

                                                                                                                                                                                    dontSeePluginFileFound

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Checks that a file is not found in a plugin folder.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $I->dontSeePluginFileFound('my-plugin/some-file.txt');
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string $file - The path to the file, relative to the plugins root folder.
                                                                                                                                                                                    - -

                                                                                                                                                                                    dontSeeThemeFileFound

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Checks that a file is not found in a theme folder.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $I->dontSeeThemeFileFound('my-theme/some-file.txt');
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string $file - The path to the file, relative to the themes root folder.
                                                                                                                                                                                    - -

                                                                                                                                                                                    dontSeeUploadedFileFound

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Checks thata a file does not exist in the uploads folder. The date argument can be a string compatible with strtotime or a Unix timestamp that will be used to build the Y/m uploads subfolder path.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $I->dontSeeUploadedFileFound('some-file.txt');
                                                                                                                                                                                    -  $I->dontSeeUploadedFileFound('some-file.txt','today');
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string $file - The file path, relative to the uploads folder or the current folder.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • string/int $date - A string compatible with strtotime or a Unix timestamp.
                                                                                                                                                                                    - -

                                                                                                                                                                                    getBlogUploadsPath

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Returns the absolute path to a blog uploads folder or file.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $blogId = $I->haveBlogInDatabase('test');
                                                                                                                                                                                    -  $testTodayUploads = $I->getBlogUploadsPath($blogId);
                                                                                                                                                                                    -  $testLastMonthLogs = $I->getBlogUploadsPath($blogId, '/logs', '-1 month');
                                                                                                                                                                                    -  file or folder.
                                                                                                                                                                                    -  sub-folders in the year/month format; a UNIX timestamp or
                                                                                                                                                                                    -  a string supported by the `strtotime` function; defaults
                                                                                                                                                                                    -  to `now`.
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • int $blogId - The blog ID to get the path for.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • string $file - The path, relatitve to the blog uploads folder, to the
                                                                                                                                                                                    • -
                                                                                                                                                                                    • null/string/[\DateTime](http://php.net/manual/en/class.datetime.php)/[\DateTime](http://php.net/manual/en/class.datetime.php)Immutable $date - The date that should be used to build the uploads
                                                                                                                                                                                    - -

                                                                                                                                                                                    getUploadsPath

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Returns the path to the specified uploads file of folder. Not providing a value for $file and $date will return the uploads folder path.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $todaysPath = $I->getUploadsPath();
                                                                                                                                                                                    -  $lastWeek = $I->getUploadsPath('', '-1 week');
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string $file - The file path, relative to the uploads folder.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • mixed $date - A string compatible with strtotime, a Unix timestamp or a Date object.
                                                                                                                                                                                    - -

                                                                                                                                                                                    getWpRootFolder

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Returns the absolute path to WordPress root folder without trailing slash.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $rootFolder = $I->getWpRootFolder();
                                                                                                                                                                                    -  $I->assertFileExists($rootFolder . 'wp-load.php');
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    haveMuPlugin

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Creates a mu-plugin file, including plugin header, in the mu-plugins folder. The code can not contain the opening '<?php' tag.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $code = 'echo "Hello world!"';
                                                                                                                                                                                    -  $I->haveMuPlugin('foo-mu-plugin.php', $code);
                                                                                                                                                                                    -  // Load the code from a file.
                                                                                                                                                                                    -  $code = file_get_contents(codecept_data_dir('code/mu-plugin.php'));
                                                                                                                                                                                    -  $I->haveMuPlugin('foo-mu-plugin.php', $code);
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string $filename - The path to the file to create, relative to the plugins root folder.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • string $code - The content of the plugin file with or without the opening PHP tag.
                                                                                                                                                                                    - -

                                                                                                                                                                                    havePlugin

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Creates a plugin file, including plugin header, in the plugins folder. The plugin is just created and not activated; the code can not contain the opening '<?php' tag.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $code = 'echo "Hello world!"';
                                                                                                                                                                                    -  $I->havePlugin('foo/plugin.php', $code);
                                                                                                                                                                                    -  // Load the code from a file.
                                                                                                                                                                                    -  $code = file_get_contents(codecept_data_dir('code/plugin.php'));
                                                                                                                                                                                    -  $I->havePlugin('foo/plugin.php', $code);
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string $path - The path to the file to create, relative to the plugins folder.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • string $code - The content of the plugin file with or without the opening PHP tag.
                                                                                                                                                                                    - -

                                                                                                                                                                                    haveTheme

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Creates a theme file structure, including theme style file and index, in the themes folder. The theme is just created and not activated; the code can not contain the opening '<?php' tag.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $code = 'sayHi();';
                                                                                                                                                                                    -  $functionsCode  = 'function sayHi(){echo "Hello world";};';
                                                                                                                                                                                    -  $I->haveTheme('foo', $indexCode, $functionsCode);
                                                                                                                                                                                    -  // Load the code from a file.
                                                                                                                                                                                    -  $indexCode = file_get_contents(codecept_data_dir('code/index.php'));
                                                                                                                                                                                    -  $functionsCode = file_get_contents(codecept_data_dir('code/functions.php'));
                                                                                                                                                                                    -  $I->haveTheme('foo', $indexCode, $functionsCode);
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string $folder - The path to the theme to create, relative to the themes root folder.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • string $indexFileCode - The content of the theme index.php file with or without the opening PHP tag.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • string $functionsFileCode - The content of the theme functions.php file with or without the opening PHP tag.
                                                                                                                                                                                    - -

                                                                                                                                                                                    makeUploadsDir

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Creates an empty folder in the WordPress installation uploads folder.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $logsDir = $I->makeUploadsDir('logs/acme');
                                                                                                                                                                                    -  to create.
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string $path - The path, relative to the WordPress installation uploads folder, of the folder
                                                                                                                                                                                    - -

                                                                                                                                                                                    openUploadedFile

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Opens a file in the the uploads folder. The date argument can be a string compatible with strtotime or a Unix timestamp that will be used to build the Y/m uploads subfolder path.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $I->openUploadedFile('some-file.txt');
                                                                                                                                                                                    -  $I->openUploadedFile('some-file.txt', 'time');
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string $filename - The path to the file, relative to the current uploads folder.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • string/int/[\DateTime](http://php.net/manual/en/class.datetime.php) $date - The date of the uploads to delete, will default to now.
                                                                                                                                                                                    - -

                                                                                                                                                                                    seeInMuPluginFile

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Checks that a file in a mu-plugin folder contains a string.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $I->seeInMuPluginFile('mu-plugin1/some-file.txt', 'foo');
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string $file - The path the file, relative to the mu-plugins root folder.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • string $contents - The contents to check the file for.
                                                                                                                                                                                    - -

                                                                                                                                                                                    seeInPluginFile

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Checks that a file in a plugin folder contains a string.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $I->seeInPluginFile('my-plugin/some-file.txt', 'foo');
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string $file - The path to the file, relative to the plugins root folder.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • string $contents - The contents to check the file for.
                                                                                                                                                                                    - -

                                                                                                                                                                                    seeInThemeFile

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Checks that a file in a theme folder contains a string.

                                                                                                                                                                                    - -
                                                                                                                                                                                    <?php
                                                                                                                                                                                    -  $I->seeInThemeFile('my-theme/some-file.txt', 'foo');
                                                                                                                                                                                    -  ?>
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string $file - The path to the file, relative to the themes root folder.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • string $contents - The contents to check the file for.
                                                                                                                                                                                    - -

                                                                                                                                                                                    seeInUploadedFile

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Checks that a file in the uploads folder contains a string. The date argument can be a string compatible with strtotime or a Unix timestamp that will be used to build the Y/m uploads subfolder path.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $I->seeInUploadedFile('some-file.txt', 'foo');
                                                                                                                                                                                    -  $I->seeInUploadedFile('some-file.txt','foo', 'today');
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string $file - The file path, relative to the uploads folder or the current folder.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • string $contents - The expected file contents or part of them.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • string/int $date - A string compatible with strtotime or a Unix timestamp.
                                                                                                                                                                                    - -

                                                                                                                                                                                    seeMuPluginFileFound

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Checks that a file is found in a mu-plugin folder.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $I->seeMuPluginFileFound('mu-plugin1/some-file.txt');
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string $file - The path to the file, relative to the mu-plugins folder.
                                                                                                                                                                                    - -

                                                                                                                                                                                    seePluginFileFound

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Checks that a file is found in a plugin folder.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $I->seePluginFileFound('my-plugin/some-file.txt');
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string $file - The path to the file, relative to thep plugins root folder.
                                                                                                                                                                                    - -

                                                                                                                                                                                    seeThemeFileFound

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Checks that a file is found in a theme folder.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $I->seeThemeFileFound('my-theme/some-file.txt');
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string $file - The path to the file, relative to the themes root folder.
                                                                                                                                                                                    - -

                                                                                                                                                                                    seeUploadedFileFound

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Checks if file exists in the uploads folder. The date argument can be a string compatible with strtotime or a Unix timestamp that will be used to build the Y/m uploads subfolder path.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $I->seeUploadedFileFound('some-file.txt');
                                                                                                                                                                                    -  $I->seeUploadedFileFound('some-file.txt','today');
                                                                                                                                                                                    -  ?>
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string $filename - The file path, relative to the uploads folder or the current folder.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • string/int $date - A string compatible with strtotime or a Unix timestamp.
                                                                                                                                                                                    - -

                                                                                                                                                                                    writeToMuPluginFile

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Writes a file in a mu-plugin folder.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $I->writeToMuPluginFile('mu-plugin1/some-file.txt', 'foo');
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string $file - The path to the destination file, relative to the mu-plugins root folder.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • string $data - The data to write to the file.
                                                                                                                                                                                    - -

                                                                                                                                                                                    writeToPluginFile

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Writes a file in a plugin folder.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $I->writeToPluginFile('my-plugin/some-file.txt', 'foo');
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string $file - The path to the file, relative to the plugins root folder.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • string $data - The data to write in the file.
                                                                                                                                                                                    - -

                                                                                                                                                                                    writeToThemeFile

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Writes a string to a file in a theme folder.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $I->writeToThemeFile('my-theme/some-file.txt', 'foo');
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string $file - The path to the file, relative to the themese root folder.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • string $data - The data to write to the file.
                                                                                                                                                                                    - -

                                                                                                                                                                                    writeToUploadedFile

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Writes a string to a file in the the uploads folder. The date argument can be a string compatible with strtotime or a Unix timestamp that will be used to build the Y/m uploads subfolder path.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $I->writeToUploadedFile('some-file.txt', 'foo bar');
                                                                                                                                                                                    -  $I->writeToUploadedFile('some-file.txt', 'foo bar', 'today');
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string $filename - The path to the destination file, relative to the current uploads folder.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • string $data - The data to write to the file.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • string/int/[\DateTime](http://php.net/manual/en/class.datetime.php) $date - The date of the uploads to delete, will default to now.
                                                                                                                                                                                    - -

                                                                                                                                                                                    This class extends \Codeception\Module\Filesystem

                                                                                                                                                                                    - - - - - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - -
                                                                                                                                                                                    - -
                                                                                                                                                                                    - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - - - - - - - \ No newline at end of file diff --git a/docs/public/v3/modules/WPLoader/index.html b/docs/public/v3/modules/WPLoader/index.html deleted file mode 100644 index 7ab98ac95..000000000 --- a/docs/public/v3/modules/WPLoader/index.html +++ /dev/null @@ -1,679 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - WPLoader module - wp-browser docs - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
                                                                                                                                                                                    - -
                                                                                                                                                                                    - - - - - - -
                                                                                                                                                                                    - - -
                                                                                                                                                                                    - -
                                                                                                                                                                                    - - - - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - - - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - - - - - -

                                                                                                                                                                                    WPLoader module

                                                                                                                                                                                    -

                                                                                                                                                                                    This module should be used in integration tests, see levels of testing for more information, to bootstrap WordPress code in the context of the tests.
                                                                                                                                                                                    -Setting the loadOnly parameter to true the module can be additionally used in acceptance and functional tests to access WordPress code in the tests context.
                                                                                                                                                                                    -This module is a wrapper around the functionalities provided by the WordPress PHPUnit Core test suite, as such it provides the same method and facilities.
                                                                                                                                                                                    -The parameters provided to the module duplicate the ones used in the WordPress configuration file: the WPLoader module will not bootstrap WordPress using the wp-config.php file, it will define and use its own WordPress configuration built from the module parameters.

                                                                                                                                                                                    -

                                                                                                                                                                                    Everything happens in a transaction

                                                                                                                                                                                    -

                                                                                                                                                                                    When used to bootstrap and install WordPress (loadOnly: false) exactly as the the WordPress PHPUnit Core test suite it is based on, this module will operate any change to the database in a transaction.
                                                                                                                                                                                    -This means that, in the context of integration tests, the result of any write or delete operation done during the tests will be rolled back at the end of each test method; this is done for a number of reasons like performance and tests independence.
                                                                                                                                                                                    -Inspection of the database during tests, e.g. stopping execution using XDebug, will not show any change in the database. -Keep this in mind while trying to debug integration tests using the WPLoader module.
                                                                                                                                                                                    -When configured to only load WordPress (loadOnly: true) then any database operation will be committed and written to the database.

                                                                                                                                                                                    -

                                                                                                                                                                                    Configuration

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • wpRootFolder required The absolute, or relative to the project root folder, path to the root WordPress installation folder. The WordPress installation root folder is the one that contains the wp-load.php file.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • dbName required - The name of the database used by the WordPress installation, same as the DB_NAME constant.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • dbHost required - The host of the database used by the WordPress installation, same as the DB_HOST constant. If the database is accessible (as is the case on the latest version of [Local by Flywheel][http://localwp.com]) via unix socket, then the string to insert here should look like this localhost:/path/to/the/mysql.sock.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • dbUser required - The user of the database used by the WordPress installation, same as the DB_USER constant.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • dbPassword required - The password of the database used by the WordPress installation, same as DB_PASSWORD constant.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • loadOnly - defaults to false; whether to only load WordPress, without bootstrapping a fresh installation for tests or not. Read more in the "Using WPLoader in acceptance and functional tests" section. If this parameter is set to true the following parameters will not apply.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • isolatedInstall - defaults to true, whether to install and bootstrap the WordPress installation in a secondary PHP thread for thread safety or not. Maintained for back-compatibility purposes with wp-browser first versions: to get a replica of the bootstrap process used by WordPress Core PHPUnit tests leave this to true.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • installationTableHandling - defaults to empty; it controls how tables created by WordPress and plugins will be handled during the installation of WordPress during tests. By default tables will be emptied of any content, but some plugins might require tables to be dropped before WordPress is installed and after plugins are activated (this used to be the default behavior). Supported values are drop to drop the tables, empty to just empty the tables and let to do nothing about the tables. If you get errors from database queries while the WPLoader module installs the tests, then try changing this parameter value.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • wpDebug - defaults to true, the value the WP_DEBUG constant will be set to.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • multisite - defaults to false, the value the MULTISITE constant will be set to.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • skipPluggables - defaults to false, if set to true will skip the definition of pluggable functions.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • dbCharset - defaults to utf8, the value the DB_CHARSET constant will be set to.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • dbCollate - defaults to an empty string, the value the DB_COLLATE constant will be set to.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • tablePrefix - defaults to wptests_, the value the $table_prefix variable will be set to.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • domain - defaults to example.org, the domain of the WordPress site to scaffold for the tests.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • adminEmail - defaults to admin@example.org, the email of the WordPress site to scaffold for the tests.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • title - defaults to Test Blog, the title of the WordPress site to scaffolded for the tests.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • phpBinary - defaults to php, the PHP binary the host machine will have to use to bootstrap and load the test WordPress installation.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • language - defaults to an empty string, the language of the WordPress installation to scaffold.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • configFile - defaults to an empty string, an additional configuration file to include before loading WordPress. Any instruction in this fill will run before any WordPress file is included.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • contentFolder - defaults to an empty string; the path, relative to the wpRootFolder or absolute, to the content folder if different from the default one or the one defined by the WP_CONTENT_DIR constant; if the WP_CONTENT_DIR constant is defined in a config file (see the configFile parameter) this will be ignored.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • pluginsFolder - defaults to an empty string; the path, relative to the wpRootFolder or absolute, to the plugins folder from the wpRootFolder if different from the default one or the one defined by the WP_PLUGIN_DIR constant; if the WP_PLUGIN_DIR constant is defined in a config file (see the configFile parameter) this will be ignored.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • plugins - defaults to an empty string; a list of plugins that should be loaded before any test case runs and after mu-plugins have been loaded; these should be defined in the folder/plugin-file.php format.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • activatePlugins - defaults to an empty string, a list of plugins that will be activated before any test case runs and after WordPress is fully loaded and set up; these should be defined in the folder/plugin-file.php format; when the multisite option is set to true the plugins will be network activated during the installation.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • bootstrapActions - defaults to an empty string, a list of actions or static functions that should be called after before any test case runs, after plugins have been loaded and activated; static functions should be defined in the YAML array format: - yaml - bootstrapActions: - - action_one - - action_two - - [MyClass, myStaticMethod]
                                                                                                                                                                                    • -
                                                                                                                                                                                    • -

                                                                                                                                                                                      theme - defaults to an empty string, the theme that should be activated for the tests; if a string is passed then both template and stylesheet options will be set to the passed value; if an array is passed then the template and stylesheet will be set in that order:

                                                                                                                                                                                      -

                                                                                                                                                                                      yaml -theme: my-theme

                                                                                                                                                                                      -

                                                                                                                                                                                      The theme will be set to my-theme.

                                                                                                                                                                                      -

                                                                                                                                                                                      yaml -theme: [ parent, child ]

                                                                                                                                                                                      -

                                                                                                                                                                                      The template will be set to parent, the stylesheet will be set to child.

                                                                                                                                                                                      -
                                                                                                                                                                                    • -
                                                                                                                                                                                    -

                                                                                                                                                                                    A word of caution: right now the only way to write tests able to take advantage of the suite is to use the WP_UnitTestCase test case class; while the module will load fine and will raise no problems WP_UnitTestCase will take care of handling the database as intended and using another test case class will almost certainly result in an error if the test case defines more than one test method.

                                                                                                                                                                                    -

                                                                                                                                                                                    Example configuration

                                                                                                                                                                                    -
                                                                                                                                                                                      modules:
                                                                                                                                                                                    -      enabled:
                                                                                                                                                                                    -          - WPLoader
                                                                                                                                                                                    -      config:
                                                                                                                                                                                    -          WPLoader:
                                                                                                                                                                                    -              multisite: false
                                                                                                                                                                                    -              wpRootFolder: "/Users/luca/www/wordpress"
                                                                                                                                                                                    -              dbName: "wordpress_tests"
                                                                                                                                                                                    -              dbHost: "localhost"
                                                                                                                                                                                    -              dbUser: "root"
                                                                                                                                                                                    -              dbPassword: "password"
                                                                                                                                                                                    -              isolatedInstall: true
                                                                                                                                                                                    -              installationTableHandling: drop
                                                                                                                                                                                    -              tablePrefix: "wptests_"
                                                                                                                                                                                    -              domain: "wordrpess.localhost"
                                                                                                                                                                                    -              adminEmail: "admin@wordpress.localhost"
                                                                                                                                                                                    -              title: "Test Blog"
                                                                                                                                                                                    -              theme: my-theme
                                                                                                                                                                                    -              plugins: ['hello.php', 'my-plugin/my-plugin.php']
                                                                                                                                                                                    -              activatePlugins: ['hello.php', 'my-plugin/my-plugin.php']
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Usage in integration or "WordPress unit" tests

                                                                                                                                                                                    -

                                                                                                                                                                                    The most common use of this module is to run integration, or "WordPress unit" tests (see levels of testing for more information).

                                                                                                                                                                                    -

                                                                                                                                                                                    As a first step generate a WPTestCase using Codeception command-line utility (see the commands provided by wp-browser):

                                                                                                                                                                                    -
                                                                                                                                                                                    codecept generate:wpunit my_suite "Acme\User"
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Codeception will generate the tests/my_suite/Acme/UserTest.php class. -The class extends the Codeception\TestCase\WPTestCase class provided by wp-browser; this looks like a normal PHPUnit test case but has some perks due to it's mixed breed nature.
                                                                                                                                                                                    -Understanding them might help you work with it:

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • WordPress is installed and configured for the tests before the test case is loaded; WordPress defined functions and classes (and those of the plugins and themes loaded with it) will be available in the setUpBeforeClass method.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • -

                                                                                                                                                                                      WordPress is not loaded when PHPUnit will call the data provider methods; this means the post_provider method will generate a function not found exception when the test case runs as the WordPress defined methods are not loaded yet: - ``php - public function post_provider(){ - //wp_insert_post` is loaded with WordPress and WordPress has not been loaded yet! - return [ - [wp_insert_post(['post_title' => 'Test', 'post_status' => 'publish'])] - ]; - }

                                                                                                                                                                                      -

                                                                                                                                                                                      public function test_posts($post_id){ - $this->assertInstanceOf(WP_Post::class, get_post($post_id)); -} -* WordPress is reset to an initial known state before each test runs; the database transaction is rolled back to wipe any data and tables you might have manipulated in the tests, the global space is cleaned. See [Everything happens in a transaction](#everything-happens-in-a-transaction). -* This is a [Codeception Unit test](https://codeception.com/docs/05-UnitTests), as such it does provide access to the `$this->tester` property to access the methods defined in other modules loaded in the suite and to [Codeception test doubles](https://codeception.com/docs/05-UnitTests#Test-Doubles) -* This is a [PhpUnit](https://phpunit.de/ "PHPUnit – The PHP Testing Framework") test case too; there are way too many testing functions to cover to report them here but, to highlight a few: [mocking with Prophecy](https://phpunit.readthedocs.io/en/8.2/test-doubles.html) and the wealth of [PHPUnit assertion methods](https://phpunit.readthedocs.io/en/8.2/writing-tests-for-phpunit.html). -* This is kind of a WordPress Core suite test case; as such it provides access to its functions and to the often-overlooked `static::factory()` method; in this instance too there are too many methods to list them all but it's worth noting how easy it is to set up test fixtures with the factory:php -public function test_post_creation(){ - $random_post_id = static::factory()->post->create();

                                                                                                                                                                                      -
                                                                                                                                                                                          $this->assertInstanceOf(WP_Post::class, get_post($random_post_id));
                                                                                                                                                                                      -
                                                                                                                                                                                      -

                                                                                                                                                                                      } -* The `factory` property can be accessed on the `tester` property too and will work the same way as if called using `static::factory()`:php -public function test_post_creation(){ - $random_post_id = $this->tester->factory()->post->create();

                                                                                                                                                                                      -
                                                                                                                                                                                          $this->assertInstanceOf(WP_Post::class, get_post($random_post_id));
                                                                                                                                                                                      -
                                                                                                                                                                                      -

                                                                                                                                                                                      } -```

                                                                                                                                                                                      -
                                                                                                                                                                                    • -
                                                                                                                                                                                    -

                                                                                                                                                                                    WPLoader to only bootstrap WordPress

                                                                                                                                                                                    -

                                                                                                                                                                                    If the need is to just bootstrap the WordPress installation in the context of the tests variable scope then the WPLoader module loadOnly parameter should be set to true; this could be the case for functional tests in need to access WordPress provided methods, functions and values.
                                                                                                                                                                                    -An example configuration for the module in this mode is this one:

                                                                                                                                                                                    -
                                                                                                                                                                                      modules:
                                                                                                                                                                                    -      enabled:
                                                                                                                                                                                    -          - WPDb # BEFORE the WPLoader one!
                                                                                                                                                                                    -          - WPLoader # AFTER the WPDb one!
                                                                                                                                                                                    -      config:
                                                                                                                                                                                    -          WPDb:
                                                                                                                                                                                    -              dsn: 'mysql:host=localhost;dbname=wordpress'
                                                                                                                                                                                    -              user: 'root'
                                                                                                                                                                                    -              password: 'password'
                                                                                                                                                                                    -              dump: 'tests/_data/dump.sql'
                                                                                                                                                                                    -              populate: true
                                                                                                                                                                                    -              cleanup: true
                                                                                                                                                                                    -              waitlock: 10
                                                                                                                                                                                    -              url: 'http://wordpress.localhost'
                                                                                                                                                                                    -              urlReplacement: true
                                                                                                                                                                                    -              tablePrefix: 'wp_'
                                                                                                                                                                                    -          WPLoader:
                                                                                                                                                                                    -              loadOnly: true 
                                                                                                                                                                                    -              wpRootFolder: "/Users/User/www/wordpress"
                                                                                                                                                                                    -              dbName: "wpress-tests"
                                                                                                                                                                                    -              dbHost: "localhost"
                                                                                                                                                                                    -              dbUser: "root"
                                                                                                                                                                                    -              dbPassword: "root"
                                                                                                                                                                                    -              domain: "wordpress.localhost"
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    With reference to the table above the module will not take care of the test WordPress installation state before and after the tests, the installed and activated plugins, and theme.
                                                                                                                                                                                    -The module can be used in conjunction with a WPDb module to provide the tests with a WordPress installation suiting the tests at hand; when doing so please take care to list, in the suite configuration file modules section (see example above) the WPDb module before the WPLoader one.
                                                                                                                                                                                    -Codeception will initialize the modules in the same order they are listed in the modules section of the suite configuration file and the WPLoader module needs the database to be populated by the WPDb module before it runs! -As an example this is a correct suite configuration:

                                                                                                                                                                                    -
                                                                                                                                                                                    modules:
                                                                                                                                                                                    -  enabled:
                                                                                                                                                                                    -      - WPDb # this before...
                                                                                                                                                                                    -      - WPLoader # ...this one.
                                                                                                                                                                                    -  config:
                                                                                                                                                                                    -      WPDb:
                                                                                                                                                                                    -        # ...
                                                                                                                                                                                    -      WPLoader:
                                                                                                                                                                                    -        loadOnly: true
                                                                                                                                                                                    -        # ... 
                                                                                                                                                                                    -
                                                                                                                                                                                    - - -

                                                                                                                                                                                    Public API

                                                                                                                                                                                    - - -

                                                                                                                                                                                    debugWpActionFinal

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Debugs a single WordPress action final call using Codeception debug functions. The output will show following the selected output verbosity (--debug and -vvv CLI options).

                                                                                                                                                                                    - -
                                                                                                                                                                                    // Start debugging all WordPress actions final value.
                                                                                                                                                                                    -  add_action('all', [$this,'debugWpActionFinal']);
                                                                                                                                                                                    -  // Run some code firing actions and debug them.
                                                                                                                                                                                    -  // Stop debugging all WordPress actions final value.
                                                                                                                                                                                    -  remove_action('all', [$this,'debugWpActionFinal']);
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • mixed $args
                                                                                                                                                                                    - -

                                                                                                                                                                                    debugWpActionInitial

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Debugs a single WordPress action initial call using Codeception debug functions. The output will show following the selected output verbosity (--debug and -vvv CLI options).

                                                                                                                                                                                    - -
                                                                                                                                                                                    // Start debugging all WordPress actions initial value.
                                                                                                                                                                                    -  add_action('all', [$this,'debugWpActionInitial']);
                                                                                                                                                                                    -  // Run some code firing actions and debug them.
                                                                                                                                                                                    -  // Stop debugging all WordPress actions initial value.
                                                                                                                                                                                    -  remove_action('all', [$this,'debugWpActionInitial']);
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • mixed $args
                                                                                                                                                                                    - -

                                                                                                                                                                                    debugWpFilterFinal

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Debugs a single WordPress filter final call using Codeception debug functions. The output will show following the selected output verbosity (--debug and -vvv CLI options).

                                                                                                                                                                                    - -
                                                                                                                                                                                    // Start debugging all WordPress filters final value.
                                                                                                                                                                                    -  add_filter('all', [$this,'debugWpFilterFinal']);
                                                                                                                                                                                    -  // Run some code firing filters and debug them.
                                                                                                                                                                                    -  // Stop debugging all WordPress filters final value.
                                                                                                                                                                                    -  remove_filter('all', [$this,'debugWpFilterFinal']);
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • mixed $args
                                                                                                                                                                                    - -

                                                                                                                                                                                    debugWpFilterInitial

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Debugs a single WordPress filter initial call using Codeception debug functions. The output will show following the selected output verbosity (--debug and -vvv CLI options).

                                                                                                                                                                                    - -
                                                                                                                                                                                    // Start debugging all WordPress filters initial value.
                                                                                                                                                                                    -  add_filter('all', [$this,'debugWpFilterInitial']);
                                                                                                                                                                                    -  // Run some code firing filters and debug them.
                                                                                                                                                                                    -  // Stop debugging all WordPress filters initial value.
                                                                                                                                                                                    -  remove_filter('all', [$this,'debugWpFilterInitial']);
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • mixed $args
                                                                                                                                                                                    - -

                                                                                                                                                                                    factory

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Accessor method to get the object storing the factories for things. This methods gives access to the same factories provided by the Core test suite.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $postId = $I->factory()->post->create();
                                                                                                                                                                                    -  $userId = $I->factory()->user->create(['role' => 'administrator']);
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    getContentFolder

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Returns the absolute path to the WordPress content directory.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $content = $this->getContentFolder();
                                                                                                                                                                                    -  $themes = $this->getContentFolder('themes');
                                                                                                                                                                                    -  $twentytwenty = $this->getContentFolder('themes/twentytwenty');
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string $path - An optional path to append to the content directory absolute path.
                                                                                                                                                                                    - -

                                                                                                                                                                                    getPluginsFolder

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Returns the absolute path to the plugins directory. The value will first look at the WP_PLUGIN_DIR constant, then the pluginsFolder configuration parameter and will, finally, look in the default path from the WordPress root directory.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $plugins = $this->getPluginsFolder();
                                                                                                                                                                                    -  $hello = $this->getPluginsFolder('hello.php');
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string $path - A relative path to append to te plugins directory absolute path.
                                                                                                                                                                                    - -

                                                                                                                                                                                    startWpFiltersDebug

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Starts the debug of all WordPress filters and actions. The method hook on all filters and actions to debug their value.

                                                                                                                                                                                    - -
                                                                                                                                                                                    // Start debugging all WordPress filters and action final and initial values.
                                                                                                                                                                                    -  $this->startWpFiltersDebug();
                                                                                                                                                                                    -  // Run some code firing filters and debug them.
                                                                                                                                                                                    -  // Stop debugging all WordPress filters and action final and initial values.
                                                                                                                                                                                    -  $this->stopWpFiltersDebug();
                                                                                                                                                                                    -  the array of arguments as input.
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • \callable $format - A callback function to format the arguments debug output; the callback will receive
                                                                                                                                                                                    - -

                                                                                                                                                                                    stopWpFiltersDebug

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Stops the debug of all WordPress filters and actions.

                                                                                                                                                                                    - -
                                                                                                                                                                                    // Start debugging all WordPress filters and action final and initial values.
                                                                                                                                                                                    -  $this->startWpFiltersDebug();
                                                                                                                                                                                    -  // Run some code firing filters and debug them.
                                                                                                                                                                                    -  // Stop debugging all WordPress filters and action final and initial values.
                                                                                                                                                                                    -  $this->stopWpFiltersDebug();
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    This class extends \Codeception\Module

                                                                                                                                                                                    - - - - - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - -
                                                                                                                                                                                    - -
                                                                                                                                                                                    - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - - - - - - - \ No newline at end of file diff --git a/docs/public/v3/modules/WPQueries/index.html b/docs/public/v3/modules/WPQueries/index.html deleted file mode 100644 index bcb4d6533..000000000 --- a/docs/public/v3/modules/WPQueries/index.html +++ /dev/null @@ -1,1077 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - WPQueries module - wp-browser docs - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
                                                                                                                                                                                    - -
                                                                                                                                                                                    - - - - - - -
                                                                                                                                                                                    - - -
                                                                                                                                                                                    - -
                                                                                                                                                                                    - - - - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - - - - - -

                                                                                                                                                                                    WPQueries module

                                                                                                                                                                                    -

                                                                                                                                                                                    This module should be used in integration tests, see levels of testing for more information, to make assertions on the database queries made by the global $wpdb object.
                                                                                                                                                                                    -This module requires the WPLoader module to work.
                                                                                                                                                                                    -The module will set, if not set already, the SAVEQUERIES constant to true and will throw an exception if the constant is already set to a falsy value.

                                                                                                                                                                                    -

                                                                                                                                                                                    Configuration

                                                                                                                                                                                    -

                                                                                                                                                                                    This module does not require any configuration, but requires the WPLoader module to work correctly.

                                                                                                                                                                                    -

                                                                                                                                                                                    Usage

                                                                                                                                                                                    -

                                                                                                                                                                                    This module must be used in a test case extending the \Codeception\TestCase\WPTestCase class.

                                                                                                                                                                                    -

                                                                                                                                                                                    The module public API is accessible calling via the \Codeception\TestCase\WPTestCase::queries() method:

                                                                                                                                                                                    -
                                                                                                                                                                                    <?php
                                                                                                                                                                                    -
                                                                                                                                                                                    -use Codeception\Module\WPQueries;
                                                                                                                                                                                    -
                                                                                                                                                                                    -class WPQueriesUsageTest extends \Codeception\TestCase\WPTestCase
                                                                                                                                                                                    -{
                                                                                                                                                                                    -    public function test_queries_made_by_factory_are_not_tracked()
                                                                                                                                                                                    -    {
                                                                                                                                                                                    -        $currentQueriesCount = $this->queries()->countQueries();
                                                                                                                                                                                    -
                                                                                                                                                                                    -        $this->assertNotEmpty($currentQueriesCount);
                                                                                                                                                                                    -
                                                                                                                                                                                    -        static::factory()->post->create_many(3);
                                                                                                                                                                                    -
                                                                                                                                                                                    -        $this->assertNotEmpty($currentQueriesCount);
                                                                                                                                                                                    -        $this->assertEquals($currentQueriesCount, $this->queries()->countQueries());
                                                                                                                                                                                    -    }
                                                                                                                                                                                    -
                                                                                                                                                                                    -    public function test_count_queries()
                                                                                                                                                                                    -    {
                                                                                                                                                                                    -        $currentQueriesCount = $this->queries()->countQueries();
                                                                                                                                                                                    -
                                                                                                                                                                                    -        $this->assertNotEmpty($currentQueriesCount);
                                                                                                                                                                                    -
                                                                                                                                                                                    -        foreach (range(1, 3) as $i) {
                                                                                                                                                                                    -            wp_insert_post(['post_title' => 'Post ' . $i, 'post_content' => str_repeat('test', $i)]);
                                                                                                                                                                                    -        }
                                                                                                                                                                                    -
                                                                                                                                                                                    -        $this->assertNotEmpty($currentQueriesCount);
                                                                                                                                                                                    -        $this->assertGreaterThan($currentQueriesCount, $this->queries()->countQueries());
                                                                                                                                                                                    -    }
                                                                                                                                                                                    -}
                                                                                                                                                                                    -
                                                                                                                                                                                    - - -

                                                                                                                                                                                    Public API

                                                                                                                                                                                    - - -

                                                                                                                                                                                    assertCountQueries

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Asserts that n queries have been made.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $posts = $this->factory()->post->create_many(3);
                                                                                                                                                                                    -  $cachedUsers = $this->factory()->user->create_many(2);
                                                                                                                                                                                    -  $nonCachedUsers = $this->factory()->user->create_many(2);
                                                                                                                                                                                    -  foreach($cachedUsers as $userId){
                                                                                                                                                                                    -  wp_cache_set('page-posts-for-user-' . $userId, $posts, 'acme');
                                                                                                                                                                                    -  }
                                                                                                                                                                                    -  // Run the same query as different users
                                                                                                                                                                                    -  foreach(array_merge($cachedUsers, $nonCachedUsers) as $userId){
                                                                                                                                                                                    -  $pagePosts = $plugin->getPagePostsForUser($userId);
                                                                                                                                                                                    -  }
                                                                                                                                                                                    -  $I->assertCountQueries(2, 'A query should be made for each user missing cached posts.')
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • int $n - The expected number of queries.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • string $message - An optional message to override the default one.
                                                                                                                                                                                    - -

                                                                                                                                                                                    assertNotQueries

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Asserts that no queries were made. Queries generated by setUp, tearDown and factory methods are excluded by default.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $posts = $this->factory()->post->create_many(3);
                                                                                                                                                                                    -  wp_cache_set('page-posts', $posts, 'acme');
                                                                                                                                                                                    -  $pagePosts = $plugin->getPagePosts();
                                                                                                                                                                                    -  $I->assertNotQueries('Queries should not be made if the cache is set.')
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string $message - An optional message to override the default one.
                                                                                                                                                                                    - -

                                                                                                                                                                                    assertNotQueriesByAction

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Asserts that no queries were made as a consequence of the specified action. Queries generated by setUp, tearDown and factory methods are excluded by default.

                                                                                                                                                                                    - -
                                                                                                                                                                                    add_action( 'edit_post', function($postId){
                                                                                                                                                                                    -  $count = get_option('acme_title_updates_count');
                                                                                                                                                                                    -  update_option('acme_title_updates_count', ++$count);
                                                                                                                                                                                    -  } );
                                                                                                                                                                                    -  wp_delete_post($bookId);
                                                                                                                                                                                    -  $this->assertNotQueriesByAction('edit_post');
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string $action - The action name, e.g. 'init'.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • string $message - An optional message to override the default one.
                                                                                                                                                                                    - -

                                                                                                                                                                                    assertNotQueriesByFilter

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Asserts that no queries were made as a consequence of the specified filter. Queries generated by setUp, tearDown and factory methods are excluded by default.

                                                                                                                                                                                    - -
                                                                                                                                                                                    add_filter('the_title', function($title, $postId){
                                                                                                                                                                                    -  $post = get_post($postId);
                                                                                                                                                                                    -  if($post->post_type !== 'book'){
                                                                                                                                                                                    -  return $title;
                                                                                                                                                                                    -  }
                                                                                                                                                                                    -  $new = get_option('acme_new_prefix');
                                                                                                                                                                                    -  return "{$new} - " . $title;
                                                                                                                                                                                    -  });
                                                                                                                                                                                    -  $title = apply_filters('the_title', get_post($notABookId)->post_title, $notABookId);
                                                                                                                                                                                    -  $this->assertNotQueriesByFilter('the_title');
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string $filter - The filter name, e.g. 'posts_where'.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • string $message - An optional message to override the default one.
                                                                                                                                                                                    - -

                                                                                                                                                                                    assertNotQueriesByFunction

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Asserts that no queries were made by the specified function. Queries generated by setUp, tearDown and factory methods are excluded by default.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $this->assertEmpty(Acme\get_orphaned_posts());
                                                                                                                                                                                    -  Acme\delete_orphaned_posts();
                                                                                                                                                                                    -  $this->assertNotQueriesByFunction('Acme\delete_orphaned_posts');
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string $function - The fully qualified name of the function to check.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • string $message - An optional message to override the default one.
                                                                                                                                                                                    - -

                                                                                                                                                                                    assertNotQueriesByMethod

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Asserts that no queries have been made by the specified class method. Queries generated by setUp, tearDown and factory methods are excluded by default.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $options = new Acme\Options();
                                                                                                                                                                                    -  $options->update('adsSource', 'not-a-real-url.org');
                                                                                                                                                                                    -  $I->assertNotQueriesByMethod('Acme\Options', 'update');
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string $class - The fully qualified name of the class to check.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • string $method - The name of the method to check.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • string $message - An optional message to override the default one.
                                                                                                                                                                                    - -

                                                                                                                                                                                    assertNotQueriesByStatement

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Asserts that no queries have been made by the specified class method. Queries generated by setUp, tearDown and factory methods are excluded by default.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $bookRepository = new Acme\BookRepository();
                                                                                                                                                                                    -  $repository->where('ID', 23)->set('title', 'Peter Pan', $deferred = true);
                                                                                                                                                                                    -  $this->assertNotQueriesByStatement('INSERT', 'Deferred write should happen on __destruct');
                                                                                                                                                                                    -  Regular expressions must contain delimiters.
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string $statement - A simple string the statement should start with or a valid regular expression.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • string $message - An optional message to override the default one.
                                                                                                                                                                                    - -

                                                                                                                                                                                    assertNotQueriesByStatementAndAction

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Asserts that no queries were made as a consequence of the specified action containing the SQL query. Queries generated by setUp, tearDown and factory methods are excluded by default.

                                                                                                                                                                                    - -
                                                                                                                                                                                    add_action( 'edit_post', function($postId){
                                                                                                                                                                                    -  $count = get_option('acme_title_updates_count');
                                                                                                                                                                                    -  update_option('acme_title_updates_count', ++$count);
                                                                                                                                                                                    -  } );
                                                                                                                                                                                    -  wp_delete_post($bookId);
                                                                                                                                                                                    -  $this->assertNotQueriesByStatementAndAction('DELETE', 'delete_post');
                                                                                                                                                                                    -  Regular expressions must contain delimiters.
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string $statement - A simple string the statement should start with or a valid regular expression.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • string $action - The action name, e.g. 'init'.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • string $message - An optional message to override the default one.
                                                                                                                                                                                    - -

                                                                                                                                                                                    assertNotQueriesByStatementAndFilter

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Asserts that no queries were made as a consequence of the specified filter containing the specified SQL query. Queries generated by setUp, tearDown and factory methods are excluded by default.

                                                                                                                                                                                    - -
                                                                                                                                                                                    add_filter('the_title', function($title, $postId){
                                                                                                                                                                                    -  $post = get_post($postId);
                                                                                                                                                                                    -  if($post->post_type !== 'book'){
                                                                                                                                                                                    -  return $title;
                                                                                                                                                                                    -  }
                                                                                                                                                                                    -  $new = get_option('acme_new_prefix');
                                                                                                                                                                                    -  return "{$new} - " . $title;
                                                                                                                                                                                    -  });
                                                                                                                                                                                    -  $title = apply_filters('the_title', get_post($notABookId)->post_title, $notABookId);
                                                                                                                                                                                    -  $this->assertNotQueriesByStatementAndFilter('SELECT', 'the_title');
                                                                                                                                                                                    -  Regular expressions must contain delimiters.
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string $statement - A simple string the statement should start with or a valid regular expression.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • string $filter - The filter name, e.g. 'posts_where'.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • string $message - An optional message to override the default one.
                                                                                                                                                                                    - -

                                                                                                                                                                                    assertNotQueriesByStatementAndFunction

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Asserts that no queries were made by the specified function starting with the specified SQL statement. Queries generated by setUp, tearDown and factory methods are excluded by default.

                                                                                                                                                                                    - -
                                                                                                                                                                                    wp_insert_post(['ID' => $bookId, 'post_title' => 'The Call of the Wild']);
                                                                                                                                                                                    -  $this->assertNotQueriesByStatementAndFunction('INSERT', 'wp_insert_post');
                                                                                                                                                                                    -  $this->assertQueriesByStatementAndFunction('UPDATE', 'wp_insert_post');
                                                                                                                                                                                    -  Regular expressions must contain delimiters.
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string $statement - A simple string the statement should start with or a valid regular expression.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • string $function - The name of the function to check the assertions for.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • string $message - An optional message to override the default one.
                                                                                                                                                                                    - -

                                                                                                                                                                                    assertNotQueriesByStatementAndMethod

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Asserts that no queries were made by the specified class method starting with the specified SQL statement. Queries generated by setUp, tearDown and factory methods are excluded by default.

                                                                                                                                                                                    - -
                                                                                                                                                                                    Acme\BookRepository::new(['title' => 'Alice in Wonderland'])->commit();
                                                                                                                                                                                    -  $this->assertQueriesByStatementAndMethod('INSERT', Acme\BookRepository::class, 'commit');
                                                                                                                                                                                    -  Regular expressions must contain delimiters.
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string $statement - A simple string the statement should start with or a valid regular expression.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • string $class - The fully qualified name of the class to check.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • string $method - The name of the method to check.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • string $message - An optional message to override the default one.
                                                                                                                                                                                    - -

                                                                                                                                                                                    assertQueries

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Asserts that at least one query was made during the test. Queries generated by setUp, tearDown and factory methods are excluded by default.

                                                                                                                                                                                    - -
                                                                                                                                                                                    wp_cache_delete('page-posts', 'acme');
                                                                                                                                                                                    -  $pagePosts = $plugin->getPagePosts();
                                                                                                                                                                                    -  $I->assertQueries('Queries should be made to set the cache.')
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string $message - An optional message to override the default one.
                                                                                                                                                                                    - -

                                                                                                                                                                                    assertQueriesByAction

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Asserts that at least one query was made as a consequence of the specified action. Queries generated by setUp, tearDown and factory methods are excluded by default.

                                                                                                                                                                                    - -
                                                                                                                                                                                    add_action( 'edit_post', function($postId){
                                                                                                                                                                                    -  $count = get_option('acme_title_updates_count');
                                                                                                                                                                                    -  update_option('acme_title_updates_count', ++$count);
                                                                                                                                                                                    -  } );
                                                                                                                                                                                    -  wp_update_post(['ID' => $bookId, 'post_title' => 'New Title']);
                                                                                                                                                                                    -  $this->assertQueriesByAction('edit_post');
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string $action - The action name, e.g. 'init'.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • string $message - An optional message to override the default one.
                                                                                                                                                                                    - -

                                                                                                                                                                                    assertQueriesByFilter

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Asserts that at least one query was made as a consequence of the specified filter. Queries generated by setUp, tearDown and factory methods are excluded by default.

                                                                                                                                                                                    - -
                                                                                                                                                                                    add_filter('the_title', function($title, $postId){
                                                                                                                                                                                    -  $post = get_post($postId);
                                                                                                                                                                                    -  if($post->post_type !== 'book'){
                                                                                                                                                                                    -  return $title;
                                                                                                                                                                                    -  }
                                                                                                                                                                                    -  $new = get_option('acme_new_prefix');
                                                                                                                                                                                    -  return "{$new} - " . $title;
                                                                                                                                                                                    -  });
                                                                                                                                                                                    -  $title = apply_filters('the_title', get_post($bookId)->post_title, $bookId);
                                                                                                                                                                                    -  $this->assertQueriesByFilter('the_title');
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string $filter - The filter name, e.g. 'posts_where'.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • string $message - An optional message to override the default one.
                                                                                                                                                                                    - -

                                                                                                                                                                                    assertQueriesByFunction

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Asserts that queries were made by the specified function. Queries generated by setUp, tearDown and factory methods are excluded by default.

                                                                                                                                                                                    - -
                                                                                                                                                                                    acme_clean_queue();
                                                                                                                                                                                    -  $this->assertQueriesByFunction('acme_clean_queue');
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string $function - The fully qualified name of the function to check.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • string $message - An optional message to override the default one.
                                                                                                                                                                                    - -

                                                                                                                                                                                    assertQueriesByMethod

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Asserts that at least one query has been made by the specified class method. Queries generated by setUp, tearDown and factory methods are excluded by default.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $options = new Acme\Options();
                                                                                                                                                                                    -  $options->update('showAds', false);
                                                                                                                                                                                    -  $I->assertQueriesByMethod('Acme\Options', 'update');
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string $class - The fully qualified name of the class to check.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • string $method - The name of the method to check.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • string $message - An optional message to override the default one.
                                                                                                                                                                                    - -

                                                                                                                                                                                    assertQueriesByStatement

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Asserts that at least a query starting with the specified statement was made. Queries generated by setUp, tearDown and factory methods are excluded by default.

                                                                                                                                                                                    - -
                                                                                                                                                                                    wp_cache_flush();
                                                                                                                                                                                    -  cached_get_posts($args);
                                                                                                                                                                                    -  $I->assertQueriesByStatement('SELECT');
                                                                                                                                                                                    -  Regular expressions must contain delimiters.
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string $statement - A simple string the statement should start with or a valid regular expression.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • string $message - An optional message to override the default one.
                                                                                                                                                                                    - -

                                                                                                                                                                                    assertQueriesByStatementAndAction

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Asserts that at least one query was made as a consequence of the specified action containing the SQL query. Queries generated by setUp, tearDown and factory methods are excluded by default.

                                                                                                                                                                                    - -
                                                                                                                                                                                    add_action( 'edit_post', function($postId){
                                                                                                                                                                                    -  $count = get_option('acme_title_updates_count');
                                                                                                                                                                                    -  update_option('acme_title_updates_count', ++$count);
                                                                                                                                                                                    -  } );
                                                                                                                                                                                    -  wp_update_post(['ID' => $bookId, 'post_title' => 'New']);
                                                                                                                                                                                    -  $this->assertQueriesByStatementAndAction('UPDATE', 'edit_post');
                                                                                                                                                                                    -  Regular expressions must contain delimiters.
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string $statement - A simple string the statement should start with or a valid regular expression.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • string $action - The action name, e.g. 'init'.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • string $message - An optional message to override the default one.
                                                                                                                                                                                    - -

                                                                                                                                                                                    assertQueriesByStatementAndFilter

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Asserts that at least one query was made as a consequence of the specified filter containing the SQL query. Queries generated by setUp, tearDown and factory methods are excluded by default.

                                                                                                                                                                                    - -
                                                                                                                                                                                    add_filter('the_title', function($title, $postId){
                                                                                                                                                                                    -  $post = get_post($postId);
                                                                                                                                                                                    -  if($post->post_type !== 'book'){
                                                                                                                                                                                    -  return $title;
                                                                                                                                                                                    -  }
                                                                                                                                                                                    -  $new = get_option('acme_new_prefix');
                                                                                                                                                                                    -  return "{$new} - " . $title;
                                                                                                                                                                                    -  });
                                                                                                                                                                                    -  $title = apply_filters('the_title', get_post($bookId)->post_title, $bookId);
                                                                                                                                                                                    -  $this->assertQueriesByStatementAndFilter('SELECT', 'the_title');
                                                                                                                                                                                    -  Regular expressions must contain delimiters.
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string $statement - A simple string the statement should start with or a valid regular expression.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • string $filter - The filter name, e.g. 'posts_where'.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • string $message - An optional message to override the default one.
                                                                                                                                                                                    - -

                                                                                                                                                                                    assertQueriesByStatementAndFunction

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Asserts that queries were made by the specified function starting with the specified SQL statement. Queries generated by setUp, tearDown and factory methods are excluded by default.

                                                                                                                                                                                    - -
                                                                                                                                                                                    wp_insert_post(['post_type' => 'book', 'post_title' => 'Alice in Wonderland']);
                                                                                                                                                                                    -  $this->assertQueriesByStatementAndFunction('INSERT', 'wp_insert_post');
                                                                                                                                                                                    -  Regular expressions must contain delimiters.
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string $statement - A simple string the statement should start with or a valid regular expression.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • string $function - The fully qualified function name.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • string $message - An optional message to override the default one.
                                                                                                                                                                                    - -

                                                                                                                                                                                    assertQueriesByStatementAndMethod

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Asserts that queries were made by the specified class method starting with the specified SQL statement. Queries generated by setUp, tearDown and factory methods are excluded by default.

                                                                                                                                                                                    - -
                                                                                                                                                                                    Acme\BookRepository::new(['title' => 'Alice in Wonderland'])->commit();
                                                                                                                                                                                    -  $this->assertQueriesByStatementAndMethod('UPDATE', Acme\BookRepository::class, 'commit');
                                                                                                                                                                                    -  Regular expressions must contain delimiters.
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string $statement - A simple string the statement should start with or a valid regular expression.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • string $class - The fully qualified name of the class to check.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • string $method - The name of the method to check.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • string $message - An optional message to override the default one.
                                                                                                                                                                                    - -

                                                                                                                                                                                    assertQueriesCountByAction

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Asserts that n queries were made as a consequence of the specified action. Queries generated by setUp, tearDown and factory methods are excluded by default.

                                                                                                                                                                                    - -
                                                                                                                                                                                    add_action( 'edit_post', function($postId){
                                                                                                                                                                                    -  $count = get_option('acme_title_updates_count');
                                                                                                                                                                                    -  update_option('acme_title_updates_count', ++$count);
                                                                                                                                                                                    -  } );
                                                                                                                                                                                    -  wp_update_post(['ID' => $bookOneId, 'post_title' => 'One']);
                                                                                                                                                                                    -  wp_update_post(['ID' => $bookTwoId, 'post_title' => 'Two']);
                                                                                                                                                                                    -  wp_update_post(['ID' => $bookThreeId, 'post_title' => 'Three']);
                                                                                                                                                                                    -  $this->assertQueriesCountByAction(3, 'edit_post');
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • int $n - The expected number of queries.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • string $action - The action name, e.g. 'init'.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • string $message - An optional message to override the default one.
                                                                                                                                                                                    - -

                                                                                                                                                                                    assertQueriesCountByFilter

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Asserts that n queries were made as a consequence of the specified filter. Queries generated by setUp, tearDown and factory methods are excluded by default.

                                                                                                                                                                                    - -
                                                                                                                                                                                    add_filter('the_title', function($title, $postId){
                                                                                                                                                                                    -  $post = get_post($postId);
                                                                                                                                                                                    -  if($post->post_type !== 'book'){
                                                                                                                                                                                    -  return $title;
                                                                                                                                                                                    -  }
                                                                                                                                                                                    -  $new = get_option('acme_new_prefix');
                                                                                                                                                                                    -  return "{$new} - " . $title;
                                                                                                                                                                                    -  });
                                                                                                                                                                                    -  $title = apply_filters('the_title', get_post($bookOneId)->post_title, $bookOneId);
                                                                                                                                                                                    -  $title = apply_filters('the_title', get_post($notABookId)->post_title, $notABookId);
                                                                                                                                                                                    -  $title = apply_filters('the_title', get_post($bookTwoId)->post_title, $bookTwoId);
                                                                                                                                                                                    -  $this->assertQueriesCountByFilter(2, 'the_title');
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • int $n - The expected number of queries.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • string $filter - The filter name, e.g. 'posts_where'.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • string $message - An optional message to override the default one.
                                                                                                                                                                                    - -

                                                                                                                                                                                    assertQueriesCountByFunction

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Asserts that n queries were made by the specified function. Queries generated by setUp, tearDown and factory methods are excluded by default.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $this->assertCount(3, Acme\get_orphaned_posts());
                                                                                                                                                                                    -  Acme\delete_orphaned_posts();
                                                                                                                                                                                    -  $this->assertQueriesCountByFunction(3, 'Acme\delete_orphaned_posts');
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • int $n - The expected number of queries.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • string $function - The function to check the queries for.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • string $message - An optional message to override the default one.
                                                                                                                                                                                    - -

                                                                                                                                                                                    assertQueriesCountByMethod

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Asserts that n queries have been made by the specified class method. Queries generated by setUp, tearDown and factory methods are excluded by default.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $bookRepository = new Acme\BookRepository();
                                                                                                                                                                                    -  $repository->where('ID', 23)->commit('title', 'Peter Pan');
                                                                                                                                                                                    -  $repository->where('ID', 89)->commit('title', 'Moby-dick');
                                                                                                                                                                                    -  $repository->where('ID', 2389)->commit('title', 'The call of the wild');
                                                                                                                                                                                    -  $this->assertQueriesCountByMethod(3, 'Acme\BookRepository', 'commit');
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • int $n - The expected number of queries.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • string $class - The fully qualified name of the class to check.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • string $method - The name of the method to check.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • string $message - An optional message to override the default one.
                                                                                                                                                                                    - -

                                                                                                                                                                                    assertQueriesCountByStatement

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Asserts that n queries starting with the specified statement were made. Queries generated by setUp, tearDown and factory methods are excluded by default.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $bookRepository = new Acme\BookRepository();
                                                                                                                                                                                    -  $repository->where('ID', 23)->set('title', 'Peter Pan', $deferred = true);
                                                                                                                                                                                    -  $repository->where('ID', 89)->set('title', 'Moby-dick', $deferred = true);
                                                                                                                                                                                    -  $repository->where('ID', 2389)->set('title', 'The call of the wild', $deferred = false);
                                                                                                                                                                                    -  $this->assertQueriesCountByStatement(1, 'INSERT', 'Deferred write should happen on __destruct');
                                                                                                                                                                                    -  Regular expressions must contain delimiters.
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • int $n - The expected number of queries.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • string $statement - A simple string the statement should start with or a valid regular expression.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • string $message - An optional message to override the default one.
                                                                                                                                                                                    - -

                                                                                                                                                                                    assertQueriesCountByStatementAndAction

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Asserts that n queries were made as a consequence of the specified action containing the specified SQL statement. Queries generated by setUp, tearDown and factory methods are excluded by default.

                                                                                                                                                                                    - -
                                                                                                                                                                                    add_action( 'edit_post', function($postId){
                                                                                                                                                                                    -  $count = get_option('acme_title_updates_count');
                                                                                                                                                                                    -  update_option('acme_title_updates_count', ++$count);
                                                                                                                                                                                    -  } );
                                                                                                                                                                                    -  wp_delete_post($bookOneId);
                                                                                                                                                                                    -  wp_delete_post($bookTwoId);
                                                                                                                                                                                    -  wp_update_post(['ID' => $bookThreeId, 'post_title' => 'New']);
                                                                                                                                                                                    -  $this->assertQueriesCountByStatementAndAction(2, 'DELETE', 'delete_post');
                                                                                                                                                                                    -  $this->assertQueriesCountByStatementAndAction(1, 'INSERT', 'edit_post');
                                                                                                                                                                                    -  Regular expressions must contain delimiters.
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • int $n - The expected number of queries.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • string $statement - A simple string the statement should start with or a valid regular expression.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • string $action - The action name, e.g. 'init'.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • string $message - An optional message to override the default one.
                                                                                                                                                                                    - -

                                                                                                                                                                                    assertQueriesCountByStatementAndFilter

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Asserts that n queries were made as a consequence of the specified filter containing the specified SQL statement. Queries generated by setUp, tearDown and factory methods are excluded by default.

                                                                                                                                                                                    - -
                                                                                                                                                                                    add_filter('the_title', function($title, $postId){
                                                                                                                                                                                    -  $post = get_post($postId);
                                                                                                                                                                                    -  if($post->post_type !== 'book'){
                                                                                                                                                                                    -  return $title;
                                                                                                                                                                                    -  }
                                                                                                                                                                                    -  $new = get_option('acme_new_prefix');
                                                                                                                                                                                    -  return "{$new} - " . $title;
                                                                                                                                                                                    -  });
                                                                                                                                                                                    -  // Warm up the cache.
                                                                                                                                                                                    -  $title = apply_filters('the_title', get_post($bookOneId)->post_title, $bookOneId);
                                                                                                                                                                                    -  // Cache is warmed up now.
                                                                                                                                                                                    -  $title = apply_filters('the_title', get_post($bookTwoId)->post_title, $bookTwoId);
                                                                                                                                                                                    -  $title = apply_filters('the_title', get_post($bookThreeId)->post_title, $bookThreeId);
                                                                                                                                                                                    -  $this->assertQueriesCountByStatementAndFilter(1, 'SELECT', 'the_title');
                                                                                                                                                                                    -  Regular expressions must contain delimiters.
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • int $n - The expected number of queries.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • string $statement - A simple string the statement should start with or a valid regular expression.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • string $filter - The filter name, e.g. 'posts_where'.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • string $message - An optional message to override the default one.
                                                                                                                                                                                    - -

                                                                                                                                                                                    assertQueriesCountByStatementAndFunction

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Asserts that n queries were made by the specified function starting with the specified SQL statement. Queries generated by setUp, tearDown and factory methods are excluded by default.

                                                                                                                                                                                    - -
                                                                                                                                                                                    wp_insert_post(['post_type' => 'book', 'post_title' => 'The Call of the Wild']);
                                                                                                                                                                                    -  wp_insert_post(['post_type' => 'book', 'post_title' => 'Alice in Wonderland']);
                                                                                                                                                                                    -  wp_insert_post(['post_type' => 'book', 'post_title' => 'The Chocolate Factory']);
                                                                                                                                                                                    -  $this->assertQueriesCountByStatementAndFunction(3, 'INSERT', 'wp_insert_post');
                                                                                                                                                                                    -  Regular expressions must contain delimiters.
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • int $n - The expected number of queries.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • string $statement - A simple string the statement should start with or a valid regular expression.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • string $function - The fully-qualified function name.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • string $message - An optional message to override the default one.
                                                                                                                                                                                    - -

                                                                                                                                                                                    assertQueriesCountByStatementAndMethod

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Asserts that n queries were made by the specified class method starting with the specified SQL statement. Queries generated by setUp, tearDown and factory methods are excluded by default.

                                                                                                                                                                                    - -
                                                                                                                                                                                    Acme\BookRepository::new(['title' => 'Alice in Wonderland'])->commit();
                                                                                                                                                                                    -  Acme\BookRepository::new(['title' => 'Moby-Dick'])->commit();
                                                                                                                                                                                    -  Acme\BookRepository::new(['title' => 'The Call of the Wild'])->commit();
                                                                                                                                                                                    -  $this->assertQueriesCountByStatementAndMethod(3, 'INSERT', Acme\BookRepository::class, 'commit');
                                                                                                                                                                                    -  Regular expressions must contain delimiters.
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • int $n - The expected number of queries.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • string $statement - A simple string the statement should start with or a valid regular expression.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • string $class - The fully qualified name of the class to check.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • string $method - The name of the method to check.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • string $message - An optional message to override the default one.
                                                                                                                                                                                    - -

                                                                                                                                                                                    countQueries

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Returns the current number of queries. Set-up and tear-down queries performed by the test case are filtered out.

                                                                                                                                                                                    - -
                                                                                                                                                                                    // In a WPTestCase, using the global $wpdb object.
                                                                                                                                                                                    -  $queriesCount = $this->queries()->countQueries();
                                                                                                                                                                                    -  // In a WPTestCase, using a custom $wpdb object.
                                                                                                                                                                                    -  $queriesCount = $this->queries()->countQueries($customWdbb);
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • \wpdb/null $wpdb - A specific instance of the wpdb class or null to use the global one.
                                                                                                                                                                                    - -

                                                                                                                                                                                    getQueries

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Returns the queries currently performed by the global database object or the specified one. Set-up and tear-down queries performed by the test case are filtered out.

                                                                                                                                                                                    - -
                                                                                                                                                                                    // In a WPTestCase, using the global $wpdb object.
                                                                                                                                                                                    -  $queries = $this->queries()->getQueries();
                                                                                                                                                                                    -  // In a WPTestCase, using a custom $wpdb object.
                                                                                                                                                                                    -  $queries = $this->queries()->getQueries($customWdbb);
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • null/\wpdb $wpdb - A specific instance of the wpdb class or null to use the global one.
                                                                                                                                                                                    - -

                                                                                                                                                                                    This class extends \Codeception\Module

                                                                                                                                                                                    - - - - - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - -
                                                                                                                                                                                    - -
                                                                                                                                                                                    - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - - - - - - - \ No newline at end of file diff --git a/docs/public/v3/modules/WPWebDriver/index.html b/docs/public/v3/modules/WPWebDriver/index.html deleted file mode 100644 index 76228fe45..000000000 --- a/docs/public/v3/modules/WPWebDriver/index.html +++ /dev/null @@ -1,757 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - WpWebDriver module - wp-browser docs - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
                                                                                                                                                                                    - -
                                                                                                                                                                                    - - - - - - -
                                                                                                                                                                                    - - -
                                                                                                                                                                                    - -
                                                                                                                                                                                    - - - - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - - - - - -

                                                                                                                                                                                    WpWebDriver module

                                                                                                                                                                                    -

                                                                                                                                                                                    This module should be used in acceptance tests, see levels of testing for more information.

                                                                                                                                                                                    -

                                                                                                                                                                                    This module extends the WebDriver module adding WordPress-specific configuration parameters and methods.

                                                                                                                                                                                    -

                                                                                                                                                                                    The module simulates a user interaction with the site with Javascript support; if you don't need to test your project with Javascript support use the WPBrowser module.

                                                                                                                                                                                    -

                                                                                                                                                                                    Module requirements for Codeception 4.0+

                                                                                                                                                                                    -

                                                                                                                                                                                    This module requires the codeception/module-webdriver Composer package to work when wp-browser is used with Codeception 4.0.

                                                                                                                                                                                    -

                                                                                                                                                                                    To install the package run:

                                                                                                                                                                                    -
                                                                                                                                                                                    composer require --dev codeception/module-webdriver:^1.0
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Configuration

                                                                                                                                                                                    -

                                                                                                                                                                                    Due to the combination of possible browsers, capabilities and configurations, it's not possible to provide an exhaustive coverage of all the possible configuration parameteters here.

                                                                                                                                                                                    -

                                                                                                                                                                                    Please refer to WebDriver documentation for more information.

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • url required - Start URL of your WordPress project, e.g. http://wp.test.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • adminUsername required - This is the login name, not the "nice" name, of the administrator user of the WordPress test site. This will be used to fill the username field in WordPress login page.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • adminPassword required - This is the the password of the administrator use of the WordPress test site. This will be used to fill the password in WordPress login page.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • adminPath required - The path, relative to the WordPress test site home URL, to the administration area, usually /wp-admin.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • browser - The browser to use for the tests, e.g. chrome or firefox.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • capabilities - Depending on the browser set in browser this is a list of browser-specific capabilities.
                                                                                                                                                                                    • -
                                                                                                                                                                                    -

                                                                                                                                                                                    Example configuration

                                                                                                                                                                                    -
                                                                                                                                                                                    modules:
                                                                                                                                                                                    -  enabled:
                                                                                                                                                                                    -    - WPWebDriver
                                                                                                                                                                                    -  config:
                                                                                                                                                                                    -    WPWebDriver:
                                                                                                                                                                                    -      url: 'http://wp.test'
                                                                                                                                                                                    -      adminUsername: 'admin'
                                                                                                                                                                                    -      adminPassword: 'password'
                                                                                                                                                                                    -      adminPath: '/wp-admin'
                                                                                                                                                                                    -      browser: chrome
                                                                                                                                                                                    -      host: localhost
                                                                                                                                                                                    -      port: 4444
                                                                                                                                                                                    -      window_size: false #disabled for Chrome driver
                                                                                                                                                                                    -      capabilities:
                                                                                                                                                                                    -        chromeOptions:
                                                                                                                                                                                    -          args: ["--headless", "--disable-gpu", "--proxy-server='direct://'", "--proxy-bypass-list=*"]
                                                                                                                                                                                    -
                                                                                                                                                                                    - - -

                                                                                                                                                                                    Public API

                                                                                                                                                                                    - - -

                                                                                                                                                                                    activatePlugin

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    In the plugin administration screen activates one or more plugins clicking the "Activate" link. The method will not handle authentication and navigation to the plugins administration page.

                                                                                                                                                                                    - -
                                                                                                                                                                                    // Activate a plugin.
                                                                                                                                                                                    -  $I->loginAsAdmin();
                                                                                                                                                                                    -  $I->amOnPluginsPage();
                                                                                                                                                                                    -  $I->activatePlugin('hello-dolly');
                                                                                                                                                                                    -  // Activate a list of plugins.
                                                                                                                                                                                    -  $I->loginAsAdmin();
                                                                                                                                                                                    -  $I->amOnPluginsPage();
                                                                                                                                                                                    -  $I->activatePlugin(['hello-dolly','another-plugin']);
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string/\Codeception\Module\array $pluginSlug - The plugin slug, like "hello-dolly" or a list of plugin slugs.
                                                                                                                                                                                    - -

                                                                                                                                                                                    amEditingPostWithId

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Go to the admin page to edit the post with the specified ID. The method will not handle authentication the admin area.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $I->loginAsAdmin();
                                                                                                                                                                                    -  $postId = $I->havePostInDatabase();
                                                                                                                                                                                    -  $I->amEditingPostWithId($postId);
                                                                                                                                                                                    -  $I->fillField('post_title', 'Post title');
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • int $id - The post ID.
                                                                                                                                                                                    - -

                                                                                                                                                                                    amOnAdminAjaxPage

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Go to the admin-ajax.php page to start a synchronous, and blocking, GET AJAX request. The method will not handle authentication, nonces or authorization.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $I->amOnAdminAjaxPage(['action' => 'my-action', 'data' => ['id' => 23], 'nonce' => $nonce]);
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string/\Codeception\Module\array $queryVars - A string or array of query variables to append to the AJAX path.
                                                                                                                                                                                    - -

                                                                                                                                                                                    amOnAdminPage

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Go to a page in the admininstration area of the site. This method will not handle authentication to the administration area.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $I->loginAs('user', 'password');
                                                                                                                                                                                    -  // Go to the plugins management screen.
                                                                                                                                                                                    -  $I->amOnAdminPage('/plugins.php');
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string $page - The path, relative to the admin area URL, to the page.
                                                                                                                                                                                    - -

                                                                                                                                                                                    amOnCronPage

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Go to the cron page to start a synchronous, and blocking, GET request to the cron script.

                                                                                                                                                                                    - -
                                                                                                                                                                                    // Triggers the cron job with an optional query argument.
                                                                                                                                                                                    -  $I->amOnCronPage('/?some-query-var=some-value');
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string/\Codeception\Module\array $queryVars - A string or array of query variables to append to the AJAX path.
                                                                                                                                                                                    - -

                                                                                                                                                                                    amOnPagesPage

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Go the "Pages" administration screen. The method will not handle authentication.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $I->loginAsAdmin();
                                                                                                                                                                                    -  $I->amOnPagesPage();
                                                                                                                                                                                    -  $I->see('Add New');
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    amOnPluginsPage

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Go to the plugins administration screen. The method will not handle authentication.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $I->loginAsAdmin();
                                                                                                                                                                                    -  $I->amOnPluginsPage();
                                                                                                                                                                                    -  $I->activatePlugin('hello-dolly');
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    deactivatePlugin

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    In the plugin administration screen deactivate a plugin clicking the "Deactivate" link. The method will not handle authentication and navigation to the plugins administration page.

                                                                                                                                                                                    - -
                                                                                                                                                                                    // Deactivate one plugin.
                                                                                                                                                                                    -  $I->loginAsAdmin();
                                                                                                                                                                                    -  $I->amOnPluginsPage();
                                                                                                                                                                                    -  $I->deactivatePlugin('hello-dolly');
                                                                                                                                                                                    -  // Deactivate a list of plugins.
                                                                                                                                                                                    -  $I->loginAsAdmin();
                                                                                                                                                                                    -  $I->amOnPluginsPage();
                                                                                                                                                                                    -  $I->deactivatePlugin(['hello-dolly', 'my-plugin']);
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string/\Codeception\Module\array $pluginSlug - The plugin slug, like "hello-dolly", or a list of plugin slugs.
                                                                                                                                                                                    - -

                                                                                                                                                                                    dontSeePluginInstalled

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Assert a plugin is not installed in the plugins administration screen. The method will not handle authentication and navigation to the plugin administration screen.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $I->loginAsAdmin();
                                                                                                                                                                                    -  $I->amOnPluginsPage();
                                                                                                                                                                                    -  $I->dontSeePluginInstalled('my-plugin');
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string $pluginSlug - The plugin slug, like "hello-dolly".
                                                                                                                                                                                    - -

                                                                                                                                                                                    grabCookiesWithPattern

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Returns all the cookies whose name matches a regex pattern.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $I->loginAs('customer','password');
                                                                                                                                                                                    -  $I->amOnPage('/shop');
                                                                                                                                                                                    -  $cartCookies = $I->grabCookiesWithPattern("#^shop_cart\\.*#");
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string $cookiePattern - The regular expression pattern to use for the matching.
                                                                                                                                                                                    - -

                                                                                                                                                                                    grabFullUrl

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Grabs the current page full URL including the query vars.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $today = date('Y-m-d');
                                                                                                                                                                                    -  $I->amOnPage('/concerts?date=' . $today);
                                                                                                                                                                                    -  $I->assertRegExp('#\\/concerts$#', $I->grabFullUrl());
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    grabWordPressTestCookie

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Returns WordPress default test cookie object if present.

                                                                                                                                                                                    - -
                                                                                                                                                                                    // Grab the default WordPress test cookie.
                                                                                                                                                                                    -  $wpTestCookie = $I->grabWordPressTestCookie();
                                                                                                                                                                                    -  // Grab a customized version of the test cookie.
                                                                                                                                                                                    -  $myTestCookie = $I->grabWordPressTestCookie('my_test_cookie');
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string $name - Optional, overrides the default cookie name.
                                                                                                                                                                                    - -

                                                                                                                                                                                    logOut

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Navigate to the default WordPress logout page and click the logout link.

                                                                                                                                                                                    - -
                                                                                                                                                                                    // Log out using the `wp-login.php` form and return to the current page.
                                                                                                                                                                                    -  $I->logOut(true);
                                                                                                                                                                                    -  // Log out using the `wp-login.php` form and remain there.
                                                                                                                                                                                    -  $I->logOut(false);
                                                                                                                                                                                    -  // Log out using the `wp-login.php` form and move to another page.
                                                                                                                                                                                    -  $I->logOut('/some-other-page');
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • bool/bool/string $redirectTo - Whether to redirect to another (optionally specified) page after the logout.
                                                                                                                                                                                    - -

                                                                                                                                                                                    loginAs

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Login as the specified user. The method will not follow redirection, after the login, to any page. Depending on the driven browser the login might be "too fast" and the server might have not replied with valid cookies yet; in that case the method will re-attempt the login to obtain the cookies.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $I->loginAs('user', 'password');
                                                                                                                                                                                    -  $I->amOnAdminPage('/');
                                                                                                                                                                                    -  $I->see('Dashboard');
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string $username - The user login name.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • string $password - The user password in plain text.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • int $timeout - The max time, in seconds, to try to login.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • int $maxAttempts - The max number of attempts to try to login.
                                                                                                                                                                                    - -

                                                                                                                                                                                    loginAsAdmin

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Login as the administrator user using the credentials specified in the module configuration. The method will not follow redirection, after the login, to any page.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $I->loginAsAdmin();
                                                                                                                                                                                    -  $I->amOnAdminPage('/');
                                                                                                                                                                                    -  $I->see('Dashboard');
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • int $timeout - The max time, in seconds, to try to login.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • int $maxAttempts - The max number of attempts to try to login.
                                                                                                                                                                                    - -

                                                                                                                                                                                    seeErrorMessage

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    In an administration screen look for an error admin notice. The check is class-based to decouple from internationalization. The method will not handle authentication and navigation the administration area. .notice.notice-error ones.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $I->loginAsAdmin()
                                                                                                                                                                                    -  $I->amOnAdminPage('/');
                                                                                                                                                                                    -  $I->seeErrorMessage('.my-plugin');
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string/string/\Codeception\Module\array $classes - A list of classes the notice should have other than the
                                                                                                                                                                                    - -

                                                                                                                                                                                    seeMessage

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    In an administration screen look for an admin notice. The check is class-based to decouple from internationalization. The method will not handle authentication and navigation the administration area.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $I->loginAsAdmin()
                                                                                                                                                                                    -  $I->amOnAdminPage('/');
                                                                                                                                                                                    -  $I->seeMessage('.missing-api-token.my-plugin');
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string/\Codeception\Module\array/string $classes - A list of classes the message should have in addition to the .notice one.
                                                                                                                                                                                    - -

                                                                                                                                                                                    seePluginActivated

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Assert a plugin is activated in the plugin administration screen. The method will not handle authentication and navigation to the plugin administration screen.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $I->loginAsAdmin();
                                                                                                                                                                                    -  $I->amOnPluginsPage();
                                                                                                                                                                                    -  $I->seePluginActivated('my-plugin');
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string $pluginSlug - The plugin slug, like "hello-dolly".
                                                                                                                                                                                    - -

                                                                                                                                                                                    seePluginDeactivated

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Assert a plugin is not activated in the plugins administration screen. The method will not handle authentication and navigation to the plugin administration screen.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $I->loginAsAdmin();
                                                                                                                                                                                    -  $I->amOnPluginsPage();
                                                                                                                                                                                    -  $I->seePluginDeactivated('my-plugin');
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string $pluginSlug - The plugin slug, like "hello-dolly".
                                                                                                                                                                                    - -

                                                                                                                                                                                    seePluginInstalled

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Assert a plugin is installed, no matter its activation status, in the plugin administration screen. The method will not handle authentication and navigation to the plugin administration screen.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $I->loginAsAdmin();
                                                                                                                                                                                    -  $I->amOnPluginsPage();
                                                                                                                                                                                    -  $I->seePluginInstalled('my-plugin');
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string $pluginSlug - The plugin slug, like "hello-dolly".
                                                                                                                                                                                    - -

                                                                                                                                                                                    seeWpDiePage

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Checks that the current page is one generated by the wp_die function. The method will try to identify the page based on the default WordPress die page HTML attributes.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $I->loginAs('user', 'password');
                                                                                                                                                                                    -  $I->amOnAdminPage('/forbidden');
                                                                                                                                                                                    -  $I->seeWpDiePage();
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    waitForJqueryAjax

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Waits for any jQuery triggered AJAX request to be resolved.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $I->amOnPage('/triggering-ajax-requests');
                                                                                                                                                                                    -  $I->waitForJqueryAjax();
                                                                                                                                                                                    -  $I->see('From AJAX');
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • int $time - The max time to wait for AJAX requests to complete.
                                                                                                                                                                                    - -

                                                                                                                                                                                    This class extends \Codeception\Module\WebDriver

                                                                                                                                                                                    -

                                                                                                                                                                                    This class implements \Codeception\Lib\Interfaces\RequiresPackage, \Codeception\Lib\Interfaces\ConflictsWithModule, \Codeception\Lib\Interfaces\ElementLocator, \Codeception\Lib\Interfaces\PageSourceSaver, \Codeception\Lib\Interfaces\ScreenshotSaver, \Codeception\Lib\Interfaces\SessionSnapshot, \Codeception\Lib\Interfaces\MultiSession, \Codeception\Lib\Interfaces\Remote, \Codeception\Lib\Interfaces\Web

                                                                                                                                                                                    - - - - - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - -
                                                                                                                                                                                    - -
                                                                                                                                                                                    - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - - - - - - - \ No newline at end of file diff --git a/docs/public/v3/modules/WordPress/index.html b/docs/public/v3/modules/WordPress/index.html deleted file mode 100644 index a80fab002..000000000 --- a/docs/public/v3/modules/WordPress/index.html +++ /dev/null @@ -1,751 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - WordPress module - wp-browser docs - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
                                                                                                                                                                                    - -
                                                                                                                                                                                    - - - - - - -
                                                                                                                                                                                    - - -
                                                                                                                                                                                    - -
                                                                                                                                                                                    - - - - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - - - - - -

                                                                                                                                                                                    WordPress module

                                                                                                                                                                                    -

                                                                                                                                                                                    This module requires good knowledge and attention to be used effectively; you can replace it with a combination of the WPBrowser module together with the WPLoader module in loadOnly mode. -This module should be used in functional tests, see levels of testing for more information.
                                                                                                                                                                                    -This module provides a middle-ground, in terms of testing and effects, between the fully isolated approach of the WPBrowser module and the fully integrated approach of the WPLoader module with loadOnly set to false.
                                                                                                                                                                                    -It allows to interact with WordPress on a very high level, using methods like $I->loginAs() or $I->amOnPage() as you could do with the WPBrowser module while also loading WordPress in the same variable scope as the tests as the WPLoader module would. -Due to WordPress reliance on constants, globals and side-effects this module will make requests to WordPress in an insulated manner and reproduce WordPress environment (globals and super-globals) after each response in the tests variable scope. -The module simulates a user interaction with the site without Javascript support, use the WPWebDriver module for any kind of testing that requires Javascript-based interaction with the site.

                                                                                                                                                                                    -

                                                                                                                                                                                    Module requirements for Codeception 4.0+

                                                                                                                                                                                    -

                                                                                                                                                                                    This module requires the codeception/lib-innerbrowser Composer package to work when wp-browser is used with Codeception 4.0.

                                                                                                                                                                                    -

                                                                                                                                                                                    To install the package run:

                                                                                                                                                                                    -
                                                                                                                                                                                    composer require --dev codeception/lib-innerbrowser:^1.0
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Detecting requests coming from this module

                                                                                                                                                                                    -

                                                                                                                                                                                    When it runs this module will set the WPBROWSER_HOST_REQUEST environment variable.
                                                                                                                                                                                    -You can detect and use that information to, as an example, use the correct database in your test site wp-config.php file:

                                                                                                                                                                                    -
                                                                                                                                                                                    <?php
                                                                                                                                                                                    -if ( 
                                                                                                                                                                                    -    // Custom header.
                                                                                                                                                                                    -    isset( $_SERVER['HTTP_X_TESTING'] )
                                                                                                                                                                                    -    // Custom user agent.
                                                                                                                                                                                    -    || ( isset( $_SERVER['HTTP_USER_AGENT'] ) && $_SERVER['HTTP_USER_AGENT'] === 'wp-browser' )
                                                                                                                                                                                    -    // The env var set by the WPClIr or WordPress modules.
                                                                                                                                                                                    -    || getenv( 'WPBROWSER_HOST_REQUEST' )
                                                                                                                                                                                    -) {
                                                                                                                                                                                    -    // Use the test database if the request comes from a test.
                                                                                                                                                                                    -    define( 'DB_NAME', 'wordpress_test' );
                                                                                                                                                                                    -} else {
                                                                                                                                                                                    -    // Else use the default one.
                                                                                                                                                                                    -    define( 'DB_NAME', 'wordpress' );
                                                                                                                                                                                    -}
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Configuration

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • wpRootFolder required The absolute, or relative to the project root folder, path to the root WordPress installation folder. The WordPress installation root folder is the one that contains the wp-load.php file.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • adminUsername required - This is the login name, not the "nice" name, of the administrator user of the WordPress test site. This will be used to fill the username field in WordPress login page.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • adminPassword required - This is the the password of the administrator use of the WordPress test site. This will be used to fill the password in WordPress login page.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • adminPath required - The path, relative to the WordPress test site home URL, to the administration area, usually /wp-admin.
                                                                                                                                                                                    • -
                                                                                                                                                                                    -

                                                                                                                                                                                    Example configuration

                                                                                                                                                                                    -
                                                                                                                                                                                      modules:
                                                                                                                                                                                    -      enabled:
                                                                                                                                                                                    -          - WordPress
                                                                                                                                                                                    -      config:
                                                                                                                                                                                    -          WordPress:
                                                                                                                                                                                    -              wpRootFolder: "/var/www/wordpress"
                                                                                                                                                                                    -              adminUsername: 'admin'
                                                                                                                                                                                    -              adminPassword: 'password'
                                                                                                                                                                                    -              adminPath: '/wp-admin'
                                                                                                                                                                                    -
                                                                                                                                                                                    - - -

                                                                                                                                                                                    Public API

                                                                                                                                                                                    - - -

                                                                                                                                                                                    amEditingPostWithId

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Go to the admin page to edit the post with the specified ID. The method will not handle authentication the admin area.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $I->loginAsAdmin();
                                                                                                                                                                                    -  $postId = $I->havePostInDatabase();
                                                                                                                                                                                    -  $I->amEditingPostWithId($postId);
                                                                                                                                                                                    -  $I->fillField('post_title', 'Post title');
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • int $id - The post ID.
                                                                                                                                                                                    - -

                                                                                                                                                                                    amOnAdminAjaxPage

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Go to the admin-ajax.php page to start a synchronous, and blocking, GET AJAX request. The method will not handle authentication, nonces or authorization.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $I->amOnAdminAjaxPage(['action' => 'my-action', 'data' => ['id' => 23], 'nonce' => $nonce]);
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string/\Codeception\Module\array $queryVars - A string or array of query variables to append to the AJAX path.
                                                                                                                                                                                    - -

                                                                                                                                                                                    amOnAdminPage

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Go to a page in the admininstration area of the site.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $I->loginAs('user', 'password');
                                                                                                                                                                                    -  // Go to the plugins management screen.
                                                                                                                                                                                    -  $I->amOnAdminPage('/plugins.php');
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string $page - The path, relative to the admin area URL, to the page.
                                                                                                                                                                                    - -

                                                                                                                                                                                    amOnCronPage

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Go to the cron page to start a synchronous, and blocking, GET request to the cron script.

                                                                                                                                                                                    - -
                                                                                                                                                                                    // Triggers the cron job with an optional query argument.
                                                                                                                                                                                    -  $I->amOnCronPage('/?some-query-var=some-value');
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string/\Codeception\Module\array $queryVars - A string or array of query variables to append to the AJAX path.
                                                                                                                                                                                    - -

                                                                                                                                                                                    amOnPage

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Go to a page on the site. The module will try to reach the page, relative to the URL specified in the module configuration, without applying any permalink resolution.

                                                                                                                                                                                    - -
                                                                                                                                                                                    // Go the the homepage.
                                                                                                                                                                                    -  $I->amOnPage('/');
                                                                                                                                                                                    -  // Go to the single page of post with ID 23.
                                                                                                                                                                                    -  $I->amOnPage('/?p=23');
                                                                                                                                                                                    -  // Go to search page for the string "foo".
                                                                                                                                                                                    -  $I->amOnPage('/?s=foo');
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string $page - The path to the page, relative to the the root URL.
                                                                                                                                                                                    - -

                                                                                                                                                                                    amOnPagesPage

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Go the "Pages" administration screen. The method will not handle authentication.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $I->loginAsAdmin();
                                                                                                                                                                                    -  $I->amOnPagesPage();
                                                                                                                                                                                    -  $I->see('Add New');
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    amOnPluginsPage

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Go to the plugins administration screen. The method will not handle authentication.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $I->loginAsAdmin();
                                                                                                                                                                                    -  $I->amOnPluginsPage();
                                                                                                                                                                                    -  $I->activatePlugin('hello-dolly');
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    dontSeePluginInstalled

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Assert a plugin is not installed in the plugins administration screen. The method will not handle authentication and navigation to the plugin administration screen.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $I->loginAsAdmin();
                                                                                                                                                                                    -  $I->amOnPluginsPage();
                                                                                                                                                                                    -  $I->dontSeePluginInstalled('my-plugin');
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string $pluginSlug - The plugin slug, like "hello-dolly".
                                                                                                                                                                                    - -

                                                                                                                                                                                    extractCookie

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Grab a cookie value from the current session, sets it in the $_COOKIE array and returns its value. This method utility is to get, in the scope of test code, the value of a cookie set during the tests.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $id = $I->haveUserInDatabase('user', 'subscriber', ['user_pass' => 'pass']);
                                                                                                                                                                                    -  $I->loginAs('user', 'pass');
                                                                                                                                                                                    -  // The cookie is now set in the `$_COOKIE` super-global.
                                                                                                                                                                                    -  $I->extractCookie(LOGGED_IN_COOKIE);
                                                                                                                                                                                    -  // Generate a nonce using WordPress methods (see WPLoader in loadOnly mode) with correctly set context.
                                                                                                                                                                                    -  wp_set_current_user($id);
                                                                                                                                                                                    -  $nonce = wp_create_nonce('wp_rest');
                                                                                                                                                                                    -  // Use the generated nonce to make a request to the the REST API.
                                                                                                                                                                                    -  $I->haveHttpHeader('X-WP-Nonce', $nonce);
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string $cookie - The cookie name.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • array/\Codeception\Module\array/array $params - Parameters to filter the cookie value.
                                                                                                                                                                                    - -

                                                                                                                                                                                    getResponseContent

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Returns content of the last response. This method exposes an underlying API for custom assertions.

                                                                                                                                                                                    - -
                                                                                                                                                                                    // In test class.
                                                                                                                                                                                    -  $this->assertContains($text, $this->getResponseContent(), "foo-bar");
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    getWpRootFolder

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Returns the absolute path to the WordPress root folder.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $root = $I->getWpRootFolder();
                                                                                                                                                                                    -  $this->assertFileExists($root . '/someFile.txt');
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    grabWordPressTestCookie

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Returns WordPress default test cookie object if present.

                                                                                                                                                                                    - -
                                                                                                                                                                                    // Grab the default WordPress test cookie.
                                                                                                                                                                                    -  $wpTestCookie = $I->grabWordPressTestCookie();
                                                                                                                                                                                    -  // Grab a customized version of the test cookie.
                                                                                                                                                                                    -  $myTestCookie = $I->grabWordPressTestCookie('my_test_cookie');
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string $name - Optional, overrides the default cookie name.
                                                                                                                                                                                    - -

                                                                                                                                                                                    logOut

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Navigate to the default WordPress logout page and click the logout link.

                                                                                                                                                                                    - -
                                                                                                                                                                                    // Log out using the `wp-login.php` form and return to the current page.
                                                                                                                                                                                    -  $I->logOut(true);
                                                                                                                                                                                    -  // Log out using the `wp-login.php` form and remain there.
                                                                                                                                                                                    -  $I->logOut(false);
                                                                                                                                                                                    -  // Log out using the `wp-login.php` form and move to another page.
                                                                                                                                                                                    -  $I->logOut('/some-other-page');
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • bool/bool/string $redirectTo - Whether to redirect to another (optionally specified) page after the logout.
                                                                                                                                                                                    - -

                                                                                                                                                                                    loginAs

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Login as the specified user. The method will not follow redirection, after the login, to any page.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $I->loginAs('user', 'password');
                                                                                                                                                                                    -  $I->amOnAdminPage('/');
                                                                                                                                                                                    -  $I->seeElement('.admin');
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string $username - The user login name.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • string $password - The user password in plain text.
                                                                                                                                                                                    - -

                                                                                                                                                                                    loginAsAdmin

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Login as the administrator user using the credentials specified in the module configuration. The method will not follow redirection, after the login, to any page.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $I->loginAsAdmin();
                                                                                                                                                                                    -  $I->amOnAdminPage('/');
                                                                                                                                                                                    -  $I->see('Dashboard');
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    seeErrorMessage

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    In an administration screen look for an error admin notice. The check is class-based to decouple from internationalization. The method will not handle authentication and navigation the administration area. .notice.notice-error ones.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $I->loginAsAdmin()
                                                                                                                                                                                    -  $I->amOnAdminPage('/');
                                                                                                                                                                                    -  $I->seeErrorMessage('.my-plugin');
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string/string/\Codeception\Module\array $classes - A list of classes the notice should have other than the
                                                                                                                                                                                    - -

                                                                                                                                                                                    seeMessage

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    In an administration screen look for an admin notice. The check is class-based to decouple from internationalization. The method will not handle authentication and navigation the administration area.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $I->loginAsAdmin()
                                                                                                                                                                                    -  $I->amOnAdminPage('/');
                                                                                                                                                                                    -  $I->seeMessage('.missing-api-token.my-plugin');
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string/\Codeception\Module\array/string $classes - A list of classes the message should have in addition to the .notice one.
                                                                                                                                                                                    - -

                                                                                                                                                                                    seePluginActivated

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Assert a plugin is activated in the plugin administration screen. The method will not handle authentication and navigation to the plugin administration screen.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $I->loginAsAdmin();
                                                                                                                                                                                    -  $I->amOnPluginsPage();
                                                                                                                                                                                    -  $I->seePluginActivated('my-plugin');
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string $pluginSlug - The plugin slug, like "hello-dolly".
                                                                                                                                                                                    - -

                                                                                                                                                                                    seePluginDeactivated

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Assert a plugin is not activated in the plugins administration screen. The method will not handle authentication and navigation to the plugin administration screen.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $I->loginAsAdmin();
                                                                                                                                                                                    -  $I->amOnPluginsPage();
                                                                                                                                                                                    -  $I->seePluginDeactivated('my-plugin');
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string $pluginSlug - The plugin slug, like "hello-dolly".
                                                                                                                                                                                    - -

                                                                                                                                                                                    seePluginInstalled

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Assert a plugin is installed, no matter its activation status, in the plugin administration screen. The method will not handle authentication and navigation to the plugin administration screen.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $I->loginAsAdmin();
                                                                                                                                                                                    -  $I->amOnPluginsPage();
                                                                                                                                                                                    -  $I->seePluginInstalled('my-plugin');
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Parameters

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • string $pluginSlug - The plugin slug, like "hello-dolly".
                                                                                                                                                                                    - -

                                                                                                                                                                                    seeWpDiePage

                                                                                                                                                                                    - -
                                                                                                                                                                                    - -

                                                                                                                                                                                    Checks that the current page is one generated by the wp_die function. The method will try to identify the page based on the default WordPress die page HTML attributes.

                                                                                                                                                                                    - -
                                                                                                                                                                                    $I->loginAs('user', 'password');
                                                                                                                                                                                    -  $I->amOnAdminPage('/forbidden');
                                                                                                                                                                                    -  $I->seeWpDiePage();
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    This class extends \Codeception\Lib\Framework

                                                                                                                                                                                    -

                                                                                                                                                                                    This class implements \Codeception\Lib\Interfaces\Web, \Codeception\Lib\Interfaces\PageSourceSaver, \Codeception\Lib\Interfaces\ElementLocator, \Codeception\Lib\Interfaces\ConflictsWithModule, \Codeception\Lib\Interfaces\DependsOnModule

                                                                                                                                                                                    - - - - - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - -
                                                                                                                                                                                    - -
                                                                                                                                                                                    - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - - - - - - - \ No newline at end of file diff --git a/docs/public/v3/requirements/index.html b/docs/public/v3/requirements/index.html deleted file mode 100644 index fc7a01296..000000000 --- a/docs/public/v3/requirements/index.html +++ /dev/null @@ -1,353 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - Requirements - wp-browser docs - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
                                                                                                                                                                                    - -
                                                                                                                                                                                    - - - - - - -
                                                                                                                                                                                    - - -
                                                                                                                                                                                    - -
                                                                                                                                                                                    - - - - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - - - - - -

                                                                                                                                                                                    Requirements

                                                                                                                                                                                    - -

                                                                                                                                                                                    Requirements

                                                                                                                                                                                    -

                                                                                                                                                                                    wp-browser has some requirements your development environment will need to fulfill for it to work correctly.

                                                                                                                                                                                    -

                                                                                                                                                                                    PHP

                                                                                                                                                                                    -

                                                                                                                                                                                    The minimum supported version of PHP supported by wp-browser is 5.6.

                                                                                                                                                                                    -

                                                                                                                                                                                    This requirement does not reflect on the minimum PHP version your plugin might require; see the FAQs for more information.

                                                                                                                                                                                    -

                                                                                                                                                                                    Composer

                                                                                                                                                                                    -

                                                                                                                                                                                    There is no phar version of wp-browser and it can only be installed using Composer.

                                                                                                                                                                                    -

                                                                                                                                                                                    See Composer installation guide for more information.

                                                                                                                                                                                    -

                                                                                                                                                                                    WordPress, MySQL, Apache/Nginx

                                                                                                                                                                                    -

                                                                                                                                                                                    wp-browser will not download, install and configure WordPress for you.

                                                                                                                                                                                    -

                                                                                                                                                                                    It will also not download, install and setup MySQL, Apache, Nginx or any other technology required by a fully functional WordPress installation for you.

                                                                                                                                                                                    -

                                                                                                                                                                                    You need to set up a local WordPress installation on your own; you can use your preferred solution to do it.

                                                                                                                                                                                    -

                                                                                                                                                                                    In the documentation I will show automated ways to do this but, for most projects, that's not the best solution.

                                                                                                                                                                                    - - - - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - -
                                                                                                                                                                                    - -
                                                                                                                                                                                    - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - - - - - - - \ No newline at end of file diff --git a/docs/public/v3/setting-up-minimum-wordpress-installation/index.html b/docs/public/v3/setting-up-minimum-wordpress-installation/index.html deleted file mode 100644 index 09433ca20..000000000 --- a/docs/public/v3/setting-up-minimum-wordpress-installation/index.html +++ /dev/null @@ -1,346 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - Setting up minimum wordpress installation - wp-browser docs - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
                                                                                                                                                                                    - -
                                                                                                                                                                                    - - - - - - -
                                                                                                                                                                                    - - -
                                                                                                                                                                                    - -
                                                                                                                                                                                    - - - - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - - - - - -

                                                                                                                                                                                    Setting up minimum wordpress installation

                                                                                                                                                                                    - -

                                                                                                                                                                                    Setting up a minimum WordPress installation

                                                                                                                                                                                    -

                                                                                                                                                                                    As mentioned in Installation section wp-browser will not download, configure and install WordPress for you.

                                                                                                                                                                                    -

                                                                                                                                                                                    On a high level, once WordPress is installed and configured, whatever local development environment solution you've used, there are some information you'll need to gather before moving into wp-browser configuration.

                                                                                                                                                                                    -

                                                                                                                                                                                    While there will be a section dedicated to different environments and setups I will outline below the example setup I will use, in the next section, to configure wp-browser:

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • WordPress is installed, on my machine, at /Users/luca/Sites/wordpress.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • I'm running MySQL server locally; I can connect to the MySQL server with the command mysql -u root -h 127.0.0.1 -P 3306; there is no password.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • I've created two databases, wordpress and tests, with the command: - bash - mysql -u root -h 127.0.0.1 -P 3306 -e "create database if not exists wordpress; create database if not exists tests"
                                                                                                                                                                                    • -
                                                                                                                                                                                    • -

                                                                                                                                                                                      I've configured the /Users/luca/Sites/wordpress/wp-config.php file like below (redacted for brevity): - ```php - <?php - define( 'DB_NAME', 'wordpress' ); - define( 'DB_USER', 'root' ); - define( 'DB_PASSWORD', '' ); - define( 'DB_HOST', '127.0.0.1' ); - define( 'DB_CHARSET', 'utf8' ); - define( 'DB_COLLATE', '' );

                                                                                                                                                                                      -

                                                                                                                                                                                      $table_prefix = 'wp_';

                                                                                                                                                                                      -

                                                                                                                                                                                      if ( ! defined( 'ABSPATH' ) ) - define( 'ABSPATH', dirname( FILE ) . '/' );

                                                                                                                                                                                      -

                                                                                                                                                                                      require_once ABSPATH . 'wp-settings.php'; -* To serve the site I'm using PHP built-in server with the command:bash -(cd /Users/luca/Sites/wordpress; php -S localhost:8080) -`` -* I can access the WordPress homepage athttp://localhost:8080and the administration area athttp://localhost:8080/wp-admin. -* I've installed WordPress via its UI (http://localhost:8080/wp-admin), the administrator username isadmin, the administrator password ispassword. -* I'm testing a plugin and that plugin is in the folder, relative to the WordPress root folder,wp-content/plugins/acme-plugin`.

                                                                                                                                                                                      -
                                                                                                                                                                                    • -
                                                                                                                                                                                    -

                                                                                                                                                                                    With all the steps above done I can now move into the actual wp-browser configuration phase.

                                                                                                                                                                                    - - - - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - -
                                                                                                                                                                                    - -
                                                                                                                                                                                    - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - - - - - - - \ No newline at end of file diff --git a/docs/public/v3/sponsors/index.html b/docs/public/v3/sponsors/index.html deleted file mode 100644 index 82f3aedf9..000000000 --- a/docs/public/v3/sponsors/index.html +++ /dev/null @@ -1,338 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - Sponsors - wp-browser docs - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
                                                                                                                                                                                    - -
                                                                                                                                                                                    - - - - - - -
                                                                                                                                                                                    - - -
                                                                                                                                                                                    - -
                                                                                                                                                                                    - - - - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - - - - - -

                                                                                                                                                                                    Sponsors

                                                                                                                                                                                    -

                                                                                                                                                                                    I maintain the wp-browser project while working full-time as a freelance and dedicating my spare time to it. -I do it with passion and for "love of the craft," but it can become a chore at times.

                                                                                                                                                                                    -

                                                                                                                                                                                    Appreciation, the most common form of support, goes a long way but does not pay the bills.
                                                                                                                                                                                    -I want to dedicate more structured time to the project, and that would mean turning down some freelance work offers. -To that end, I've applied for GitHub sponsorship system.

                                                                                                                                                                                    -

                                                                                                                                                                                    Current Sponsors

                                                                                                                                                                                    -

                                                                                                                                                                                    My sincere thanks to my sponsors: you make the above easier.

                                                                                                                                                                                    - - - - - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - -
                                                                                                                                                                                    - -
                                                                                                                                                                                    - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - - - - - - - \ No newline at end of file diff --git a/docs/public/v3/tutorials/automatically-change-db-in-tests/index.html b/docs/public/v3/tutorials/automatically-change-db-in-tests/index.html deleted file mode 100644 index 4ea17866f..000000000 --- a/docs/public/v3/tutorials/automatically-change-db-in-tests/index.html +++ /dev/null @@ -1,383 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - Automatically change database during acceptance and functional tests - wp-browser docs - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
                                                                                                                                                                                    - -
                                                                                                                                                                                    - - - - - - -
                                                                                                                                                                                    - - -
                                                                                                                                                                                    - -
                                                                                                                                                                                    - - - - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - - - - - -

                                                                                                                                                                                    Automatically change database during acceptance and functional tests

                                                                                                                                                                                    -

                                                                                                                                                                                    You should always back up any site you run tests on if you care about the site content.

                                                                                                                                                                                    -

                                                                                                                                                                                    Now this disclaimer has been made ad nauseam; there's a simple way to use a different database when during tests.

                                                                                                                                                                                    -

                                                                                                                                                                                    Identifying requests

                                                                                                                                                                                    -

                                                                                                                                                                                    The first component of this solution is identifying the source of the current HTTP request.
                                                                                                                                                                                    -WordPress makes this identification before deciding which database to use.

                                                                                                                                                                                    -

                                                                                                                                                                                    To provide the WordPress installation with this information, you can set the headers entry of the WPBrowser or WPWebDriver module in the suite configuration file.

                                                                                                                                                                                    -

                                                                                                                                                                                    As an example here is an acceptance suite configuration file setting two custom headers, X_WPBROWSER_REQUEST and X_TEST_REQUEST, on each request sent by the WPWebDriver module:

                                                                                                                                                                                    -
                                                                                                                                                                                    actor: AcceptanceTester
                                                                                                                                                                                    -modules:
                                                                                                                                                                                    -    enabled:
                                                                                                                                                                                    -        - WPDb
                                                                                                                                                                                    -        - WPBrowser
                                                                                                                                                                                    -        - \Helper\Acceptance
                                                                                                                                                                                    -    config:
                                                                                                                                                                                    -        WPDb:
                                                                                                                                                                                    -            dsn: 'mysql:host=localhost;dbname=tests'
                                                                                                                                                                                    -            user: 'root'
                                                                                                                                                                                    -            password: 'root'
                                                                                                                                                                                    -            dump: 'tests/_data/dump.sql'
                                                                                                                                                                                    -            populate: true
                                                                                                                                                                                    -            cleanup: true
                                                                                                                                                                                    -            waitlock: 10
                                                                                                                                                                                    -            url: 'http://wp.test'
                                                                                                                                                                                    -            urlReplacement: true
                                                                                                                                                                                    -            tablePrefix: 'wp_'
                                                                                                                                                                                    -        WPBrowser:
                                                                                                                                                                                    -            url: 'http://wp.test'
                                                                                                                                                                                    -            adminUsername: 'admin'
                                                                                                                                                                                    -            adminPassword: 'admin'
                                                                                                                                                                                    -            adminPath: '/wp-admin'
                                                                                                                                                                                    -            headers:
                                                                                                                                                                                    -                X_WPBROWSER_REQUEST: 1
                                                                                                                                                                                    -                X_TEST_REQUEST: 1
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    The two headers are sent on each HTTP request type, not just on GET type requests.

                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Using a different database to handle test requests

                                                                                                                                                                                    -

                                                                                                                                                                                    Now that each request made by the WPWebDriver module contains those two headers, it's time for WordPress to check those and change the database to use accordingly.

                                                                                                                                                                                    -

                                                                                                                                                                                    The database to use is set by the DB_NAME constant that is, in turn, set in the wp-config.php file.
                                                                                                                                                                                    -Different setups could involve more complex configurations for the wp-config.php file but, for the sake of simplicity, I assume the default WordPress wp-config.php file structure.
                                                                                                                                                                                    -In the example below, the default database name is wordpress, while the name of the test database is tests.

                                                                                                                                                                                    -
                                                                                                                                                                                    - define( 'DB_NAME', 'wordpress' );
                                                                                                                                                                                    -+ if( isset( $_SERVER['HTTP_X_TEST_REQUEST'] ) && $_SERVER['HTTP_X_TEST_REQUEST'] ) {
                                                                                                                                                                                    -+     define( 'DB_NAME', 'tests' );
                                                                                                                                                                                    -+ } else {
                                                                                                                                                                                    -+     define( 'DB_NAME', 'wordpress' );
                                                                                                                                                                                    -+ }
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    The diff shows the replacement done in the WordPress installation wp-config.php file.

                                                                                                                                                                                    -

                                                                                                                                                                                    For copy-and-paste pleasure, replace the line starting with:

                                                                                                                                                                                    -
                                                                                                                                                                                    define( 'DB_NAME', 'default_db_name' );
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    With this snippet:

                                                                                                                                                                                    -
                                                                                                                                                                                    if( isset( $_SERVER['HTTP_X_TEST_REQUEST'] ) && $_SERVER['HTTP_X_TEST_REQUEST'] ) {
                                                                                                                                                                                    -      define( 'DB_NAME', 'test_db_name' );
                                                                                                                                                                                    -} else {
                                                                                                                                                                                    -      define( 'DB_NAME', 'default_db_name' );
                                                                                                                                                                                    -}
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Where default_db_name is the name of the database your test WordPress installation normally uses.

                                                                                                                                                                                    -

                                                                                                                                                                                    Happy, and safer, testing.

                                                                                                                                                                                    - - - - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - -
                                                                                                                                                                                    - -
                                                                                                                                                                                    - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - - - - - - - \ No newline at end of file diff --git a/docs/public/v3/tutorials/local-flywheel-setup/index.html b/docs/public/v3/tutorials/local-flywheel-setup/index.html deleted file mode 100644 index c494861ce..000000000 --- a/docs/public/v3/tutorials/local-flywheel-setup/index.html +++ /dev/null @@ -1,619 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - Local flywheel setup - wp-browser docs - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
                                                                                                                                                                                    - -
                                                                                                                                                                                    - - - - - - -
                                                                                                                                                                                    - - -
                                                                                                                                                                                    - -
                                                                                                                                                                                    - - - - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - - - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - - - - - -

                                                                                                                                                                                    Local flywheel setup

                                                                                                                                                                                    - -

                                                                                                                                                                                    Setting up wp-browser with Local by Flywheel to test a plugin

                                                                                                                                                                                    -

                                                                                                                                                                                    Note: the original version of this guide used, on Mac, the version of Local by Flywheel based on VirtualBox and Docker containers. That version has been replaced by a new one that will not use any virtualization layer. The UI is almost the same but, for back-compatibility purposes, I've not removed the references to the previous version; I have, instead, pointed out where the set up values and procedures might differ due to the changes.

                                                                                                                                                                                    -

                                                                                                                                                                                    Requirements

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • A Mac or Windows machine
                                                                                                                                                                                    • -
                                                                                                                                                                                    • A working installation of Local By Flywheel.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • You should be able to create sites and visit them from your browser without issues.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • Composer installed and working on your terminal PATH, you should be able to run composer --version at the terminal and see the version correctly.
                                                                                                                                                                                    • -
                                                                                                                                                                                    -

                                                                                                                                                                                    Install Local by Flywheel

                                                                                                                                                                                    -

                                                                                                                                                                                    This walk-through starts after Local by Flywheel has been installed and is correctly running on your machine; you can download Local from the site and follow the installation instructions.

                                                                                                                                                                                    -

                                                                                                                                                                                    In the context of this guide I'm assuming the sites directory is ~/Local Sites, the default "Sites Path" in Local preferences.

                                                                                                                                                                                    -

                                                                                                                                                                                    If your document root lies elsewhere, replace the ~/Local Sites path with the actual directory in each command.

                                                                                                                                                                                    -

                                                                                                                                                                                    -

                                                                                                                                                                                    Creating the databases and installing WordPress

                                                                                                                                                                                    -

                                                                                                                                                                                    Using Local UI create a new site:

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • The site name is myplugin.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • The site administrator user name is admin.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • The site administrator password is password.
                                                                                                                                                                                    • -
                                                                                                                                                                                    -

                                                                                                                                                                                    Once Local provisioned and installed the new site, open the "Database" administration tab and, depending on your OS, start a database administration UI or website. -In the image below I'm using Adminer:

                                                                                                                                                                                    -

                                                                                                                                                                                    -

                                                                                                                                                                                    Create a database called tests:

                                                                                                                                                                                    -

                                                                                                                                                                                    -

                                                                                                                                                                                    Make sure you can visit the WordPress installation at http://myplugin.local and that you can correctly access the administration area at http://myplugin.local/wp-admin.

                                                                                                                                                                                    -

                                                                                                                                                                                    Scaffolding the project folder

                                                                                                                                                                                    -

                                                                                                                                                                                    I'm assuming the scope of the development is to test the my-plugin plugin.

                                                                                                                                                                                    -

                                                                                                                                                                                    The first step is to create the bare minimum code required to make the plugin show up among the available WordPress plugins.
                                                                                                                                                                                    -Create the main plugin file in the WordPress installation plugins directory, in the ~/Local Sites/myplugin/app/public/wp-content/plugins/my-plugin/my-plugin.php file:

                                                                                                                                                                                    -
                                                                                                                                                                                    <?php
                                                                                                                                                                                    -/**
                                                                                                                                                                                    - * Plugin Name: My plugin
                                                                                                                                                                                    - */ 
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    The plugin should now show up, activate and deactivate correctly, among the plugins listed in the WordPress installation at http://myplugin.local/wp-admin/plugins.php.

                                                                                                                                                                                    -

                                                                                                                                                                                    -

                                                                                                                                                                                    Installing wp-browser

                                                                                                                                                                                    -

                                                                                                                                                                                    Open a terminal window and navigate to the plugin directory and initialize the Composer project:

                                                                                                                                                                                    -
                                                                                                                                                                                    cd ~/Local Sites/myplugin/app/public/wp-content/plugins/my-plugin
                                                                                                                                                                                    -composer init
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    -

                                                                                                                                                                                    Composer will ask some questions to initialize the project, for the sake of this small guide the answers are not relevant. -Here is the composer.json file generated by the above answers:

                                                                                                                                                                                    -
                                                                                                                                                                                    {
                                                                                                                                                                                    -    "name": "local/my-plugin",
                                                                                                                                                                                    -    "type": "wordpress-plugin",
                                                                                                                                                                                    -    "require": {}
                                                                                                                                                                                    -}
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Next require lucatume/wp-browser as a development dependency:

                                                                                                                                                                                    -
                                                                                                                                                                                    composer require --dev lucatume/wp-browser
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Composer installs any dependency binary file, an executable file, in the project vendor/bin folder.
                                                                                                                                                                                    -To check Codeception is correctly installed run this command:

                                                                                                                                                                                    -
                                                                                                                                                                                    vendor/bin/codecept --version
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Since wp-browser requires Codeception, there is no need to require Codeception explicitly as a development dependency.

                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Setting up wp-browser

                                                                                                                                                                                    -

                                                                                                                                                                                    For those that might get lost while trying to set up wp-browser for the first time the VVV context provides an excellent base to understand the process.

                                                                                                                                                                                    -

                                                                                                                                                                                    wp-browser needs to know:

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • Where the WordPress installation files are located: they will be loaded in integration and "WordPress unit" tests.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • How to connect to the WordPress site "normal" database: this is the database that stores the data of the site I would see when visiting the local installation URL at http://myplugin.local.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • How to connect to the database dedicated to the integration and "WordPress unit" tests: this database will be used to install WordPress during integration and "WordPress unit" tests.
                                                                                                                                                                                    • -
                                                                                                                                                                                    -

                                                                                                                                                                                    Any test suite using a database should never run on a database containing data of any value; this means that your first step should be to backup the site database.

                                                                                                                                                                                    -

                                                                                                                                                                                    You can create a backup of the current site database contents using whatever tool the version of Local you're using provides.
                                                                                                                                                                                    -In this example I'm using Adminer:

                                                                                                                                                                                    -

                                                                                                                                                                                    -

                                                                                                                                                                                    At any moment you can re-import the site database dump using, again, phpMyAdmin, under the "Import" tab:

                                                                                                                                                                                    -

                                                                                                                                                                                    -

                                                                                                                                                                                    Bootstrapping and configuring wp-browser

                                                                                                                                                                                    -

                                                                                                                                                                                    After the backup is done it's time to bootstrap wp-browser using its interactive mode:

                                                                                                                                                                                    -
                                                                                                                                                                                    cd ~/Local Sites/myplugin/app/public/wp-content/plugins/my-plugin
                                                                                                                                                                                    -vendor/bin/codecept init wpbrowser
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    The initialization guide will ask a number of questions.

                                                                                                                                                                                    -

                                                                                                                                                                                    Windows configuration

                                                                                                                                                                                    -

                                                                                                                                                                                    In the screenshots below are the answers I used to configure wp-browser on Windows.

                                                                                                                                                                                    -

                                                                                                                                                                                    Note that I've set up the database host using the values provided by Local UI, yours might differ depending on the version of Local you're using:

                                                                                                                                                                                    -

                                                                                                                                                                                    -

                                                                                                                                                                                    -

                                                                                                                                                                                    -

                                                                                                                                                                                    Below a complete list of each answer:

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • I acknowledge wp-browser should run on development servers... y
                                                                                                                                                                                    • -
                                                                                                                                                                                    • Would you like to set up the suites interactively now? y
                                                                                                                                                                                    • -
                                                                                                                                                                                    • How would you like the acceptance suite to be called? acceptance
                                                                                                                                                                                    • -
                                                                                                                                                                                    • How would you like the functional suite to be called? functional
                                                                                                                                                                                    • -
                                                                                                                                                                                    • How would you like the WordPress unit and integration suite to be called? wpunit
                                                                                                                                                                                    • -
                                                                                                                                                                                    • How would you like to call the env configuration file? .env.testing
                                                                                                                                                                                    • -
                                                                                                                                                                                    • What is the path of the WordPress root directory? ~/Local Sites/myplugin/app/public
                                                                                                                                                                                    • -
                                                                                                                                                                                    • What is the path, relative to WordPress root URL, of the admin area of the test site? /wp-admin
                                                                                                                                                                                    • -
                                                                                                                                                                                    • What is the name of the test database used by the test site? tests
                                                                                                                                                                                    • -
                                                                                                                                                                                    • What is the host of the test database used by the test site? localhost:10003
                                                                                                                                                                                    • -
                                                                                                                                                                                    • What is the user of the test database used by the test site? root
                                                                                                                                                                                    • -
                                                                                                                                                                                    • What is the password of the test database used by the test site? root
                                                                                                                                                                                    • -
                                                                                                                                                                                    • What is the table prefix of the test database used by the test site? wp_
                                                                                                                                                                                    • -
                                                                                                                                                                                    • What is the name of the test database WPLoader should use? tests
                                                                                                                                                                                    • -
                                                                                                                                                                                    • What is the host of the test database WPLoader should use? localhost:10003
                                                                                                                                                                                    • -
                                                                                                                                                                                    • What is the user of the test database WPLoader should use? root
                                                                                                                                                                                    • -
                                                                                                                                                                                    • What is the password of the test database WPLoader should use? root
                                                                                                                                                                                    • -
                                                                                                                                                                                    • What is the table prefix of the test database WPLoader should use? wp_
                                                                                                                                                                                    • -
                                                                                                                                                                                    • What is the URL the test site? http://myplugin.local
                                                                                                                                                                                    • -
                                                                                                                                                                                    • What is the email of the test site WordPress administrator? admin@myplugin.local
                                                                                                                                                                                    • -
                                                                                                                                                                                    • What is the title of the test site? My Plugin Test
                                                                                                                                                                                    • -
                                                                                                                                                                                    • What is the login of the administrator user of the test site? admin
                                                                                                                                                                                    • -
                                                                                                                                                                                    • What is the password of the administrator user of the test site? password
                                                                                                                                                                                    • -
                                                                                                                                                                                    • Are you testing a plugin, a theme or a combination of both (both)? plugin
                                                                                                                                                                                    • -
                                                                                                                                                                                    • What is the folder/plugin.php name of the plugin? my-plugin/my-plugin.php
                                                                                                                                                                                    • -
                                                                                                                                                                                    • Does your project needs additional plugins to be activated to work? no
                                                                                                                                                                                    • -
                                                                                                                                                                                    -

                                                                                                                                                                                    Codeception will build the suites for the first time and should be ready to go.

                                                                                                                                                                                    -

                                                                                                                                                                                    Mac configuration

                                                                                                                                                                                    -

                                                                                                                                                                                    In the screenshots below are the answers I used to configure wp-browser on Mac.

                                                                                                                                                                                    -

                                                                                                                                                                                    Note that I've set up the database host using the values provided by Local UI, yours might differ.

                                                                                                                                                                                    -

                                                                                                                                                                                    -

                                                                                                                                                                                    This screenshot is from the previous version of Local, the one based on VirtualBox and Docker:

                                                                                                                                                                                    -

                                                                                                                                                                                    -

                                                                                                                                                                                    -

                                                                                                                                                                                    -

                                                                                                                                                                                    Below a complete list of each answer:

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • I acknowledge wp-browser should run on development servers... y
                                                                                                                                                                                    • -
                                                                                                                                                                                    • Would you like to set up the suites interactively now? y
                                                                                                                                                                                    • -
                                                                                                                                                                                    • How would you like the acceptance suite to be called? acceptance
                                                                                                                                                                                    • -
                                                                                                                                                                                    • How would you like the functional suite to be called? functional
                                                                                                                                                                                    • -
                                                                                                                                                                                    • How would you like the WordPress unit and integration suite to be called? wpunit
                                                                                                                                                                                    • -
                                                                                                                                                                                    • How would you like to call the env configuration file? .env.testing
                                                                                                                                                                                    • -
                                                                                                                                                                                    • What is the path of the WordPress root directory? ~/Local Sites/myplugin/app/public
                                                                                                                                                                                    • -
                                                                                                                                                                                    • What is the path, relative to WordPress root URL, of the admin area of the test site? /wp-admin
                                                                                                                                                                                    • -
                                                                                                                                                                                    • What is the name of the test database used by the test site? tests
                                                                                                                                                                                    • -
                                                                                                                                                                                    • What is the host of the test database used by the test site? /Users/lucatume/Library/Application Support/Local/run/FjKWfVMGd/mysql/mysqld.sock ( or 192.168.95.100:4055 on an older version of Local)
                                                                                                                                                                                    • -
                                                                                                                                                                                    • What is the user of the test database used by the test site? root
                                                                                                                                                                                    • -
                                                                                                                                                                                    • What is the password of the test database used by the test site? root
                                                                                                                                                                                    • -
                                                                                                                                                                                    • What is the table prefix of the test database used by the test site? wp_
                                                                                                                                                                                    • -
                                                                                                                                                                                    • What is the name of the test database WPLoader should use? tests
                                                                                                                                                                                    • -
                                                                                                                                                                                    • What is the host of the test database WPLoader should use? /Users/lucatume/Library/Application Support/Local/run/FjKWfVMGd/mysql/mysqld.sock (or 192.168.95.100:4055 on an older version of Local)
                                                                                                                                                                                    • -
                                                                                                                                                                                    • What is the user of the test database WPLoader should use? root
                                                                                                                                                                                    • -
                                                                                                                                                                                    • What is the password of the test database WPLoader should use? root
                                                                                                                                                                                    • -
                                                                                                                                                                                    • What is the table prefix of the test database WPLoader should use? wp_
                                                                                                                                                                                    • -
                                                                                                                                                                                    • What is the URL the test site? http://myplugin.local
                                                                                                                                                                                    • -
                                                                                                                                                                                    • What is the email of the test site WordPress administrator? admin@myplugin.local
                                                                                                                                                                                    • -
                                                                                                                                                                                    • What is the title of the test site? My Plugin Test
                                                                                                                                                                                    • -
                                                                                                                                                                                    • What is the login of the administrator user of the test site? admin
                                                                                                                                                                                    • -
                                                                                                                                                                                    • What is the password of the administrator user of the test site? password
                                                                                                                                                                                    • -
                                                                                                                                                                                    • Are you testing a plugin, a theme or a combination of both (both)? plugin
                                                                                                                                                                                    • -
                                                                                                                                                                                    • What is the folder/plugin.php name of the plugin? my-plugin/my-plugin.php
                                                                                                                                                                                    • -
                                                                                                                                                                                    • Does your project needs additional plugins to be activated to work? no
                                                                                                                                                                                    • -
                                                                                                                                                                                    -

                                                                                                                                                                                    Codeception will build the suites for the first time and should be ready to go.

                                                                                                                                                                                    -

                                                                                                                                                                                    Setting up the starting database fixture

                                                                                                                                                                                    -

                                                                                                                                                                                    A "fixture", in testing terms, is a minimal, starting environment shared by all tests.
                                                                                                                                                                                    -In BDD it's the Background any scenario will share. -In the case of a plugin the minimal, starting environment is the following:

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • A fresh WordPress installation empty of any content.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • WordPress using its default theme.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • The only active plugin is the one you're testing, in this example: my-plugin.
                                                                                                                                                                                    • -
                                                                                                                                                                                    -

                                                                                                                                                                                    You should set up this fixture "manually", using the site administration UI at http://myplugin.local/wp-admin.

                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    The following command will empty the site, backup any content you care about first!

                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    When you're done setting up the initial database fixture, export it using the "Export" tab of your database tool of choice, and move the file to the ~/Local Sites/myplugin/app/public/wp-content/plugins/my-plugin/tests/_data/dump.sql directory.

                                                                                                                                                                                    -

                                                                                                                                                                                    There is one last step left to complete the setup.

                                                                                                                                                                                    -

                                                                                                                                                                                    Using the tests database in acceptance and functional tests

                                                                                                                                                                                    -

                                                                                                                                                                                    Acceptance and functional tests will act as users, navigating to the site pages and making requests as a user would.

                                                                                                                                                                                    -

                                                                                                                                                                                    This means that WordPress will load, and with it its wp-config.php file, to handle the requests made by the tests.

                                                                                                                                                                                    -

                                                                                                                                                                                    During the setup phase I've specified the database to be used for acceptance and functional tests as tests but, looking at the contents of the ~/Local Sites/myplugin/app/public/wp-config.php file, the DB_NAME constant is set to local.

                                                                                                                                                                                    -

                                                                                                                                                                                    What we'll do now means:

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • If the request is a normal one, use the local database.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • If the request comes from a test, use the tests database.
                                                                                                                                                                                    • -
                                                                                                                                                                                    -

                                                                                                                                                                                    In your IDE/text-editor of choice edit the ~/Local Sites/myplugin/app/public/wp-config.php and replace the line defining the DB_NAME constant like this:

                                                                                                                                                                                    -
                                                                                                                                                                                    - define( 'DB_NAME', 'local' );
                                                                                                                                                                                    -+ if( isset( $_SERVER['HTTP_X_WPBROWSER_REQUEST'] ) && $_SERVER['HTTP_X_WPBROWSER_REQUEST'] ) { 
                                                                                                                                                                                    -+    define( 'DB_NAME', 'tests' );
                                                                                                                                                                                    -+ } else {
                                                                                                                                                                                    -+    define( 'DB_NAME', 'local' );
                                                                                                                                                                                    -+ }
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Here's the copy-and-paste friendly version:

                                                                                                                                                                                    -
                                                                                                                                                                                    if( isset( $_SERVER['HTTP_X_TEST_REQUEST'] ) && $_SERVER['HTTP_X_TEST_REQUEST'] ) {
                                                                                                                                                                                    -        define( 'DB_NAME', 'tests' );
                                                                                                                                                                                    -} else {
                                                                                                                                                                                    -        define( 'DB_NAME', 'local' );
                                                                                                                                                                                    -}
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    If you look at the tests/acceptance.suite.yml and tests/functional.suite.yml files, respectively the acceptance and functional suite configuration files, you will see these entries in the WPBrowser module configuration:

                                                                                                                                                                                    -
                                                                                                                                                                                    headers:
                                                                                                                                                                                    -    X_TEST_REQUEST: 1
                                                                                                                                                                                    -    X_WPBROWSER_REQUEST: 1
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    This means that, with each HTTP request done during tests, the module will send the two headers.
                                                                                                                                                                                    -Those headers are read, on the WordPress side, using the $_SERVER['HTTP_X_TEST_REQUEST'] and $_SERVER['X_WPBROWSER_REQUEST'] variables.

                                                                                                                                                                                    -

                                                                                                                                                                                    Codeception and wp-browser are ready to run and the test-drive development can start.

                                                                                                                                                                                    -

                                                                                                                                                                                    Sanity check

                                                                                                                                                                                    -

                                                                                                                                                                                    Before starting to write tests, take a moment to run each suite separately and make sure all is set up correctly.

                                                                                                                                                                                    -

                                                                                                                                                                                    If you run into issues, there's a chance you forgot something along the way, please take the time to read this tutorial a second time before opening an issue.

                                                                                                                                                                                    -

                                                                                                                                                                                    You have created 4 suites, each suite has at least one example test to make sure all works.
                                                                                                                                                                                    -Run each suite and make sure all tests succeed, from within the box run:

                                                                                                                                                                                    -
                                                                                                                                                                                    cd ~/Local Sites/myplugin/app/public/wp-content/plugins/my-plugin 
                                                                                                                                                                                    -vendor/bin/codecept run acceptance
                                                                                                                                                                                    -vendor/bin/codecept run functional
                                                                                                                                                                                    -vendor/bin/codecept run wpunit
                                                                                                                                                                                    -vendor/bin/codecept run unit
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    You're now run to customize the suites to your liking or start writing tests, run vendor/bin/codecept to see a list of the available commands.

                                                                                                                                                                                    - - - - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - -
                                                                                                                                                                                    - -
                                                                                                                                                                                    - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - - - - - - - \ No newline at end of file diff --git a/docs/public/v3/tutorials/mamp-mac-setup/index.html b/docs/public/v3/tutorials/mamp-mac-setup/index.html deleted file mode 100644 index 40a346449..000000000 --- a/docs/public/v3/tutorials/mamp-mac-setup/index.html +++ /dev/null @@ -1,566 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - Mamp mac setup - wp-browser docs - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
                                                                                                                                                                                    - -
                                                                                                                                                                                    - - - - - - -
                                                                                                                                                                                    - - -
                                                                                                                                                                                    - -
                                                                                                                                                                                    - - - - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - - - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - - - - - -

                                                                                                                                                                                    Mamp mac setup

                                                                                                                                                                                    - -

                                                                                                                                                                                    Setting up wp-browser with MAMP on Mac to test a plugin

                                                                                                                                                                                    -

                                                                                                                                                                                    Requirements

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • A Mac machine
                                                                                                                                                                                    • -
                                                                                                                                                                                    • A working installation of MAMP.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • You should be able to create sites and visit them from your browser without issues.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • Composer installed and working on your terminal PATH, you should be able to run composer --version at the terminal and see the version correctly.
                                                                                                                                                                                    • -
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    The version of MAMP used in this tutorial is the free, non PRO, one. MAMP PRO provides more features, but the setup instructions should remain valid.

                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Install and configure MAMP

                                                                                                                                                                                    -

                                                                                                                                                                                    This walk-through starts after MAMP has been installed and is correctly running on the host machine; you can download MAMP from the site and follow the installation instructions.
                                                                                                                                                                                    -In the context of this guide I'm assuming the "Document Root" directory is the default one, in the /Applications/MAMP/htdocs directory.
                                                                                                                                                                                    -If your document root lies elsewhere, replace the /Applications/MAMP/htdocs path with the actual directory in each command.

                                                                                                                                                                                    -

                                                                                                                                                                                    -

                                                                                                                                                                                    -

                                                                                                                                                                                    Creating the databases and installing WordPress

                                                                                                                                                                                    -

                                                                                                                                                                                    Go to the http://localhost/phpMyAdmin/ page and create two new databases:

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • wordpress is the database you will use for WordPress
                                                                                                                                                                                    • -
                                                                                                                                                                                    • tests is the database you will use for the tests
                                                                                                                                                                                    • -
                                                                                                                                                                                    -

                                                                                                                                                                                    -

                                                                                                                                                                                    Unzip the the WordPress files into the /Applications/MAMP/htdocs and head over to http://localhost to install WordPress.

                                                                                                                                                                                    -

                                                                                                                                                                                    The database credentials for the installation are:

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • Database name: wordpress
                                                                                                                                                                                    • -
                                                                                                                                                                                    • Database user: root
                                                                                                                                                                                    • -
                                                                                                                                                                                    • Database password: root
                                                                                                                                                                                    • -
                                                                                                                                                                                    • Database host: localhost
                                                                                                                                                                                    • -
                                                                                                                                                                                    -

                                                                                                                                                                                    Use admin as administrator user name and password as password for the administrator user.

                                                                                                                                                                                    -

                                                                                                                                                                                    -

                                                                                                                                                                                    -

                                                                                                                                                                                    Make sure you can visit the WordPress installation at http://localhost and that you can correctly access the administration area at http://localhost/wp-admin.

                                                                                                                                                                                    -

                                                                                                                                                                                    Scaffolding the project folder

                                                                                                                                                                                    -

                                                                                                                                                                                    I'm assuming the scope of the development is to test the my-plugin plugin.

                                                                                                                                                                                    -

                                                                                                                                                                                    The first step is to create the bare minimum code required to make the plugin show up among the available WordPress plugins.
                                                                                                                                                                                    -Create the main plugin file in the WordPress installation plugins directory, in the /Applications/MAMP/htdocs/wp-content/plugins/my-plugin/my-plugin.php file:

                                                                                                                                                                                    -
                                                                                                                                                                                    <?php
                                                                                                                                                                                    -/**
                                                                                                                                                                                    - * Plugin Name: My plugin
                                                                                                                                                                                    - */ 
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    The plugin should now show up, activate and deactivate correctly, among the plugins listed in the WordPress installation at http://localhost/wp-admin/plugins.php.

                                                                                                                                                                                    -

                                                                                                                                                                                    -

                                                                                                                                                                                    Installing wp-browser

                                                                                                                                                                                    -

                                                                                                                                                                                    Open a terminal window and navigate to the plugin directory and initialize the Composer project:

                                                                                                                                                                                    -
                                                                                                                                                                                    cd /Applications/MAMP/htdocs/wp-content/plugins/my-plugin
                                                                                                                                                                                    -composer init
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    -

                                                                                                                                                                                    Composer will ask some questions to initialize the project, for the sake of this small guide the answers are not relevant. -Here is the composer.json file generated by the above answers:

                                                                                                                                                                                    -
                                                                                                                                                                                    {
                                                                                                                                                                                    -    "name": "mamp/my-plugin",
                                                                                                                                                                                    -    "type": "wordpress-plugin",
                                                                                                                                                                                    -    "require": {}
                                                                                                                                                                                    -}
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Next require lucatume/wp-browser as a development dependency:

                                                                                                                                                                                    -
                                                                                                                                                                                    composer require --dev lucatume/wp-browser
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Composer installs any dependency binary file, an executable file, in the project vendor/bin folder.
                                                                                                                                                                                    -To check Codeception is correctly installed run this command:

                                                                                                                                                                                    -
                                                                                                                                                                                    vendor/bin/codecept --version
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Since wp-browser requires Codeception, there is no need to require Codeception explicitly as a development dependency.

                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Setting up wp-browser

                                                                                                                                                                                    -

                                                                                                                                                                                    For those that might get lost while trying to set up wp-browser for the first time the VVV context provides an excellent base to understand the process.

                                                                                                                                                                                    -

                                                                                                                                                                                    wp-browser needs to know:

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • Where the WordPress installation files are located: they will be loaded in integration and "WordPress unit" tests.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • How to connect to the WordPress site "normal" database: this is the database that stores the data of the site I would see when visiting the local installation URL at http://localhost.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • How to connect to the database dedicated to the integration and "WordPress unit" tests: this database will be used to install WordPress during integration and "WordPress unit" tests.
                                                                                                                                                                                    • -
                                                                                                                                                                                    -

                                                                                                                                                                                    Any test suite using a database should never run on a database containing data of any value; this means that your first step should be to backup the site database.

                                                                                                                                                                                    -

                                                                                                                                                                                    You can create a backup of the current site database contents using phpMyAdmin, at http://localhost/phpMyAdmin/, under the "Export" tab:

                                                                                                                                                                                    -

                                                                                                                                                                                    -

                                                                                                                                                                                    At any moment you can re-import the site database dump using, again, phpMyAdmin, under the "Import" tab:

                                                                                                                                                                                    -

                                                                                                                                                                                    -

                                                                                                                                                                                    Bootstrapping and configuring wp-browser

                                                                                                                                                                                    -

                                                                                                                                                                                    After the backup is done it's time to bootstrap wp-browser using its interactive mode:

                                                                                                                                                                                    -
                                                                                                                                                                                    cd /Applications/MAMP/htdocs/wp-content/plugins/my-plugin
                                                                                                                                                                                    -vendor/bin/codecept init wpbrowser
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    The initialization guide will ask a number of questions.
                                                                                                                                                                                    -In the screenshots below are the answers I used to configure wp-browser.

                                                                                                                                                                                    -

                                                                                                                                                                                    -

                                                                                                                                                                                    -

                                                                                                                                                                                    Below a complete list of each answer:

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • I acknowledge wp-browser should run on development servers... y
                                                                                                                                                                                    • -
                                                                                                                                                                                    • Would you like to set up the suites interactively now? y
                                                                                                                                                                                    • -
                                                                                                                                                                                    • How would you like the acceptance suite to be called? acceptance
                                                                                                                                                                                    • -
                                                                                                                                                                                    • How would you like the functional suite to be called? functional
                                                                                                                                                                                    • -
                                                                                                                                                                                    • How would you like the WordPress unit and integration suite to be called? wpunit
                                                                                                                                                                                    • -
                                                                                                                                                                                    • How would you like to call the env configuration file? .env.testing
                                                                                                                                                                                    • -
                                                                                                                                                                                    • What is the path of the WordPress root directory? /Applications/MAMP/htdocs
                                                                                                                                                                                    • -
                                                                                                                                                                                    • What is the path, relative to WordPress root URL, of the admin area of the test site? /wp-admin
                                                                                                                                                                                    • -
                                                                                                                                                                                    • What is the name of the test database used by the test site? tests
                                                                                                                                                                                    • -
                                                                                                                                                                                    • What is the host of the test database used by the test site? localhost
                                                                                                                                                                                    • -
                                                                                                                                                                                    • What is the user of the test database used by the test site? root
                                                                                                                                                                                    • -
                                                                                                                                                                                    • What is the password of the test database used by the test site? root
                                                                                                                                                                                    • -
                                                                                                                                                                                    • What is the table prefix of the test database used by the test site? wp_
                                                                                                                                                                                    • -
                                                                                                                                                                                    • What is the name of the test database WPLoader should use? tests
                                                                                                                                                                                    • -
                                                                                                                                                                                    • What is the host of the test database WPLoader should use? localhost
                                                                                                                                                                                    • -
                                                                                                                                                                                    • What is the user of the test database WPLoader should use? root
                                                                                                                                                                                    • -
                                                                                                                                                                                    • What is the password of the test database WPLoader should use? root
                                                                                                                                                                                    • -
                                                                                                                                                                                    • What is the table prefix of the test database WPLoader should use? wp_
                                                                                                                                                                                    • -
                                                                                                                                                                                    • What is the URL the test site? http://localhost
                                                                                                                                                                                    • -
                                                                                                                                                                                    • What is the email of the test site WordPress administrator? admin@wp.test
                                                                                                                                                                                    • -
                                                                                                                                                                                    • What is the title of the test site? My Plugin Test
                                                                                                                                                                                    • -
                                                                                                                                                                                    • What is the login of the administrator user of the test site? admin
                                                                                                                                                                                    • -
                                                                                                                                                                                    • What is the password of the administrator user of the test site? password
                                                                                                                                                                                    • -
                                                                                                                                                                                    • Are you testing a plugin, a theme or a combination of both (both)? plugin
                                                                                                                                                                                    • -
                                                                                                                                                                                    • What is the folder/plugin.php name of the plugin? my-plugin/my-plugin.php
                                                                                                                                                                                    • -
                                                                                                                                                                                    • Does your project needs additional plugins to be activated to work? no
                                                                                                                                                                                    • -
                                                                                                                                                                                    -

                                                                                                                                                                                    Codeception will build the suites for the first time and should be ready to go.

                                                                                                                                                                                    -

                                                                                                                                                                                    Setting up the starting database fixture

                                                                                                                                                                                    -

                                                                                                                                                                                    A "fixture", in testing terms, is a minimal, starting environment shared by all tests.
                                                                                                                                                                                    -In BDD it's the Background any scenario will share. -In the case of a plugin the minimal, starting environment is the following:

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • A fresh WordPress installation empty of any content.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • WordPress using its default theme.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • The only active plugin is the one you're testing, in this example: my-plugin.
                                                                                                                                                                                    • -
                                                                                                                                                                                    -

                                                                                                                                                                                    You should set up this fixture "manually", using the site administration UI at http://localhost/wp-admin.

                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    The following command will empty the site, backup any content you care about first!

                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    When you're done setting up the initial database fixture, export it using the "Export" tab of phpMyAdmin, at http://localhost/phpMyAdmin/ and move the file to the /Applications/MAMP/htdocs/wp-content/plugins/my-plugin/tests/_data/dump.sql directory.

                                                                                                                                                                                    -

                                                                                                                                                                                    There is one last step left to complete the setup.

                                                                                                                                                                                    -

                                                                                                                                                                                    Using the tests database in acceptance and functional tests

                                                                                                                                                                                    -

                                                                                                                                                                                    Acceptance and functional tests will act as users, navigating to the site pages and making requests as a user would.

                                                                                                                                                                                    -

                                                                                                                                                                                    This means that WordPress will load, and with it its wp-config.php file, to handle the requests made by the tests.

                                                                                                                                                                                    -

                                                                                                                                                                                    During the setup phase I've specified the database to be used for acceptance and functional tests as tests but, looking at the contents of the /Applications/MAMP/htdocs/wp-config.php file, the DB_NAME constant is set to wordpress.

                                                                                                                                                                                    -

                                                                                                                                                                                    What we'll do now means:

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • If the request is a normal one, use the wordpress database.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • If the request comes from a test, use the tests database.
                                                                                                                                                                                    • -
                                                                                                                                                                                    -

                                                                                                                                                                                    In your IDE/text-editor of choice edit the /Applications/MAMP/htdocs/wp-config.php and replace the line defining the DB_NAME constant like this:

                                                                                                                                                                                    -
                                                                                                                                                                                    - define( 'DB_NAME', 'wordpress' );
                                                                                                                                                                                    -+ if( isset( $_SERVER['HTTP_X_WPBROWSER_REQUEST'] ) && $_SERVER['HTTP_X_WPBROWSER_REQUEST'] ) { 
                                                                                                                                                                                    -+    define( 'DB_NAME', 'tests' );
                                                                                                                                                                                    -+ } else {
                                                                                                                                                                                    -+    define( 'DB_NAME', 'wordpress' );
                                                                                                                                                                                    -+ }
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Here's the copy-and-paste friendly version:

                                                                                                                                                                                    -
                                                                                                                                                                                    if( isset( $_SERVER['HTTP_X_TEST_REQUEST'] ) && $_SERVER['HTTP_X_TEST_REQUEST'] ) {
                                                                                                                                                                                    -        define( 'DB_NAME', 'tests' );
                                                                                                                                                                                    -} else {
                                                                                                                                                                                    -        define( 'DB_NAME', 'wordpress' );
                                                                                                                                                                                    -}
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    If you look at the tests/acceptance.suite.yml and tests/functional.suite.yml files, respectively the acceptance and functional suite configuration files, you will see these entries in the WPBrowser module configuration:

                                                                                                                                                                                    -
                                                                                                                                                                                    headers:
                                                                                                                                                                                    -    X_TEST_REQUEST: 1
                                                                                                                                                                                    -    X_WPBROWSER_REQUEST: 1
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    This means that, with each HTTP request done during tests, the module will send the two headers.
                                                                                                                                                                                    -Those headers are read, on the WordPress side, using the $_SERVER['HTTP_X_TEST_REQUEST'] and $_SERVER['X_WPBROWSER_REQUEST'] variables.

                                                                                                                                                                                    -

                                                                                                                                                                                    Codeception and wp-browser are ready to run and the test-drive development can start.

                                                                                                                                                                                    -

                                                                                                                                                                                    Sanity check

                                                                                                                                                                                    -

                                                                                                                                                                                    Before starting to write tests, take a moment to run each suite separately and make sure all is set up correctly.

                                                                                                                                                                                    -

                                                                                                                                                                                    If you run into issues, there's a chance you forgot something along the way, please take the time to read this tutorial a second time before opening an issue.

                                                                                                                                                                                    -

                                                                                                                                                                                    You have created 4 suites, each suite has at least one example test to make sure all works.
                                                                                                                                                                                    -Run each suite and make sure all tests succeed, from within the box run:

                                                                                                                                                                                    -
                                                                                                                                                                                    cd /Applications/MAMP/htdocs/wp-content/plugins/my-plugin 
                                                                                                                                                                                    -vendor/bin/codecept run acceptance
                                                                                                                                                                                    -vendor/bin/codecept run functional
                                                                                                                                                                                    -vendor/bin/codecept run wpunit
                                                                                                                                                                                    -vendor/bin/codecept run unit
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    You're now run to customize the suites to your liking or start writing tests, run vendor/bin/codecept to see a list of the available commands.

                                                                                                                                                                                    - - - - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - -
                                                                                                                                                                                    - -
                                                                                                                                                                                    - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - - - - - - - \ No newline at end of file diff --git a/docs/public/v3/tutorials/vvv-setup/index.html b/docs/public/v3/tutorials/vvv-setup/index.html deleted file mode 100644 index c7443855e..000000000 --- a/docs/public/v3/tutorials/vvv-setup/index.html +++ /dev/null @@ -1,623 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - Vvv setup - wp-browser docs - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
                                                                                                                                                                                    - -
                                                                                                                                                                                    - - - - - - -
                                                                                                                                                                                    - - -
                                                                                                                                                                                    - -
                                                                                                                                                                                    - - - - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - - - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - - - - - -

                                                                                                                                                                                    Vvv setup

                                                                                                                                                                                    - -

                                                                                                                                                                                    Setting up wp-browser on VVV to test a plugin

                                                                                                                                                                                    -

                                                                                                                                                                                    Requirements

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • A Windows, Linux or Mac machine (I'll call this the "host machine" or just "host").
                                                                                                                                                                                    • -
                                                                                                                                                                                    • A working installation of VVV; you should be able to navigate to VVV root directory, run the vagrant up command, and have VVV up and running.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • On the VVV installation you should be able to visit the two default sites URLs without issues; the two default sites addresses are:
                                                                                                                                                                                        -
                                                                                                                                                                                      • http://one.wordpress.test
                                                                                                                                                                                      • -
                                                                                                                                                                                      • http://two.wordpress.test
                                                                                                                                                                                      • -
                                                                                                                                                                                      -
                                                                                                                                                                                    • -
                                                                                                                                                                                    -

                                                                                                                                                                                    Why VVV?

                                                                                                                                                                                    -

                                                                                                                                                                                    The VVV project provides a "a Vagrant configuration for developing with WordPress" and is an excellent, no-frills, starting point to develop WordPress projects (themes, plugins and whole sites.
                                                                                                                                                                                    -Based on Vagrant and Virtual Box, VVV removes the differences between systems by providing a uniform, Ubuntu Linux based, virtual machine that will bahave the same on Windows, Linux and Mac. -Configuring it to run WordPress tests is easy: let's get started.

                                                                                                                                                                                    -

                                                                                                                                                                                    Check VVV works correctly

                                                                                                                                                                                    -

                                                                                                                                                                                    This walk-through starts after VVV has been installed and is running on the host machine; the installation guide is clear and simple to follow and I'm not duplicating it here.
                                                                                                                                                                                    -In the context of this guide I'm assuming VVV lives in the ~/Repos/VVV directory, that we are working on the my-plugin project and that the plugin is being developed in the default (wordpress-one) WordPress installation provided by the box.
                                                                                                                                                                                    -If your VVV installation lies elsewhere, replace the ~/Repos/VVV with the actual directory in each command.

                                                                                                                                                                                    -

                                                                                                                                                                                    After completing the installation of VVV navigate to VVV root folder and run the vagrant up command:

                                                                                                                                                                                    -
                                                                                                                                                                                    cd ~/Repos/VVV
                                                                                                                                                                                    -vagrant up
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    vagrant up command result

                                                                                                                                                                                    -

                                                                                                                                                                                    After the automatic bootstrap and initialization process completed, VVV makes two WordPress sites available:

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • http://one.wordpress.test/ is the first default site address.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • http://two.wordpress.test/ is the second default site address.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • http://vvv.test/ is VVV dashboard address.
                                                                                                                                                                                    • -
                                                                                                                                                                                    -

                                                                                                                                                                                    You should be able to reach each one of the URLs above without issues, should this not be the case something during VVV setup did not go according to the plan and you should fix it before moving on.

                                                                                                                                                                                    -

                                                                                                                                                                                    If the sanity check above is complete it's time to move to the following part specific to Codeception and wp-browser setup.

                                                                                                                                                                                    -

                                                                                                                                                                                    In and out, host and guest

                                                                                                                                                                                    -

                                                                                                                                                                                    The Vagrant box provided by VVV goes beyond a simple MySQL, PHP and Ngnix server stack and provides a complete WordPress development environment; tools like Composer, [grunt-cli][4992-0003], and [wp-cli][4992-0006] are ready to use.

                                                                                                                                                                                    -

                                                                                                                                                                                    This allows the entire development, when it comes to the CLI tools, to happen in the virtual machine and not outside of it.

                                                                                                                                                                                    -

                                                                                                                                                                                    "Inside the virtual machine" means the first CLI instruction to run from the ~/Repos/VVV folder (assuming that is the folder where VVV was installed) is this:

                                                                                                                                                                                    -
                                                                                                                                                                                    cd ~/Repos/VVV
                                                                                                                                                                                    -vagrant ssh
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    vagrant ssh command result

                                                                                                                                                                                    -

                                                                                                                                                                                    This will connect, via SSH, to the virtual machine as the vagrant user.
                                                                                                                                                                                    -To exit from the SSH session inside the box, just type exit and return.

                                                                                                                                                                                    -

                                                                                                                                                                                    Note: any further instruction I'm showing here, beside the code editing that will happen in a dedicated PHP IDE like [PHPStorm][4992-0004] or [Sublime Text][4992-0005] on the host machine, will happen "inside the virtual machine".

                                                                                                                                                                                    -

                                                                                                                                                                                    When I say "host machine" I mean your laptop, desktop or whatever computer you're working on; when I say "guest machine" I mean VVV virtual machine; this is usually the case for any virtual-ish setup (Vagrant, Docker and the like).

                                                                                                                                                                                    -

                                                                                                                                                                                    Scaffolding the project folder

                                                                                                                                                                                    -

                                                                                                                                                                                    I'm assuming the scope of the development is to test the my-plugin plugin.

                                                                                                                                                                                    -

                                                                                                                                                                                    The first step is to create the bare minimum code required to make the plugin show up among the available WordPress plugins.
                                                                                                                                                                                    -Create the main plugin file in the http://one.wordpress.test installation plugins directory, in the ~/Repos/VVV/www/wordpress-one/public_html/wp-content/plugins/my-plugin/my-plugin.php file:

                                                                                                                                                                                    -
                                                                                                                                                                                    <?php
                                                                                                                                                                                    -/**
                                                                                                                                                                                    - * Plugin Name: My plugin
                                                                                                                                                                                    - */ 
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    The plugin should now show up, activate and deactivate correctly, among the plugins listed in the VVV default WordPress installation at http://one.wordpress.test/wp-admin/plugins.php.

                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    By default, VVV administrator user name is admin and password is password.

                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    -

                                                                                                                                                                                    Installing wp-browser

                                                                                                                                                                                    -

                                                                                                                                                                                    Since Composer is provided from VVV, installing wp-browser requires entering the virtual machine (if you did not already):

                                                                                                                                                                                    -
                                                                                                                                                                                    cd ~/Repos/VVV
                                                                                                                                                                                    -vagrant ssh
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Once inside navigate to the plugins folder.
                                                                                                                                                                                    -The path is now relative to VVV filesystem structure so it won't be the same as the one used above that was, instead, in the context of the "host machine":

                                                                                                                                                                                    -
                                                                                                                                                                                    cd /srv/www/wordpress-one/public_html/wp-content/plugins/my-plugin 
                                                                                                                                                                                    -composer init
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    -

                                                                                                                                                                                    Composer will ask some questions to initialize the project, for the sake of this small guide the answers are not relevant. -Here is the composer.json file generated by the above answers:

                                                                                                                                                                                    -
                                                                                                                                                                                    {
                                                                                                                                                                                    -    "name": "vagrant/my-plugin",
                                                                                                                                                                                    -    "type": "wordpress-plugin",
                                                                                                                                                                                    -    "require": {}
                                                                                                                                                                                    -}
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Next require lucatume/wp-browser as a development dependency:

                                                                                                                                                                                    -
                                                                                                                                                                                    composer require --dev lucatume/wp-browser
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Composer installs any dependency binary file, an executable file, in the project vendor/bin folder.
                                                                                                                                                                                    -To check Codeception is correctly installed run this command:

                                                                                                                                                                                    -
                                                                                                                                                                                    vendor/bin/codecept --version
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Since wp-browser requires Codeception, there is no need to require Codeception explicitly as a development dependency.

                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Setting up wp-browser

                                                                                                                                                                                    -

                                                                                                                                                                                    For those that might get lost while trying to set up wp-browser for the first time the VVV context provides an excellent base to understand the process.

                                                                                                                                                                                    -

                                                                                                                                                                                    wp-browser needs to know:

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • Where the WordPress installation files are located: they will be loaded in integration and "WordPress unit" tests.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • How to connect to the WordPress site "normal" database: this is the database that stores the data of the site I would see when visiting the local installation URL (http://one.wordpress.test in the case of the VVV default installation).
                                                                                                                                                                                    • -
                                                                                                                                                                                    • How to connect to the database dedicated to the integration and "WordPress unit" tests: this database will be used to install WordPress during integration and "WordPress unit" tests.
                                                                                                                                                                                    • -
                                                                                                                                                                                    -

                                                                                                                                                                                    Any test suite using a database should never run on a database containing data of any value; this means that if I am using VVV for my day to day WordPress development my first step should be to backup the site database.

                                                                                                                                                                                    -

                                                                                                                                                                                    You can create a backup of the current site database contents using wp-cli from within the virtual machine:

                                                                                                                                                                                    -
                                                                                                                                                                                    cd /srv/www/wordpress-one/public_html
                                                                                                                                                                                    -wp db export wordpress-one-backup.sql
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    At any moment you can re-import the site database dump using this command, the site database will be reset to the state it was when you created the database dump:

                                                                                                                                                                                    -
                                                                                                                                                                                    cd /srv/www/wordpress-one/public_html
                                                                                                                                                                                    -wp db import wordpress-one-backup.sql
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    -

                                                                                                                                                                                    Creating the database dedicated to the tests

                                                                                                                                                                                    -

                                                                                                                                                                                    wp-browser will use the databases it works on in a destructive way: between tests the data will be lost.

                                                                                                                                                                                    -

                                                                                                                                                                                    After the backup you should have done in the previous step, the next step is creating a database dedicated to the test.

                                                                                                                                                                                    -

                                                                                                                                                                                    At the VVV box command line run:

                                                                                                                                                                                    -
                                                                                                                                                                                    mysql -u root -p -e "CREATE DATABASE if not exists tests"
                                                                                                                                                                                    -mysql -u root -p -e "GRANT ALL PRIVILEGES ON tests.* TO 'wp'@'localhost';"
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    When prompted for the password enter root. -The first command creates the tests database, if it does not exist; the second command grants the wp user all privileges on it.

                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    In VVV the root database user name is root and the password is root.

                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Check the database was correctly created running this command:

                                                                                                                                                                                    -
                                                                                                                                                                                    mysql -u root -p -e "SHOW DATABASES"
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    The tests database should be present in the list.

                                                                                                                                                                                    -

                                                                                                                                                                                    Bootstrapping and configuring wp-browser

                                                                                                                                                                                    -

                                                                                                                                                                                    After the backup is done it's time to bootstrap wp-browser using its interactive mode:

                                                                                                                                                                                    -
                                                                                                                                                                                    cd /srv/www/wordpress-one/public_html/wp-content/plugins/my-plugin
                                                                                                                                                                                    -vendor/bin/codecept init wpbrowser
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    The initialization guide will ask a number of questions.
                                                                                                                                                                                    -In the screenshots below are the answers I used to configure wp-browser.

                                                                                                                                                                                    -

                                                                                                                                                                                    -

                                                                                                                                                                                    -

                                                                                                                                                                                    Below a complete list of each answer:

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • I acknowledge wp-browser should run on development servers... y
                                                                                                                                                                                    • -
                                                                                                                                                                                    • Would you like to set up the suites interactively now? y
                                                                                                                                                                                    • -
                                                                                                                                                                                    • How would you like the acceptance suite to be called? acceptance
                                                                                                                                                                                    • -
                                                                                                                                                                                    • How would you like the functional suite to be called? functional
                                                                                                                                                                                    • -
                                                                                                                                                                                    • How would you like the WordPress unit and integration suite to be called? wpunit
                                                                                                                                                                                    • -
                                                                                                                                                                                    • How would you like to call the env configuration file? .env.testing
                                                                                                                                                                                    • -
                                                                                                                                                                                    • What is the path of the WordPress root directory? /srv/www/wordpress-one/public_html
                                                                                                                                                                                    • -
                                                                                                                                                                                    • What is the path, relative to WordPress root URL, of the admin area of the test site? /wp-admin
                                                                                                                                                                                    • -
                                                                                                                                                                                    • What is the name of the test database used by the test site? tests
                                                                                                                                                                                    • -
                                                                                                                                                                                    • What is the host of the test database used by the test site? localhost
                                                                                                                                                                                    • -
                                                                                                                                                                                    • What is the user of the test database used by the test site? root
                                                                                                                                                                                    • -
                                                                                                                                                                                    • What is the password of the test database used by the test site? root
                                                                                                                                                                                    • -
                                                                                                                                                                                    • What is the table prefix of the test database used by the test site? wp_
                                                                                                                                                                                    • -
                                                                                                                                                                                    • What is the name of the test database WPLoader should use? tests
                                                                                                                                                                                    • -
                                                                                                                                                                                    • What is the host of the test database WPLoader should use? localhost
                                                                                                                                                                                    • -
                                                                                                                                                                                    • What is the user of the test database WPLoader should use? root
                                                                                                                                                                                    • -
                                                                                                                                                                                    • What is the password of the test database WPLoader should use? root
                                                                                                                                                                                    • -
                                                                                                                                                                                    • What is the table prefix of the test database WPLoader should use? wp_
                                                                                                                                                                                    • -
                                                                                                                                                                                    • What is the URL the test site? http://one.wordpress.test
                                                                                                                                                                                    • -
                                                                                                                                                                                    • What is the email of the test site WordPress administrator? admin@one.wordpress.test
                                                                                                                                                                                    • -
                                                                                                                                                                                    • What is the title of the test site? My Plugin Test
                                                                                                                                                                                    • -
                                                                                                                                                                                    • What is the login of the administrator user of the test site? admin
                                                                                                                                                                                    • -
                                                                                                                                                                                    • What is the password of the administrator user of the test site? password
                                                                                                                                                                                    • -
                                                                                                                                                                                    • Are you testing a plugin, a theme or a combination of both (both)? plugin
                                                                                                                                                                                    • -
                                                                                                                                                                                    • What is the folder/plugin.php name of the plugin? my-plugin/my-plugin.php
                                                                                                                                                                                    • -
                                                                                                                                                                                    • Does your project needs additional plugins to be activated to work? no
                                                                                                                                                                                    • -
                                                                                                                                                                                    -

                                                                                                                                                                                    Codeception will build the suites for the first time and should be ready to go.

                                                                                                                                                                                    -

                                                                                                                                                                                    Setting up the starting database fixture

                                                                                                                                                                                    -

                                                                                                                                                                                    A "fixture", in testing terms, is a minimal, starting environment shared by all tests.
                                                                                                                                                                                    -In BDD it's the Background any scenario will share. -In the case of a plugin the minimal, starting environment is the following:

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • A fresh WordPress installation empty of any content.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • WordPress using its default theme.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • The only active plugin is the one you're testing, in this example: my-plugin.
                                                                                                                                                                                    • -
                                                                                                                                                                                    -

                                                                                                                                                                                    You can set up this fixture "manually", using the site administration UI at http://one.wordpress.test/wp-admin, or use wp-cli and save precious time.

                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    The following command will empty the site, backup any content you care about first!

                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    As it's been the case so far, I'm running the following command from within the VVV box (use vagrant ssh to log in):

                                                                                                                                                                                    -
                                                                                                                                                                                    cd /srv/www/wordpress-one/public_html
                                                                                                                                                                                    -wp site empty --yes --uploads
                                                                                                                                                                                    -wp plugin deactivate --all
                                                                                                                                                                                    -wp plugin activate my-plugin
                                                                                                                                                                                    -wp db export wp-content/plugins/my-plugin/tests/_data/dump.sql
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    The initial database fixture has been created, now there's one last step to complete.

                                                                                                                                                                                    -

                                                                                                                                                                                    Using the tests database in acceptance and functional tests

                                                                                                                                                                                    -

                                                                                                                                                                                    Acceptance and functional tests will act as users, navigating to the site pages and making requests as a user would.

                                                                                                                                                                                    -

                                                                                                                                                                                    This means that WordPress will load, and with it its wp-config.php file, to handle the requests made by the tests.

                                                                                                                                                                                    -

                                                                                                                                                                                    During the setup phase I've specified the database to be used for acceptance and functional tests as tests but, looking at the contents of the /srv/www/wordpress-one/public_html/wp-config.php file, the DB_NAME constant is set to wordpress-one.

                                                                                                                                                                                    -

                                                                                                                                                                                    What we'll do now means:

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • If the request is a normal one, use the wordpress-one database.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • If the request comes from a test, use the tests database.
                                                                                                                                                                                    • -
                                                                                                                                                                                    -

                                                                                                                                                                                    In your IDE/text-editor of choice edit the ~/Repos/VVV/www/wordpress-one/public_html/wp-config.php and replace the line defining the DB_NAME constant like this:

                                                                                                                                                                                    -
                                                                                                                                                                                    - define( 'DB_NAME', 'wordpress-one' );
                                                                                                                                                                                    -+ if( isset( $_SERVER['HTTP_X_WPBROWSER_REQUEST'] ) && $_SERVER['HTTP_X_WPBROWSER_REQUEST'] ) { 
                                                                                                                                                                                    -+    define( 'DB_NAME', 'tests' );
                                                                                                                                                                                    -+ } else {
                                                                                                                                                                                    -+    define( 'DB_NAME', 'wordpress-one' );
                                                                                                                                                                                    -+ }
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Here's the copy-and-paste friendly version:

                                                                                                                                                                                    -
                                                                                                                                                                                    if( isset( $_SERVER['HTTP_X_TEST_REQUEST'] ) && $_SERVER['HTTP_X_TEST_REQUEST'] ) {
                                                                                                                                                                                    -        define( 'DB_NAME', 'tests' );
                                                                                                                                                                                    -} else {
                                                                                                                                                                                    -        define( 'DB_NAME', 'wordpress-one' );
                                                                                                                                                                                    -}
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    If you look at the tests/acceptance.suite.yml and tests/functional.suite.yml files, respectively the acceptance and functional suite configuration files, you will see these entries in the WPBrowser module configuration:

                                                                                                                                                                                    -
                                                                                                                                                                                    headers:
                                                                                                                                                                                    -    X_TEST_REQUEST: 1
                                                                                                                                                                                    -    X_WPBROWSER_REQUEST: 1
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    This means that, with each HTTP request done during tests, the module will send the two headers.
                                                                                                                                                                                    -Those headers are read, on the WordPress side, using the $_SERVER['HTTP_X_TEST_REQUEST'] and $_SERVER['X_WPBROWSER_REQUEST'] variables.

                                                                                                                                                                                    -

                                                                                                                                                                                    Codeception and wp-browser are ready to run and the test-drive development can start.

                                                                                                                                                                                    -

                                                                                                                                                                                    Sanity check

                                                                                                                                                                                    -

                                                                                                                                                                                    Before starting to write tests, take a moment to run each suite separately and make sure all is set up correctly.

                                                                                                                                                                                    -

                                                                                                                                                                                    If you run into issues, there's a chance you forgot something along the way, please take the time to read this tutorial a second time before opening an issue.

                                                                                                                                                                                    -

                                                                                                                                                                                    You have created 4 suites, each suite has at least one example test to make sure all works.
                                                                                                                                                                                    -Run each suite and make sure all tests succeed, from within the box run:

                                                                                                                                                                                    -
                                                                                                                                                                                    cd /srv/www/wordpress-one/public_html/wp-content/plugins/my-plugin 
                                                                                                                                                                                    -vendor/bin/codecept run acceptance
                                                                                                                                                                                    -vendor/bin/codecept run functional
                                                                                                                                                                                    -vendor/bin/codecept run wpunit
                                                                                                                                                                                    -vendor/bin/codecept run unit
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    You're now run to customize the suites to your liking or start writing tests, run vendor/bin/codecept to see a list of the available commands.

                                                                                                                                                                                    - - - - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - -
                                                                                                                                                                                    - -
                                                                                                                                                                                    - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - - - - - - - \ No newline at end of file diff --git a/docs/public/v3/tutorials/wamp-setup/index.html b/docs/public/v3/tutorials/wamp-setup/index.html deleted file mode 100644 index 92923eba1..000000000 --- a/docs/public/v3/tutorials/wamp-setup/index.html +++ /dev/null @@ -1,567 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - Wamp setup - wp-browser docs - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
                                                                                                                                                                                    - -
                                                                                                                                                                                    - - - - - - -
                                                                                                                                                                                    - - -
                                                                                                                                                                                    - -
                                                                                                                                                                                    - - - - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - - - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - - - - - -

                                                                                                                                                                                    Wamp setup

                                                                                                                                                                                    - -

                                                                                                                                                                                    Setting up wp-browser with WAMP on Windows to test a plugin

                                                                                                                                                                                    -

                                                                                                                                                                                    Requirements

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • A Windows machine
                                                                                                                                                                                    • -
                                                                                                                                                                                    • A working installation of WAMP.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • You should be able to create sites and visit them from your browser without issues.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • Composer installed and working on your terminal PATH, you should be able to run composer --version at the terminal and see the version correctly.
                                                                                                                                                                                    • -
                                                                                                                                                                                    -

                                                                                                                                                                                    Install and configure WAMP

                                                                                                                                                                                    -

                                                                                                                                                                                    This walk-through starts after WAMP has been installed and is correctly running on the host machine; you can download WAMP from the site and follow the installation instructions.
                                                                                                                                                                                    -In the context of this guide I'm installing the test WordPress installation in the C:\wamp64\www\wp directory. -If your installation lies elsewhere, replace the C:\wamp64\www\wp path with the actual directory in each command.

                                                                                                                                                                                    -

                                                                                                                                                                                    -

                                                                                                                                                                                    -

                                                                                                                                                                                    Creating the databases and installing WordPress

                                                                                                                                                                                    -

                                                                                                                                                                                    Go to the http://localhost/phpmyadmin/index.php page and create two new databases:

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • wordpress is the database you will use for WordPress
                                                                                                                                                                                    • -
                                                                                                                                                                                    • tests is the database you will use for the tests
                                                                                                                                                                                    • -
                                                                                                                                                                                    -

                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    The default database user is root, the default password is empty.

                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Unzip the the WordPress files into the C:\wamp64\www\wp and head over to http://localhost/wp to install WordPress.
                                                                                                                                                                                    -The database credentials for the installation are:

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • Database name: wordpress
                                                                                                                                                                                    • -
                                                                                                                                                                                    • Database user: root
                                                                                                                                                                                    • -
                                                                                                                                                                                    • Database password is empty
                                                                                                                                                                                    • -
                                                                                                                                                                                    • Database host: localhost
                                                                                                                                                                                    • -
                                                                                                                                                                                    -

                                                                                                                                                                                    Use admin as administrator user name and password as password for the administrator user.

                                                                                                                                                                                    -

                                                                                                                                                                                    -

                                                                                                                                                                                    -

                                                                                                                                                                                    Make sure you can visit the WordPress installation at http://localhost/wp and that you can correctly access the administration area at http://localhost/wp/wp-admin.

                                                                                                                                                                                    -

                                                                                                                                                                                    Scaffolding the project folder

                                                                                                                                                                                    -

                                                                                                                                                                                    I'm assuming the scope of the development is to test the my-plugin plugin.

                                                                                                                                                                                    -

                                                                                                                                                                                    The first step is to create the bare minimum code required to make the plugin show up among the available WordPress plugins.
                                                                                                                                                                                    -Create the main plugin file in the WordPress installation plugins directory, in the C:\wamp64\www\wp\wp-content\plugins\my-plugin\my-plugin.php file:

                                                                                                                                                                                    -
                                                                                                                                                                                    <?php
                                                                                                                                                                                    -/**
                                                                                                                                                                                    - * Plugin Name: My plugin
                                                                                                                                                                                    - */ 
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    The plugin should now show up, activate and deactivate correctly, among the plugins listed in the WordPress installation at http://localhost/wp/wp-admin/plugins.php.

                                                                                                                                                                                    -

                                                                                                                                                                                    -

                                                                                                                                                                                    Installing wp-browser

                                                                                                                                                                                    -

                                                                                                                                                                                    Open a terminal window and navigate to the plugin directory and initialize the Composer project.
                                                                                                                                                                                    -I'm using Cmder as terminal emulator on Windows, but you can use the default one.

                                                                                                                                                                                    -
                                                                                                                                                                                    cd C:\wamp64\www\wp\wp-content\plugins\my-plugin
                                                                                                                                                                                    -composer init
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    -

                                                                                                                                                                                    Composer will ask some questions to initialize the project, for the sake of this small guide the answers are not relevant. -Here is the composer.json file generated by the above answers:

                                                                                                                                                                                    -
                                                                                                                                                                                    {
                                                                                                                                                                                    -    "name": "wamp/my-plugin",
                                                                                                                                                                                    -    "type": "wordpress-plugin",
                                                                                                                                                                                    -    "require": {}
                                                                                                                                                                                    -}
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Next require lucatume/wp-browser as a development dependency:

                                                                                                                                                                                    -
                                                                                                                                                                                    composer require --dev lucatume/wp-browser
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Composer installs any dependency binary file, an executable file, in the project vendor/bin folder.
                                                                                                                                                                                    -To check Codeception is correctly installed run this command:

                                                                                                                                                                                    -
                                                                                                                                                                                    vendor\bin\codecept.bat --version
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Since wp-browser requires Codeception, there is no need to require Codeception explicitly as a development dependency.

                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Setting up wp-browser

                                                                                                                                                                                    -

                                                                                                                                                                                    For those that might get lost while trying to set up wp-browser for the first time the VVV context provides an excellent base to understand the process.

                                                                                                                                                                                    -

                                                                                                                                                                                    wp-browser needs to know:

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • Where the WordPress installation files are located: they will be loaded in integration and "WordPress unit" tests.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • How to connect to the WordPress site "normal" database: this is the database that stores the data of the site I would see when visiting the local installation URL at http://localhost/wp.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • How to connect to the database dedicated to the integration and "WordPress unit" tests: this database will be used to install WordPress during integration and "WordPress unit" tests.
                                                                                                                                                                                    • -
                                                                                                                                                                                    -

                                                                                                                                                                                    Any test suite using a database should never run on a database containing data of any value; this means that your first step should be to backup the site database.

                                                                                                                                                                                    -

                                                                                                                                                                                    You can create a backup of the current site database contents using phpMyAdmin, at http://localhost/phpmyadmin/, under the "Export" tab:

                                                                                                                                                                                    -

                                                                                                                                                                                    -

                                                                                                                                                                                    At any moment you can re-import the site database dump using, again, phpMyAdmin, under the "Import" tab:

                                                                                                                                                                                    -

                                                                                                                                                                                    -

                                                                                                                                                                                    Bootstrapping and configuring wp-browser

                                                                                                                                                                                    -

                                                                                                                                                                                    After the backup is done it's time to bootstrap wp-browser using its interactive mode:

                                                                                                                                                                                    -
                                                                                                                                                                                    cd C:\wamp64\www\wp\wp-content\plugins\my-plugin
                                                                                                                                                                                    -vendor/bin/codecept.bat init wpbrowser
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    The initialization guide will ask a number of questions.
                                                                                                                                                                                    -In the screenshots below are the answers I used to configure wp-browser.

                                                                                                                                                                                    -

                                                                                                                                                                                    -

                                                                                                                                                                                    -

                                                                                                                                                                                    Below a complete list of each answer:

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • I acknowledge wp-browser should run on development servers... y
                                                                                                                                                                                    • -
                                                                                                                                                                                    • Would you like to set up the suites interactively now? y
                                                                                                                                                                                    • -
                                                                                                                                                                                    • How would you like the acceptance suite to be called? acceptance
                                                                                                                                                                                    • -
                                                                                                                                                                                    • How would you like the functional suite to be called? functional
                                                                                                                                                                                    • -
                                                                                                                                                                                    • How would you like the WordPress unit and integration suite to be called? wpunit
                                                                                                                                                                                    • -
                                                                                                                                                                                    • How would you like to call the env configuration file? .env.testing
                                                                                                                                                                                    • -
                                                                                                                                                                                    • What is the path of the WordPress root directory? C:/wamp64/www/wp
                                                                                                                                                                                    • -
                                                                                                                                                                                    • What is the path, relative to WordPress root URL, of the admin area of the test site? /wp-admin
                                                                                                                                                                                    • -
                                                                                                                                                                                    • What is the name of the test database used by the test site? tests
                                                                                                                                                                                    • -
                                                                                                                                                                                    • What is the host of the test database used by the test site? localhost
                                                                                                                                                                                    • -
                                                                                                                                                                                    • What is the user of the test database used by the test site? root
                                                                                                                                                                                    • -
                                                                                                                                                                                    • What is the password of the test database used by the test site? ``
                                                                                                                                                                                    • -
                                                                                                                                                                                    • What is the table prefix of the test database used by the test site? wp_
                                                                                                                                                                                    • -
                                                                                                                                                                                    • What is the name of the test database WPLoader should use? tests
                                                                                                                                                                                    • -
                                                                                                                                                                                    • What is the host of the test database WPLoader should use? localhost
                                                                                                                                                                                    • -
                                                                                                                                                                                    • What is the user of the test database WPLoader should use? root
                                                                                                                                                                                    • -
                                                                                                                                                                                    • What is the password of the test database WPLoader should use? ``
                                                                                                                                                                                    • -
                                                                                                                                                                                    • What is the table prefix of the test database WPLoader should use? wp_
                                                                                                                                                                                    • -
                                                                                                                                                                                    • What is the URL the test site? http://localhost/wp
                                                                                                                                                                                    • -
                                                                                                                                                                                    • What is the email of the test site WordPress administrator? admin@wp.test
                                                                                                                                                                                    • -
                                                                                                                                                                                    • What is the title of the test site? My Plugin Test
                                                                                                                                                                                    • -
                                                                                                                                                                                    • What is the login of the administrator user of the test site? admin
                                                                                                                                                                                    • -
                                                                                                                                                                                    • What is the password of the administrator user of the test site? password
                                                                                                                                                                                    • -
                                                                                                                                                                                    • Are you testing a plugin, a theme or a combination of both (both)? plugin
                                                                                                                                                                                    • -
                                                                                                                                                                                    • What is the folder/plugin.php name of the plugin? my-plugin/my-plugin.php
                                                                                                                                                                                    • -
                                                                                                                                                                                    • Does your project needs additional plugins to be activated to work? no
                                                                                                                                                                                    • -
                                                                                                                                                                                    -

                                                                                                                                                                                    Codeception will build the suites for the first time and should be ready to go.

                                                                                                                                                                                    -

                                                                                                                                                                                    Setting up the starting database fixture

                                                                                                                                                                                    -

                                                                                                                                                                                    A "fixture", in testing terms, is a minimal, starting environment shared by all tests.
                                                                                                                                                                                    -In BDD it's the Background any scenario will share. -In the case of a plugin the minimal, starting environment is the following:

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • A fresh WordPress installation empty of any content.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • WordPress using its default theme.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • The only active plugin is the one you're testing, in this example: my-plugin.
                                                                                                                                                                                    • -
                                                                                                                                                                                    -

                                                                                                                                                                                    You should set up this fixture "manually", using the site administration UI at http://localhost/wp/wp-admin.

                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    The following command will empty the site, backup any content you care about first!

                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    When you're done setting up the initial database fixture, export it using the "Export" tab of phpMyAdmin, at http://localhost/phpmyadmin/ and move the file to the C:\wamp64\www\wp\wp-content\plugins\my-plugin\tests\_data\dump.sql directory.

                                                                                                                                                                                    -

                                                                                                                                                                                    There is one last step left to complete the setup.

                                                                                                                                                                                    -

                                                                                                                                                                                    Using the tests database in acceptance and functional tests

                                                                                                                                                                                    -

                                                                                                                                                                                    Acceptance and functional tests will act as users, navigating to the site pages and making requests as a user would.

                                                                                                                                                                                    -

                                                                                                                                                                                    This means that WordPress will load, and with it its wp-config.php file, to handle the requests made by the tests.

                                                                                                                                                                                    -

                                                                                                                                                                                    During the setup phase I've specified the database to be used for acceptance and functional tests as tests but, looking at the contents of the C:\wamp64\www\wp\wp-config.php file, the DB_NAME constant is set to wordpress.

                                                                                                                                                                                    -

                                                                                                                                                                                    What we'll do now means:

                                                                                                                                                                                    -
                                                                                                                                                                                      -
                                                                                                                                                                                    • If the request is a normal one, use the wordpress database.
                                                                                                                                                                                    • -
                                                                                                                                                                                    • If the request comes from a test, use the tests database.
                                                                                                                                                                                    • -
                                                                                                                                                                                    -

                                                                                                                                                                                    In your IDE/text-editor of choice edit the C:\wamp64\www\wp\wp-config.php and replace the line defining the DB_NAME constant like this:

                                                                                                                                                                                    -
                                                                                                                                                                                    - define( 'DB_NAME', 'wordpress' );
                                                                                                                                                                                    -+ if( isset( $_SERVER['HTTP_X_WPBROWSER_REQUEST'] ) && $_SERVER['HTTP_X_WPBROWSER_REQUEST'] ) { 
                                                                                                                                                                                    -+    define( 'DB_NAME', 'tests' );
                                                                                                                                                                                    -+ } else {
                                                                                                                                                                                    -+    define( 'DB_NAME', 'wordpress' );
                                                                                                                                                                                    -+ }
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    Here's the copy-and-paste friendly version:

                                                                                                                                                                                    -
                                                                                                                                                                                    if( isset( $_SERVER['HTTP_X_TEST_REQUEST'] ) && $_SERVER['HTTP_X_TEST_REQUEST'] ) {
                                                                                                                                                                                    -        define( 'DB_NAME', 'tests' );
                                                                                                                                                                                    -} else {
                                                                                                                                                                                    -        define( 'DB_NAME', 'wordpress' );
                                                                                                                                                                                    -}
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    If you look at the tests/acceptance.suite.yml and tests/functional.suite.yml files, respectively the acceptance and functional suite configuration files, you will see these entries in the WPBrowser module configuration:

                                                                                                                                                                                    -
                                                                                                                                                                                    headers:
                                                                                                                                                                                    -    X_TEST_REQUEST: 1
                                                                                                                                                                                    -    X_WPBROWSER_REQUEST: 1
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    This means that, with each HTTP request done during tests, the module will send the two headers.
                                                                                                                                                                                    -Those headers are read, on the WordPress side, using the $_SERVER['HTTP_X_TEST_REQUEST'] and $_SERVER['X_WPBROWSER_REQUEST'] variables.

                                                                                                                                                                                    -

                                                                                                                                                                                    Codeception and wp-browser are ready to run and the test-drive development can start.

                                                                                                                                                                                    -

                                                                                                                                                                                    Sanity check

                                                                                                                                                                                    -

                                                                                                                                                                                    Before starting to write tests, take a moment to run each suite separately and make sure all is set up correctly.

                                                                                                                                                                                    -

                                                                                                                                                                                    If you run into issues, there's a chance you forgot something along the way, please take the time to read this tutorial a second time before opening an issue.

                                                                                                                                                                                    -

                                                                                                                                                                                    You have created 4 suites, each suite has at least one example test to make sure all works.
                                                                                                                                                                                    -Run each suite and make sure all tests succeed, from within the box run:

                                                                                                                                                                                    -
                                                                                                                                                                                    cd C:\wamp64\www\wp\wp-content\plugins\my-plugin 
                                                                                                                                                                                    -vendor/bin/codecept run acceptance
                                                                                                                                                                                    -vendor/bin/codecept run functional
                                                                                                                                                                                    -vendor/bin/codecept run wpunit
                                                                                                                                                                                    -vendor/bin/codecept run unit
                                                                                                                                                                                    -
                                                                                                                                                                                    -

                                                                                                                                                                                    You're now run to customize the suites to your liking or start writing tests, run vendor/bin/codecept.bat to see a list of the available commands.

                                                                                                                                                                                    - - - - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - -
                                                                                                                                                                                    - -
                                                                                                                                                                                    - - - -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    -
                                                                                                                                                                                    - - - - - - - - - \ No newline at end of file diff --git a/docs/search/search_index.json b/docs/search/search_index.json new file mode 100644 index 000000000..dcd0f8b13 --- /dev/null +++ b/docs/search/search_index.json @@ -0,0 +1 @@ +{"config":{"lang":["en"],"separator":"[\\s\\-]+","pipeline":["stopWordFilter"],"fields":{"title":{"boost":1000.0},"text":{"boost":1.0},"tags":{"boost":1000000.0}}},"docs":[{"location":"","title":"Getting started","text":"

                                                                                                                                                                                    This is the documentation for version 4 of the project, the current version. Documentation for the previous version of the project, version 3, can be found here.

                                                                                                                                                                                    The wp-browser library provides a set of Codeception modules and middleware to enable the testing of WordPress sites, plugins and themes.

                                                                                                                                                                                    "},{"location":"#installation","title":"Installation","text":"

                                                                                                                                                                                    Add wp-browser to your project as a development dependency using Composer

                                                                                                                                                                                    cd my-wordrpess-project\ncomposer require --dev lucatume/wp-browser\n

                                                                                                                                                                                    Initialize wp-browser to quickly configured to suite your project and setup:

                                                                                                                                                                                    vendor/bin/codecept init wpbrowser\n

                                                                                                                                                                                    The command will set up your project to run integration and end-to-end tests using:

                                                                                                                                                                                    • SQLite as the database engine, leveraging the SQLite Database Integration plugin
                                                                                                                                                                                    • PHP built-in web server to serve the WordPress site on localhost (e.g. http://localhost:8080)
                                                                                                                                                                                    • Chromedriver to drive the local version of Chrome installed on your machine

                                                                                                                                                                                    If you're working on a plugin or theme project, the default configuration will add some extra steps:

                                                                                                                                                                                    • install the latest version of WordPress in the tests/_wordpress directory
                                                                                                                                                                                    • create a tests/_plugins directory: any file or directory in this directory will be symlinked into the WordPress installation in tests/_wordpress/wp-content/plugins
                                                                                                                                                                                    • create a tests/_themes directory: any file or directory in this directory will be symlinked into the WordPress installation in tests/_wordpress/wp-content/themes

                                                                                                                                                                                    For most projects this configuration will be enough to get started with testing.

                                                                                                                                                                                    You can run your tests immediately using the vendor/bin/codecept run command.

                                                                                                                                                                                    Read more about the commands provided by the library here.

                                                                                                                                                                                    "},{"location":"#using-a-custom-configuration","title":"Using a custom configuration","text":"

                                                                                                                                                                                    If you decide to skip the default configuration, you will be able to set up wp-browser to suit your needs and local setup by editing the tests/.env file. The inline documentation in the file will guide you through the configuration process.

                                                                                                                                                                                    Read more about using a custom configuration here.

                                                                                                                                                                                    "},{"location":"#getting-support-for-wp-browser-configuration-and-usage","title":"Getting support for wp-browser configuration and usage","text":"

                                                                                                                                                                                    The best place to get support for wp-browser is the project documentation. Since this project builds on top of PHPUnit and Codeception, you can also refer to their documentation.

                                                                                                                                                                                    If you can't find the answer to your question here you can ask on the \"Issues\" section of the wp-browser repository taking care to provide as much information as possible.

                                                                                                                                                                                    Finally, you can contact me directly to set up a call to discuss your project needs and how wp-browser can help you.

                                                                                                                                                                                    "},{"location":"commands/","title":"Commands","text":""},{"location":"commands/#codeception-commands-provided-by-the-library","title":"Codeception commands provided by the library","text":"

                                                                                                                                                                                    The library provides some custom commands that can be added to the project Codeception configuration file ( either codeception.yml or codeception.dist.yml).

                                                                                                                                                                                    "},{"location":"commands/#run-and-codeceptionrun","title":"run and codeception:run","text":"

                                                                                                                                                                                    WordPress extensive use of global variables, constants and side effectes makes it difficult to run multiple test suites in the same process without running into conflicts due to leaking state and side effects. For this reason the project replaces Codeception run command with one that will run each suite in a separate process. You can invoke the original Codeception command using the codeception:run command. Just like the original, the run command accepts all the arguments and options of the original Codeception command.

                                                                                                                                                                                    Run all the suites, each one in a separate process:

                                                                                                                                                                                    vendor/bin/codecept run\n

                                                                                                                                                                                    Run only the Integration suite:

                                                                                                                                                                                    vendor/bin/codecept run Integration\n

                                                                                                                                                                                    Run a specific test file:

                                                                                                                                                                                    vendor/bin/codecept run Integration tests/Integration/MyTest.php\n

                                                                                                                                                                                    Run a specific test method:

                                                                                                                                                                                    vendor/bin/codecept run Integration tests/Integration/MyTest.php:testMyMethod\n

                                                                                                                                                                                    Read the Codeception documentation for more information about the run command.

                                                                                                                                                                                    "},{"location":"commands/#devstart","title":"dev:start","text":"

                                                                                                                                                                                    If not already running, start the services required to run the tests. The started services are read from the Codeception configuration file (either codeception.yml or codeception.dist.yml), from the extensions section, under the config key.

                                                                                                                                                                                    Given the following configuration:

                                                                                                                                                                                    extensions:\nenabled:\n- lucatume\\WPBrowser\\Extension\\ChromeDriverController\n- lucatume\\WPBrowser\\Extension\\BuiltInServerController\n- lucatume\\WPBrowser\\Extension\\DockerComposeController\nconfig:\nlucatume\\WPBrowser\\Extension\\ChromeDriverController:\nport: '%CHROMEDRIVER_PORT%'\nlucatume\\WPBrowser\\Extension\\BuiltInServerController:\ndocRoot: '%WORDPRESS_ROOT_DIR%'\nworkers: 5\nport: '%BUILT_IN_SERVER_PORT%'\nlucatume\\WPBrowser\\Extension\\DockerComposeController:\ncompose-file: 'tests/docker-compose.yml'\nenv-file: 'tests/.env'\n

                                                                                                                                                                                    Running the command will start ChromeDriver, the built-in PHP server and Docker Compose.

                                                                                                                                                                                    "},{"location":"commands/#devstop","title":"dev:stop","text":"

                                                                                                                                                                                    If running, stop the services required to run the tests. The stopped services are read from the Codeception configuration file (either codeception.yml or codeception.dist.yml), from the extensions section, under the config key.

                                                                                                                                                                                    Given the following configuration:

                                                                                                                                                                                    extensions:\nenabled:\n- lucatume\\WPBrowser\\Extension\\ChromeDriverController\n- lucatume\\WPBrowser\\Extension\\BuiltInServerController\n- lucatume\\WPBrowser\\Extension\\DockerComposeController\nconfig:\nlucatume\\WPBrowser\\Extension\\ChromeDriverController:\nport: '%CHROMEDRIVER_PORT%'\nlucatume\\WPBrowser\\Extension\\BuiltInServerController:\ndocRoot: '%WORDPRESS_ROOT_DIR%'\nworkers: 5\nport: '%BUILT_IN_SERVER_PORT%'\nlucatume\\WPBrowser\\Extension\\DockerComposeController:\ncompose-file: 'tests/docker-compose.yml'\nenv-file: 'tests/.env'\n

                                                                                                                                                                                    Running the command will stop ChromeDriver, the built-in PHP server and Docker Compose.

                                                                                                                                                                                    "},{"location":"commands/#devrestart","title":"dev:restart","text":"

                                                                                                                                                                                    This command is just a shortcut to run dev:stop and dev:start in sequence.

                                                                                                                                                                                    "},{"location":"commands/#devinfo","title":"dev:info","text":"

                                                                                                                                                                                    Provides information about the local testing stack managed by the DockerComposeController, BuiltInServerController and ChromeDriverController extensions.

                                                                                                                                                                                    "},{"location":"commands/#wpdbimport","title":"wp:db:import","text":"

                                                                                                                                                                                    You can use WP CLI to interact with your WordPress installation, but WP CLI does not support SQLite databases in the context of the wp db import command. This command fills that gap by providing a database dump file import command that will support MySQL and SQLite databases.

                                                                                                                                                                                    "},{"location":"commands/#wpdbexport","title":"wp:db:export","text":"

                                                                                                                                                                                    You can use WP CLI to interact with your WordPress installation, but WP CLI does not support SQLite databases in the context of the wp db export command. This command fills that gap by providing a database dump file export command that will support MySQL and SQLite databases.

                                                                                                                                                                                    "},{"location":"commands/#chromedriverupdate","title":"chromedriver:update","text":"

                                                                                                                                                                                    If you're using Chromedriver as a binary installed in the Composer vendor directory (vendor/bin by default), you can use this command to update it. This command will download the latest version of Chromedriver compatible with the Chrome version installed on your machine in the Composer vendor directory.

                                                                                                                                                                                    "},{"location":"commands/#generatewpunit","title":"generate:wpunit","text":"

                                                                                                                                                                                    Generate a test case extending the lucatume\\WPBrowser\\TestCase\\WPTestCase class. The class incorporates the WordPress test case from the wordpress-develop repository and adds some utility methods to make testing easier in the context of Codeception.

                                                                                                                                                                                    The lucatume\\WPBrowser\\TestCase\\WPTestCase class is the one that should be used when writing tests for WordPress code when using the WPLoader module.

                                                                                                                                                                                    Together with the WPLoader module, the WPTestCase class provides a number of functionalities to clean up the database after each test method and to reset the global state of WordPress.

                                                                                                                                                                                    "},{"location":"commands/#every-test-method-runs-in-a-transaction","title":"Every test method runs in a transaction","text":"

                                                                                                                                                                                    Database queries running in the context of test methods of a test case extending the WPTestCase class will run in a transaction that is rolled back after the test method is run. This means that any database change happening in the context of a test method will not appear in the database while the test is running and after the test is run.

                                                                                                                                                                                    "},{"location":"custom-configuration/","title":"Custom configuration","text":""},{"location":"custom-configuration/#custom-testing-configuration","title":"Custom testing configuration","text":"

                                                                                                                                                                                    Any non default configuration is considered a custom configuration. If your project requires a tailored set up, this is the configuration for you.

                                                                                                                                                                                    "},{"location":"custom-configuration/#using-a-custom-configuration-to-run-tests","title":"Using a custom configuration to run tests","text":"

                                                                                                                                                                                    If you decide to skip the default configuration, or are working on a project that cannot use the default configuration you will be able to set up wp-browser to suit your needs using a custom configuration.

                                                                                                                                                                                    Choose \"no\", to not use the default configuration, when running the vendor/bin/codecept init wpbrowser command.

                                                                                                                                                                                    The command will set up the file structure to be able to run integration and end-to-end tests and will leverage Codeception dynamic configuration using parameters to control the testing stack using the tests/.env file.

                                                                                                                                                                                    "},{"location":"custom-configuration/#walkthrough-of-the-testsenv-file","title":"Walkthrough of the tests/.env file","text":"
                                                                                                                                                                                    • WORDPRESS_ROOT_DIR - the path to the root WordPress installation directory. This is the directory that contains WordPress files, like wp-load.php. This path can be absolute or relative to the root project directory; e.g. vendor/wordpress (relative) or /var/www/wordpress (absolute) will work.
                                                                                                                                                                                    • WORDPRESS_URL - the URL of the WordPress installation. This is the URL that will be used by the browser to access the WordPress installation in the context of end-to-end tests; e.g. http://localhost:8080 or https://wordpress.local.
                                                                                                                                                                                    • WORDPRESS_DOMAIN - the domain of the WordPress installation; this value should follow the WORDPRESS_URL value. E.g. if WORDPRESS_URL is http://localhost:8080 the WORDPRESS_DOMAIN value should be localhost:8080; if WORDPRESS_URL is https://wordpress.local the WORDPRESS_DOMAIN value should be wordpress.local.
                                                                                                                                                                                    • WORDPRESS_DB_URL - the user, password, host, and name of the database used by the tests. If the database is a MySQL database, the value should be in the form mysql://user:password@host:port/database_name. If the database is a SQLite database, the value should be in the form sqlite://path/to/database/file.
                                                                                                                                                                                    • WORDPRESS_TABLE_PREFIX - the database table prefix used by the WordPress installation, the one served at WORDPRESS_URL. This value is usually wp_ but can be different if the WordPress installation has been configured to use a different prefix.
                                                                                                                                                                                    • TEST_TABLE_PREFIX - the database table prefix used by the WPLoader module to install WordPress and run the tests. This value is usually test_ and should be different from the WORDPRESS_TABLE_PREFIX value.
                                                                                                                                                                                    • WORDPRESS_ADMIN_USER - the username of the WordPress administrator user. E.g. admin.
                                                                                                                                                                                    • WORDPRESS_ADMIN_PASSWORD - the password of the WordPress administrator user. E.g. secret!password.
                                                                                                                                                                                    • CHROMEDRIVER_HOST - the host of the Chromedriver server. This value is usually localhost if you're running Chromedriver on the same machine as the tests. If you're running your tests using a container stack, it will be the name of the container running Chromedriver, e.g. chromedriver.
                                                                                                                                                                                    • CHROMEDRIVER_PORT - the port of the Chromedriver server. This value is usually 9515 if you're running Chromedriver on the same machine as the tests. If you're running your tests using a container stack, it will be the port exposed by the container running Chromedriver, e.g. 4444. Note the default configuration will set this value to a random port during set up to avoid conflicts with other services running on the same machine.
                                                                                                                                                                                    "},{"location":"custom-configuration/#handling-custom-file-structures","title":"Handling custom file structures","text":"

                                                                                                                                                                                    If your site uses a customized file structure to manage WordPress, you will need to further configure the WPLoader module to correctly look for the site content. Read more about setting up WPLoader to correctly load plugins and themes from custom locations here.

                                                                                                                                                                                    "},{"location":"default-configuration/","title":"Default configuration","text":""},{"location":"default-configuration/#default-testing-configuration","title":"Default testing configuration","text":"

                                                                                                                                                                                    The recommended configuration for most projects. It allows you to get into WordPress integration and end-to-end testing quickly and easily.

                                                                                                                                                                                    "},{"location":"default-configuration/#requirements","title":"Requirements","text":"

                                                                                                                                                                                    The default configuration will set up Codeception and wp-browser to use SQLite as the database engine, PHP built-in server to serve the test site on localhost and your local version of Chrome, driven by Chromedriver, to run end-to-end tests.

                                                                                                                                                                                    As such, the default configuration has the following requirements:

                                                                                                                                                                                    • the sqlite3 PHP extension; you can check if if's installed by running php -m | grep sqlite3 in your terminal
                                                                                                                                                                                    • the pdo_sqlite PHP extension; you can check if if's installed by running php -m | grep pdo_sqlite in your terminal
                                                                                                                                                                                    • PHP built-in server can work with only one thread, but it will be faster using multiple threads; multiple threads are not supported on Windows, but they are supported on WSL.
                                                                                                                                                                                    • the Chrome browser installed on your machine
                                                                                                                                                                                    "},{"location":"default-configuration/#overview-plugin-and-theme-project","title":"Overview - plugin and theme project","text":"

                                                                                                                                                                                    If you're configuring wp-browser for a plugin or theme project, the default configuration will install WordPress in the tests/_wordpress directory and configure the installation to run using SQLite as a database engine. The SQLite Database Integration plugin) will be placed in the installation must-use plugins directory.

                                                                                                                                                                                    If your plugin or theme project requires additional plugins or theme to work, you can place them in the tests/_worpdress/wp-content/plugins and tests/_wordpress/wp-content/themes directories respectively.

                                                                                                                                                                                    When adding, or removing, plugin and themes, remember to update the WPLoader module configuration to load the correct plugins and themes in your integration tests.

                                                                                                                                                                                    On the same note, update the database dump used by the WPDb module to reflect the changes in the dump loaded in the end-to-end tests. The easiest way to update the database fixture is to load the current database dump using the wp:db:import command, manually setting up the site interacting with it and then exporting the database dump using the wp:db:export command.

                                                                                                                                                                                    You can find out about the URL of the site served by the PHP built-in web server by running the dev:info command.

                                                                                                                                                                                    "},{"location":"default-configuration/#overview-site-project","title":"Overview - site project","text":"

                                                                                                                                                                                    If you're configuring wp-browser for a site project, the default configuration will use a combination of PHP built-in web server and the SQLite Database Integration plugin to run the tests and serve your site.

                                                                                                                                                                                    The router file used by the PHP built-in web server will force the site, when served on localhost, to use SQLite as database engine leaving your existing local MySQL database untouched.

                                                                                                                                                                                    Your existing WordPress installation will be picked up as it is, with all the plugins and themes found in the contents directory.

                                                                                                                                                                                    Existing plugins and themes are not added to WPLoader module configuration by wp-browser, you have to do that manually.

                                                                                                                                                                                    Similarly, the database dump used by the WPDb module is, by default, an empty WordPress installation where no plugins and themes are active. You have to update the database dump used by the module to reflect the state of your site. You can do that by loading the current database dump using the wp:db:import command, manually setting up the site interacting with it and then exporting the database dump using the wp:db:export command.

                                                                                                                                                                                    You can find out about the URL of the site served by the PHP built-in web server by running the dev:info command.

                                                                                                                                                                                    "},{"location":"default-configuration/#when-not-to-use-the-default-configuration","title":"When not to use the default configuration","text":"

                                                                                                                                                                                    The default configuration is the recommended one for most projects, but some projects might require you to use a custom configuration to make the most out of wp-browser.

                                                                                                                                                                                    "},{"location":"default-configuration/#database-drop-in","title":"Database drop-in","text":"

                                                                                                                                                                                    The default configuration will use the SQLite Database Integration plugin to use SQLite as the database engine. This requires placing a db.php drop-in file in the WordPress content directory.

                                                                                                                                                                                    If your project already requires a db.php drop-in file, you will have to use a custom configuration.

                                                                                                                                                                                    "},{"location":"default-configuration/#multisite-with-sub-domains","title":"Multisite with sub-domains","text":"

                                                                                                                                                                                    While Chrome will handle sub-domains correctly, even on localhost, WordPress will not. If you're testing a multisite installation with sub-domains, you will have to use a custom configuration.

                                                                                                                                                                                    "},{"location":"default-configuration/#custom-site-structure","title":"Custom site structure","text":"

                                                                                                                                                                                    If your site uses a customized file structure to manage WordPress, you will need to configure wp-browser using a custom configuration. This is usually true for some site projects, and will most likely not be an issue for plugin and theme projects.

                                                                                                                                                                                    Using a custom configuration is not that difficult though: read more about using a custom configuration here.

                                                                                                                                                                                    "},{"location":"extensions/","title":"Extensions","text":""},{"location":"extensions/#codeception-extensions-provided-by-the-library","title":"Codeception Extensions provided by the library","text":"

                                                                                                                                                                                    The library provides some custom Codeception extensions that can be added to the project Codeception configuration file, in the extensions section.

                                                                                                                                                                                    "},{"location":"extensions/#builtinservercontroller","title":"BuiltInServerController","text":"

                                                                                                                                                                                    This extension will start and stop the PHP built-in web server before and after the tests run.

                                                                                                                                                                                    The extension can be configured with the following parameters:

                                                                                                                                                                                    • required
                                                                                                                                                                                      • docRoot - the document root to use for the PHP Built-in server; it can be either an absolute path or a path relative to the Codeception root directory.
                                                                                                                                                                                    • optional
                                                                                                                                                                                      • suites - an array of Codeception suites to run the server for; if not set the server will be started for all the suites.
                                                                                                                                                                                      • port - the port to use for the PHP Built-in server, if not set the server will use port 2389.
                                                                                                                                                                                      • workers - the number of workers to use for the PHP Built-in server, if not set the server will use 5 workers. This is the equivalent of the PHP_CLI_SERVER_WORKERS environment variable.

                                                                                                                                                                                    Note: if you run PHP built-in server on Windows, the workers parameter will be ignored and the server will always run with a single worker. This limit is not present in WSL.

                                                                                                                                                                                    Example configuration starting the server for all suites:

                                                                                                                                                                                    extensions:\nenabled:\n- lucatume\\WPBrowser\\Extension\\BuiltInServerController\nconfig:\nlucatume\\WPBrowser\\Extension\\BuiltInServerController:\ndocRoot: /var/www/html\nworkers: 5\n

                                                                                                                                                                                    The extension can access environment variables defined in the tests configuration file:

                                                                                                                                                                                    extensions:\nenabled:\n- lucatume\\WPBrowser\\Extension\\BuiltInServerController\nconfig:\nlucatume\\WPBrowser\\Extension\\BuiltInServerController:\nsuites:\n- EndToEnd\n- WebApp\ndocRoot: '%WORDPRESS_ROOT_DIR%'\nport: '%BUILT_IN_SERVER_PORT%'\nworkers: '%BUILT_IN_SERVER_WORKERS%'\n

                                                                                                                                                                                    This is a service extension that will be started and stopped by the dev:start and dev:stop commands.

                                                                                                                                                                                    "},{"location":"extensions/#chromedrivercontroller","title":"ChromeDriverController","text":"

                                                                                                                                                                                    This extension will start and stop the ChromeDriver before and after the tests are run.

                                                                                                                                                                                    The extension can be configured with the following parameters:

                                                                                                                                                                                    • optional
                                                                                                                                                                                      • suites - an array of Codeception suites to run the server for; if not set the server will be started for all the suites.
                                                                                                                                                                                      • port - the port to use for the ChromeDriver, if not set the server will use port 9515.
                                                                                                                                                                                      • binary - the path to the ChromeDriver binary, if not set the server will use the chromedriver binary in the Composer bin directory.

                                                                                                                                                                                    Example configuration starting the server for all suites:

                                                                                                                                                                                    extensions:\nenabled:\n- lucatume\\WPBrowser\\Extension\\ChromeDriverController\nconfig:\nlucatume\\WPBrowser\\Extension\\ChromeDriverController:\nport: 4444\nbinary: /usr/local/bin/chromedriver\n

                                                                                                                                                                                    The extension can access environment variables defined in the tests configuration file:

                                                                                                                                                                                    extensions:\nenabled:\n- lucatume\\WPBrowser\\Extension\\ChromeDriverController\nconfig:\nsuites:\n- EndToEnd\n- WebApp\nlucatume\\WPBrowser\\Extension\\ChromeDriverController:\nport: '%CHROMEDRIVER_PORT%'\nbinary: '%CHROMEDRIVER_BINARY%'\n

                                                                                                                                                                                    You can use the chromedriver:update command to download the latest version of ChromeDriver compatible with your Chrome browser version and place it in the Composer bin directory.

                                                                                                                                                                                    This is a service extension that will be started and stopped by the dev:start and dev:stop commands.

                                                                                                                                                                                    "},{"location":"extensions/#dockercomposecontroller","title":"DockerComposeController","text":"

                                                                                                                                                                                    This extension will start and stop a docker compose stack before and after the tests are run.

                                                                                                                                                                                    The extension can be configured with the following parameters:

                                                                                                                                                                                    • required
                                                                                                                                                                                      • compose-file - the path to the docker compose file to use; it can be either an absolute path or a path relative to the Codeception root directory.
                                                                                                                                                                                    • optional
                                                                                                                                                                                      • env-file- the path to the environment file to use; it can be either an absolute path or a path.

                                                                                                                                                                                    Example configuration starting the server for all suites:

                                                                                                                                                                                    extensions:\nenabled:\n- lucatume\\WPBrowser\\Extension\\DockerComposeController\nconfig:\nlucatume\\WPBrowser\\Extension\\DockerComposeController:\ncompose-file: /var/www/html/docker-compose.yml\nenv-file: /var/www/html/.env\n

                                                                                                                                                                                    The extension can access environment variables defined in the tests configuration file:

                                                                                                                                                                                    extensions:\nenabled:\n- lucatume\\WPBrowser\\Extension\\DockerComposeController\nconfig:\nsuites:\n- EndToEnd\n- WebApp\nlucatume\\WPBrowser\\Extension\\DockerComposeController:\ncompose-file: '%DOCKER_COMPOSE_FILE%'\nenv-file: '%DOCKER_COMPOSE_ENV_FILE%'\n

                                                                                                                                                                                    This is a service extension that will be started and stopped by the dev:start and wp:dev-stop commands.

                                                                                                                                                                                    "},{"location":"modules/WPBrowser/","title":"WPBrowser","text":""},{"location":"modules/WPBrowser/#wpbrowser-module","title":"WPBrowser module","text":"

                                                                                                                                                                                    Browse and test the site HTML with a fast browser without Javascript support.

                                                                                                                                                                                    This module trades the WPWebDriver module Javascript support for speed and stability. It is a good choice for testing sites that don't use Javascript or to make assertions that do not require Javascript support like:

                                                                                                                                                                                    • testing HTTP return codes
                                                                                                                                                                                    • testing HTML structure
                                                                                                                                                                                    • testing JSON and XML responses from APIs

                                                                                                                                                                                    This module is used together with the WPDb module and the WPFilesystem module to control the site state, the database, and the site file structure.

                                                                                                                                                                                    This module is an extension of the Codeception PHPBrowser module, you can reference to the Codeception module documentation for more information on the module configuration and usage.

                                                                                                                                                                                    This module should be with Cest and Cept test cases.

                                                                                                                                                                                    "},{"location":"modules/WPBrowser/#configuration","title":"Configuration","text":"
                                                                                                                                                                                    • url - required; the start URL of your WordPress project.
                                                                                                                                                                                    • adminUsername - required; the site administrator username to use in actions like loginAsAdmin.
                                                                                                                                                                                    • adminPassword - required; the site administrator password to use in actions like loginAsAdmin.
                                                                                                                                                                                    • adminPath - the path to the WordPress admin directory; defaults to /wp-admin.

                                                                                                                                                                                    More Guzzle request options are available like:

                                                                                                                                                                                    headers - default headers are set before each test. cookies - default cookies are set before each test. auth - default authentication to be set before each test.

                                                                                                                                                                                    ... and more.

                                                                                                                                                                                    The following is an example of the module configuration to run tests on thehttp://localhost:8080 site:

                                                                                                                                                                                    modules:\nenabled:\nlucatume\\WPBrowser\\Module\\WPBrowser:\nurl: 'http://localhost:8080'\nadminUsername: 'admin'\nadminPassword: 'password'\nadminPath: '/wp-admin'\nheaders:\nX_WPBROWSER_REQUEST: 1\nX_TEST_REQUEST: 1\nX_APM_REQUEST: 1\n

                                                                                                                                                                                    The following configuration uses dynamic configuration parameters to set the module configuration:

                                                                                                                                                                                    modules:\nenabled:\nlucatume\\WPBrowser\\Module\\WPBrowser:\nurl: '%WORDPRESS_URL%'\nadminUsername: '%WORDPRESS_ADMIN_USER%'\nadminPassword: '%WORDPRESS_ADMIN_PASSWORD%'\nadminPath: '/wp-admin'\nheaders:\nX_WPBROWSER_REQUEST: 1\nX_TEST_REQUEST: 1\nX_APM_REQUEST: 1\n
                                                                                                                                                                                    "},{"location":"modules/WPBrowser/#methods","title":"Methods","text":"

                                                                                                                                                                                    The module provides the following methods:

                                                                                                                                                                                    • activatePlugin(array|string $pluginSlug) : void
                                                                                                                                                                                    • amEditingPostWithId(int $id) : void
                                                                                                                                                                                    • amHttpAuthenticated($username, $password) : void
                                                                                                                                                                                    • amOnAdminAjaxPage(array|string|null [$queryVars]) : void
                                                                                                                                                                                    • amOnAdminPage(string $page) : void
                                                                                                                                                                                    • amOnCronPage(array|string|null [$queryVars]) : void
                                                                                                                                                                                    • amOnPage(string $page) : void
                                                                                                                                                                                    • amOnPagesPage() : void
                                                                                                                                                                                    • amOnPluginsPage() : void
                                                                                                                                                                                    • amOnSubdomain($subdomain) : void
                                                                                                                                                                                    • amOnUrl($url) : void
                                                                                                                                                                                    • attachFile($field, string $filename) : void
                                                                                                                                                                                    • checkOption($option) : void
                                                                                                                                                                                    • click($link, [$context]) : void
                                                                                                                                                                                    • deactivatePlugin(array|string $pluginSlug) : void
                                                                                                                                                                                    • deleteHeader(string $name) : void
                                                                                                                                                                                    • dontSee(string $text, [$selector]) : void
                                                                                                                                                                                    • dontSeeCheckboxIsChecked($checkbox) : void
                                                                                                                                                                                    • dontSeeCookie($cookie, [$params]) : void
                                                                                                                                                                                    • dontSeeCurrentUrlEquals(string $uri) : void
                                                                                                                                                                                    • dontSeeCurrentUrlMatches(string $uri) : void
                                                                                                                                                                                    • dontSeeElement($selector, array [$attributes]) : void
                                                                                                                                                                                    • dontSeeInCurrentUrl(string $uri) : void
                                                                                                                                                                                    • dontSeeInField($field, $value) : void
                                                                                                                                                                                    • dontSeeInFormFields($formSelector, array $params) : void
                                                                                                                                                                                    • dontSeeInSource(string $raw) : void
                                                                                                                                                                                    • dontSeeInTitle($title) : void
                                                                                                                                                                                    • dontSeeLink(string $text, string [$url]) : void
                                                                                                                                                                                    • dontSeeOptionIsSelected($selector, $optionText) : void
                                                                                                                                                                                    • dontSeePluginInstalled(string $pluginSlug) : void
                                                                                                                                                                                    • dontSeeResponseCodeIs(int $code) : void
                                                                                                                                                                                    • executeInGuzzle(Closure $function) : void
                                                                                                                                                                                    • fillField($field, $value) : void
                                                                                                                                                                                    • followRedirect() : void
                                                                                                                                                                                    • grabAttributeFrom($cssOrXpath, string $attribute) : mixed
                                                                                                                                                                                    • grabCookie(string $cookie, array [$params]) : mixed
                                                                                                                                                                                    • grabCookiesWithPattern(string $cookiePattern) : ?array
                                                                                                                                                                                    • grabFromCurrentUrl(?string [$uri]) : mixed
                                                                                                                                                                                    • grabMultiple($cssOrXpath, ?string [$attribute]) : array
                                                                                                                                                                                    • grabPageSource() : string
                                                                                                                                                                                    • grabTextFrom($cssOrXPathOrRegex) : mixed
                                                                                                                                                                                    • grabValueFrom($field) : mixed
                                                                                                                                                                                    • grabWordPressTestCookie(?string [$name]) : ?Symfony\\Component\\BrowserKit\\Cookie
                                                                                                                                                                                    • haveHttpHeader(string $name, string $value) : void
                                                                                                                                                                                    • haveServerParameter(string $name, string $value) : void
                                                                                                                                                                                    • logOut(string|bool [$redirectTo]) : void
                                                                                                                                                                                    • loginAs(string $username, string $password) : void
                                                                                                                                                                                    • loginAsAdmin() : void
                                                                                                                                                                                    • makeHtmlSnapshot(?string [$name]) : void
                                                                                                                                                                                    • moveBack(int [$numberOfSteps]) : void
                                                                                                                                                                                    • resetCookie($cookie, [$params]) : void
                                                                                                                                                                                    • see(string $text, [$selector]) : void
                                                                                                                                                                                    • seeCheckboxIsChecked($checkbox) : void
                                                                                                                                                                                    • seeCookie($cookie, [$params]) : void
                                                                                                                                                                                    • seeCurrentUrlEquals(string $uri) : void
                                                                                                                                                                                    • seeCurrentUrlMatches(string $uri) : void
                                                                                                                                                                                    • seeElement($selector, array [$attributes]) : void
                                                                                                                                                                                    • seeErrorMessage(array|string [$classes]) : void
                                                                                                                                                                                    • seeInCurrentUrl(string $uri) : void
                                                                                                                                                                                    • seeInField($field, $value) : void
                                                                                                                                                                                    • seeInFormFields($formSelector, array $params) : void
                                                                                                                                                                                    • seeInSource(string $raw) : void
                                                                                                                                                                                    • seeInTitle($title) : void
                                                                                                                                                                                    • seeLink(string $text, ?string [$url]) : void
                                                                                                                                                                                    • seeMessage(array|string [$classes]) : void
                                                                                                                                                                                    • seeNumberOfElements($selector, $expected) : void
                                                                                                                                                                                    • seeOptionIsSelected($selector, $optionText) : void
                                                                                                                                                                                    • seePageNotFound() : void
                                                                                                                                                                                    • seePluginActivated(string $pluginSlug) : void
                                                                                                                                                                                    • seePluginDeactivated(string $pluginSlug) : void
                                                                                                                                                                                    • seePluginInstalled(string $pluginSlug) : void
                                                                                                                                                                                    • seeResponseCodeIs(int $code) : void
                                                                                                                                                                                    • seeResponseCodeIsBetween(int $from, int $to) : void
                                                                                                                                                                                    • seeResponseCodeIsClientError() : void
                                                                                                                                                                                    • seeResponseCodeIsRedirection() : void
                                                                                                                                                                                    • seeResponseCodeIsServerError() : void
                                                                                                                                                                                    • seeResponseCodeIsSuccessful() : void
                                                                                                                                                                                    • seeWpDiePage() : void
                                                                                                                                                                                    • selectOption($select, $option) : void
                                                                                                                                                                                    • sendAjaxGetRequest(string $uri, array [$params]) : void
                                                                                                                                                                                    • sendAjaxPostRequest(string $uri, array [$params]) : void
                                                                                                                                                                                    • sendAjaxRequest(string $method, string $uri, array [$params]) : void
                                                                                                                                                                                    • setCookie($name, $val, [$params]) : void
                                                                                                                                                                                    • setHeader(string $name, string $value) : void
                                                                                                                                                                                    • setMaxRedirects(int $maxRedirects) : void
                                                                                                                                                                                    • setServerParameters(array $params) : void
                                                                                                                                                                                    • startFollowingRedirects() : void
                                                                                                                                                                                    • stopFollowingRedirects() : void
                                                                                                                                                                                    • submitForm($selector, array $params, ?string [$button]) : void
                                                                                                                                                                                    • switchToIframe(string $name) : void
                                                                                                                                                                                    • uncheckOption($option) : void

                                                                                                                                                                                    Read more in Codeception documentation.

                                                                                                                                                                                    "},{"location":"modules/WPCLI/","title":"WPCLI","text":""},{"location":"modules/WPCLI/#wpcli-module","title":"WPCLI module","text":"

                                                                                                                                                                                    Use WP-CLI to interact with the WordPress installation under test and issue commands.

                                                                                                                                                                                    This module is used in the context of end-to-end testing, together with, or as a replacement for the WPDb module to manipulate the database and the WPFilesystem module to manipulate the site file structure.

                                                                                                                                                                                    This module should be with Cest and Cept test cases.

                                                                                                                                                                                    "},{"location":"modules/WPCLI/#configuration","title":"Configuration","text":"
                                                                                                                                                                                    • path - required; the path to the WordPress installation under test. This can be a relative path to the codeception root directory, or an absolute path to the WordPress installation directory. The WordPress installation directory is the directory that contains the wp-load.php file.
                                                                                                                                                                                    • url - the URL of the WordPress installation under test. Equivalent to the --url option of the wp command.
                                                                                                                                                                                    • user - the user to use to run the wp command. Equivalent to the --user option of the wp command.
                                                                                                                                                                                    • skip-plugins - a boolean value to indicate if the wp command should skip loading plugins. Equivalent to the --skip-plugins option of the wp command.
                                                                                                                                                                                    • skip-themes - a boolean value to indicate if the wp command should skip loading themes. Equivalent to the --skip-themes option of the wp command.
                                                                                                                                                                                    • skip-packages - a boolean value to indicate if the wp command should skip loading packages. Equivalent to the --skip-packages option of the wp command.
                                                                                                                                                                                    • require - a list of PHP files to require before running the wp command. Equivalent to the --require option of the wp command.
                                                                                                                                                                                    • exec - PHP code to execute before running the wp command. Equivalent to the --exec option of the wp command.
                                                                                                                                                                                    • context - the context to use when running the wp command. Equivalent to the --context option of the wp command.
                                                                                                                                                                                    • color - a boolean value to indicate if the wp command should output in color. Equivalent to the --color option of the wp command.
                                                                                                                                                                                    • no-color - a boolean value to indicate if the wp command should not output in color. Equivalent to the --no-color option of the wp command.
                                                                                                                                                                                    • debug - a boolean value to indicate if the wp command should output debug information. Equivalent to the --debug option of the wp command.
                                                                                                                                                                                    • quiet - a boolean value to indicate if the wp command should suppress informational messages. Equivalent to the --quiet option of the wp command.
                                                                                                                                                                                    • throw - a boolean value to indicate if the wp command should throw an exception if the command fails.
                                                                                                                                                                                    • timeout - the timeout to use when running the wp command. When the timeout is reached the command will be terminated as a failure.
                                                                                                                                                                                    • cache-dir - the directory to use to cache the files WPCLI might downloads. Equivalent to setting the WP_CLI_CACHE_DIR environment variable.
                                                                                                                                                                                    • config-path - the path to the wp-cli.yml file to use. Equivalent to setting the WP_CLI_CONFIG_PATH environment variable.
                                                                                                                                                                                    • custom-shell - the shell to use to run the wp command. Equivalent to setting the WP_CLI_SHELL environment variable.
                                                                                                                                                                                    • packages-dir - the directory to use to store the packages downloaded by the wp package command. Equivalent to setting the WP_CLI_PACKAGES_DIR environment variable.

                                                                                                                                                                                    The following is an example of the module configuration to run WPCLI commands on the /var/wordpress directory:

                                                                                                                                                                                    modules:\nenabled:\nlucatume\\WPBrowser\\Module\\WPCLI:\npath: /var/wordpress\nthrow: true\n

                                                                                                                                                                                    The following configuration uses dynamic configuration parameters to set the module configuration:

                                                                                                                                                                                    modules:\nenabled:\nlucatume\\WPBrowser\\Module\\WPCLI:\npath: '%WP_ROOT_DIR%'\nthrow: true\n
                                                                                                                                                                                    "},{"location":"modules/WPCLI/#methods","title":"Methods","text":"

                                                                                                                                                                                    The module provides the following methods:

                                                                                                                                                                                    • cli(array|string [$command], ?array [$env], mixed [$input]) : int
                                                                                                                                                                                    • cliToArray(array $command, ?callable [$splitCallback], ?array [$env], mixed [$input]) : array
                                                                                                                                                                                    • cliToString(array $command, ?array [$env], mixed [$input]) : string
                                                                                                                                                                                    • dontSeeInShellOutput(string $text) : void
                                                                                                                                                                                    • dontSeeShellOutputMatches(string $regex) : void
                                                                                                                                                                                    • grabLastCliProcess() : lucatume\\WPBrowser\\WordPress\\CliProcess
                                                                                                                                                                                    • grabLastShellErrorOutput() : string
                                                                                                                                                                                    • grabLastShellOutput() : string
                                                                                                                                                                                    • seeInShellOutput(string $text) : void
                                                                                                                                                                                    • seeResultCodeIs(int $code) : void
                                                                                                                                                                                    • seeResultCodeIsNot(int $code) : void
                                                                                                                                                                                    • seeShellOutputMatches(string $regex) : void

                                                                                                                                                                                    Explore the WP-CLI documentation for more information on the available commands.

                                                                                                                                                                                    "},{"location":"modules/WPDb/","title":"WPDb","text":""},{"location":"modules/WPDb/#wpdb-module","title":"WPDb module","text":"

                                                                                                                                                                                    This module allows to manipulate the database of the WordPress installation under test directly, without using the WordPress API.

                                                                                                                                                                                    The module is used together with the WPBrowser module, WPWebDriver and WPFilesystem modules to control the site state, the database, and the site file structure.

                                                                                                                                                                                    Note about interaction with the WPLoader module: both this module and the WPLoader one can be used to control the state of the database before tests and set up fixtures: use either this or WPLoader, do not use both. This module should be used in end-to-end testing, the WPLoader module should be used in integration testing. If you're using this module to load a database dump before integration tests, use the WPLoader module dump configuration parameter instead.

                                                                                                                                                                                    This module should be with Cest and Cept test cases.

                                                                                                                                                                                    "},{"location":"modules/WPDb/#configuration","title":"Configuration","text":"

                                                                                                                                                                                    This module extends the Codeception Db module adding some configuration options and functions that are specific to WordPress.

                                                                                                                                                                                    • dbUrl - required; the URL to use to connect to the database. The URL must be in the form mysql://user:password@host:port/database if you're using a MySQL database for your tests, or in the form sqlite://path/to/database/file if you're using a SQLite database for your tests ( like the default configuration does)
                                                                                                                                                                                    • dsn - required; the DSN to use to connect to the database; required if not using the dbUrl parameter.
                                                                                                                                                                                    • user - required; the user to use to connect to the database; required if not using the dbUrl parameter.
                                                                                                                                                                                    • password - required; the password to use to connect to the database; required if not using the dbUrl parameter.
                                                                                                                                                                                    • url - required;the URL of the WordPress installation under test. E.g. http://localhost:8080 or https://wordpress.test.
                                                                                                                                                                                    • tablePrefix - the table prefix to use when interacting with the database; defaults to wp_.
                                                                                                                                                                                    • dump - the path to a database dump file, or a set of database files, to load before running tests. The path can be relative to the project root directory, e.g. tests/_data/dump.sql, or absolute.
                                                                                                                                                                                    • populate - a boolean value to indicate if the database should be populated importing the dump file(s) at the start of the suite.
                                                                                                                                                                                    • cleanup - a boolean value to indicate if the database should be populated importing the dump file(s) before each test.
                                                                                                                                                                                    • reconnect - a boolean value to indicate if the database connection should be re-established before each test.
                                                                                                                                                                                    • populator - a command to use to populate the database instead of using PHP; read more on the Codeception documentation.
                                                                                                                                                                                    • urlReplacement - a boolean value to indicate if the database dump file(s) should be searched for the siteurl and home options and replaced with the url parameter value. This is required since WordPress hard-codes URLs in the database, the original URL is inferred, if the originalUrl parameter is not provided.
                                                                                                                                                                                    • originalUrl - if provided together with the urlReplacement parameter, the module will not try to infer the original URL from the database dump file(s) but use the provided value instead.
                                                                                                                                                                                    • waitlock - the number of seconds to wait for a database lock to be released before failing the test. Defaults to 10 meaning that the test will fail if the database lock is not released after 10 seconds.
                                                                                                                                                                                    • createIfNotExists - a boolean value to indicate if the database should be created if it does not exist. Defaults to false.

                                                                                                                                                                                    The following is an example of the module configuration to run tests on thehttp://localhost:8080 site:

                                                                                                                                                                                    modules:\nenabled:\n- lucatume\\WPBrowser\\Module\\WPDb:\ndbUrl: 'mysql://root:password@localhost:3306/wordpress'\nurl: 'http://localhost:8080'\ntablePrefix: 'wp_'\ndump: 'tests/_data/dump.sql'\npopulate: true\ncleanup: true\nreconnect: false\nurlReplacement: true\noriginalUrl: http://wordpress.test\nwaitlock: 10\ncreateIfNotExists: true\n

                                                                                                                                                                                    The following configuration uses dynamic configuration parameters to set the module configuration:

                                                                                                                                                                                    modules:\nenabled:\n- lucatume\\WPBrowser\\Module\\WPDb:\ndbUrl: '%DB_URL%'\nurl: '%WORDPRESS_URL%'\ntablePrefix: '%WORDPRESS_TABLE_PREFIX%'\ndump: '%DB_DUMP%'\npopulate: true\ncleanup: true\nreconnect: false\nurlReplacement: true\noriginalUrl: '%WORDPRESS_ORIGINAL_URL%'\nwaitlock: 10\ncreateIfNotExists: true\n

                                                                                                                                                                                    The following configuration uses a SQLite database:

                                                                                                                                                                                    modules:\nenabled:\n- lucatume\\WPBrowser\\Module\\WPDb:\ndbUrl: 'sqlite://tests/database.sqlite'\nurl: 'http://localhost:8080'\ntablePrefix: 'wp_'\ndump: 'tests/_data/dump.sql'\npopulate: true\ncleanup: true\nreconnect: false\nurlReplacement: true\noriginalUrl: http://wordpress.test\nwaitlock: 10\ncreateIfNotExists: true\n
                                                                                                                                                                                    "},{"location":"modules/WPDb/#methods","title":"Methods","text":"

                                                                                                                                                                                    The module provides the following methods:

                                                                                                                                                                                    • amConnectedToDatabase(string $databaseKey) : void
                                                                                                                                                                                    • countRowsInDatabase(string $table, array [$criteria]) : int
                                                                                                                                                                                    • dontHaveAttachmentFilesInDatabase(array|int $attachmentIds) : void
                                                                                                                                                                                    • dontHaveAttachmentInDatabase(array $criteria, bool [$purgeMeta], bool [$removeFiles]) : void
                                                                                                                                                                                    • dontHaveBlogInDatabase(array $criteria, bool [$removeTables], bool [$removeUploads]) : void
                                                                                                                                                                                    • dontHaveCommentInDatabase(array $criteria, bool [$purgeMeta]) : void
                                                                                                                                                                                    • dontHaveCommentMetaInDatabase(array $criteria) : void
                                                                                                                                                                                    • dontHaveInDatabase(string $table, array $criteria) : void
                                                                                                                                                                                    • dontHaveLinkInDatabase(array $criteria) : void
                                                                                                                                                                                    • dontHaveOptionInDatabase(string $key, mixed [$value]) : void
                                                                                                                                                                                    • dontHavePostInDatabase(array $criteria, bool [$purgeMeta]) : void
                                                                                                                                                                                    • dontHavePostMetaInDatabase(array $criteria) : void
                                                                                                                                                                                    • dontHavePostThumbnailInDatabase(int $postId) : void
                                                                                                                                                                                    • dontHaveSiteOptionInDatabase(string $key, mixed [$value]) : void
                                                                                                                                                                                    • dontHaveSiteTransientInDatabase(string $key) : void
                                                                                                                                                                                    • dontHaveTableInDatabase(string $fullTableName) : void
                                                                                                                                                                                    • dontHaveTermInDatabase(array $criteria, bool [$purgeMeta]) : void
                                                                                                                                                                                    • dontHaveTermMetaInDatabase(array $criteria) : void
                                                                                                                                                                                    • dontHaveTermRelationshipInDatabase(array $criteria) : void
                                                                                                                                                                                    • dontHaveTermTaxonomyInDatabase(array $criteria) : void
                                                                                                                                                                                    • dontHaveTransientInDatabase(string $transient) : void
                                                                                                                                                                                    • dontHaveUserInDatabase(string|int $userIdOrLogin, bool [$purgeMeta]) : void
                                                                                                                                                                                    • dontHaveUserInDatabaseWithEmail(string $userEmail, bool [$purgeMeta]) : array
                                                                                                                                                                                    • dontHaveUserMetaInDatabase(array $criteria) : void
                                                                                                                                                                                    • dontSeeAttachmentInDatabase(array $criteria) : void
                                                                                                                                                                                    • dontSeeBlogInDatabase(array $criteria) : void
                                                                                                                                                                                    • dontSeeCommentInDatabase(array $criteria) : void
                                                                                                                                                                                    • dontSeeCommentMetaInDatabase(array $criteria) : void
                                                                                                                                                                                    • dontSeeInDatabase(string $table, array [$criteria]) : void
                                                                                                                                                                                    • dontSeeLinkInDatabase(array $criteria) : void
                                                                                                                                                                                    • dontSeeOptionInDatabase(array|string $criteriaOrName, mixed [$value]) : void
                                                                                                                                                                                    • dontSeePageInDatabase(array $criteria) : void
                                                                                                                                                                                    • dontSeePostInDatabase(array $criteria) : void
                                                                                                                                                                                    • dontSeePostMetaInDatabase(array $criteria) : void
                                                                                                                                                                                    • dontSeePostWithTermInDatabase(int $post_id, int $term_taxonomy_id, ?int [$term_order], ?string [$taxonomy]) : void
                                                                                                                                                                                    • dontSeeSiteOptionInDatabase(array|string $criteriaOrName, mixed [$value]) : void
                                                                                                                                                                                    • dontSeeTableInDatabase(string $table) : void
                                                                                                                                                                                    • dontSeeTermInDatabase(array $criteria) : void
                                                                                                                                                                                    • dontSeeTermMetaInDatabase(array $criteria) : void
                                                                                                                                                                                    • dontSeeTermTaxonomyInDatabase(array $criteria) : void
                                                                                                                                                                                    • dontSeeUserInDatabase(array $criteria) : void
                                                                                                                                                                                    • dontSeeUserMetaInDatabase(array $criteria) : void
                                                                                                                                                                                    • getSiteDomain() : string
                                                                                                                                                                                    • getUsersTableName() : string
                                                                                                                                                                                    • grabAllFromDatabase(string $table, string $column, array $criteria) : array
                                                                                                                                                                                    • grabAttachmentAttachedFile(int $attachmentPostId) : string
                                                                                                                                                                                    • grabAttachmentMetadata(int $attachmentPostId) : array
                                                                                                                                                                                    • grabBlogDomain(int $blogId) : string
                                                                                                                                                                                    • grabBlogPath(int $blogId) : string
                                                                                                                                                                                    • grabBlogTableName(int $blogId, string $table) : string
                                                                                                                                                                                    • grabBlogTableNames(int $blogId) : array
                                                                                                                                                                                    • grabBlogTablePrefix(int $blogId) : string
                                                                                                                                                                                    • grabBlogVersionsTableName() : string
                                                                                                                                                                                    • grabBlogsTableName() : string
                                                                                                                                                                                    • grabColumnFromDatabase(string $table, string $column, array [$criteria]) : array
                                                                                                                                                                                    • grabCommentmetaTableName() : string
                                                                                                                                                                                    • grabCommentsTableName() : string
                                                                                                                                                                                    • grabEntriesFromDatabase(string $table, array [$criteria]) : array
                                                                                                                                                                                    • grabEntryFromDatabase(string $table, array [$criteria]) : array
                                                                                                                                                                                    • grabFromDatabase(string $table, string $column, array [$criteria]) : void
                                                                                                                                                                                    • grabLatestEntryByFromDatabase(string $tableName, string [$idColumn]) : int
                                                                                                                                                                                    • grabLinksTableName() : string
                                                                                                                                                                                    • grabNumRecords(string $table, array [$criteria]) : int
                                                                                                                                                                                    • grabOptionFromDatabase(string $option_name) : mixed
                                                                                                                                                                                    • grabPostFieldFromDatabase(int $postId, string $field) : mixed
                                                                                                                                                                                    • grabPostMetaFromDatabase(int $postId, string $metaKey, bool [$single]) : mixed
                                                                                                                                                                                    • grabPostmetaTableName() : string
                                                                                                                                                                                    • grabPostsTableName() : string
                                                                                                                                                                                    • grabPrefixedTableNameFor(string [$tableName]) : string
                                                                                                                                                                                    • grabRegistrationLogTableName() : string
                                                                                                                                                                                    • grabSignupsTableName() : string
                                                                                                                                                                                    • grabSiteMetaFromDatabase(int $blogId, string $key, bool $single) : mixed
                                                                                                                                                                                    • grabSiteMetaTableName() : string
                                                                                                                                                                                    • grabSiteOptionFromDatabase(string $key) : mixed
                                                                                                                                                                                    • grabSiteTableName() : string
                                                                                                                                                                                    • grabSiteTransientFromDatabase(string $key) : mixed
                                                                                                                                                                                    • grabSiteUrl(?string [$path]) : string
                                                                                                                                                                                    • grabTablePrefix() : string
                                                                                                                                                                                    • grabTermIdFromDatabase(array $criteria) : int|false
                                                                                                                                                                                    • grabTermMetaTableName() : string
                                                                                                                                                                                    • grabTermRelationshipsTableName() : string
                                                                                                                                                                                    • grabTermTaxonomyIdFromDatabase(array $criteria) : int|false
                                                                                                                                                                                    • grabTermTaxonomyTableName() : string
                                                                                                                                                                                    • grabTermsTableName() : string
                                                                                                                                                                                    • grabUserIdFromDatabase(string $userLogin) : int|false
                                                                                                                                                                                    • grabUserMetaFromDatabase(int $userId, string $meta_key, bool [$single]) : mixed
                                                                                                                                                                                    • grabUsermetaTableName() : string
                                                                                                                                                                                    • grabUsersTableName() : string
                                                                                                                                                                                    • haveAttachmentInDatabase(string $file, string|int [$date], array [$overrides], ?array [$imageSizes]) : int
                                                                                                                                                                                    • haveBlogInDatabase(string $domainOrPath, array [$overrides], bool [$subdomain]) : int
                                                                                                                                                                                    • haveCommentInDatabase(int $comment_post_ID, array [$data]) : int
                                                                                                                                                                                    • haveCommentMetaInDatabase(int $comment_id, string $meta_key, mixed $meta_value) : int
                                                                                                                                                                                    • haveInDatabase(string $table, array $data) : int
                                                                                                                                                                                    • haveLinkInDatabase(array [$overrides]) : int
                                                                                                                                                                                    • haveManyBlogsInDatabase(int $count, array [$overrides], bool [$subdomain]) : array
                                                                                                                                                                                    • haveManyCommentsInDatabase(int $count, int $comment_post_ID, array [$overrides]) : array
                                                                                                                                                                                    • haveManyLinksInDatabase(int $count, array [$overrides]) : array
                                                                                                                                                                                    • haveManyPostsInDatabase(int $count, array [$overrides]) : array
                                                                                                                                                                                    • haveManyTermsInDatabase(int $count, string $name, string $taxonomy, array [$overrides]) : array
                                                                                                                                                                                    • haveManyUsersInDatabase(int $count, string $user_login, string [$role], array [$overrides]) : array
                                                                                                                                                                                    • haveMenuInDatabase(string $slug, string $location, array [$overrides]) : array
                                                                                                                                                                                    • haveMenuItemInDatabase(string $menuSlug, string $title, ?int [$menuOrder], array [$meta]) : int
                                                                                                                                                                                    • haveOptionInDatabase(string $option_name, mixed $option_value, string [$autoload]) : int
                                                                                                                                                                                    • havePageInDatabase(array [$overrides]) : int
                                                                                                                                                                                    • havePostInDatabase(array [$data]) : int
                                                                                                                                                                                    • havePostThumbnailInDatabase(int $postId, int $thumbnailId) : int
                                                                                                                                                                                    • havePostmetaInDatabase(int $postId, string $meta_key, mixed $meta_value) : int
                                                                                                                                                                                    • haveSiteMetaInDatabase(int $blogId, string $string, mixed $value) : int
                                                                                                                                                                                    • haveSiteOptionInDatabase(string $key, mixed $value) : int
                                                                                                                                                                                    • haveSiteTransientInDatabase(string $key, mixed $value) : int
                                                                                                                                                                                    • haveTermInDatabase(string $name, string $taxonomy, array [$overrides]) : array
                                                                                                                                                                                    • haveTermMetaInDatabase(int $term_id, string $meta_key, mixed $meta_value) : int
                                                                                                                                                                                    • haveTermRelationshipInDatabase(int $object_id, int $term_taxonomy_id, int [$term_order]) : void
                                                                                                                                                                                    • haveTransientInDatabase(string $transient, mixed $value) : int
                                                                                                                                                                                    • haveUserCapabilitiesInDatabase(int $userId, array|string $role) : array
                                                                                                                                                                                    • haveUserInDatabase(string $user_login, array|string [$role], array [$overrides]) : int
                                                                                                                                                                                    • haveUserLevelsInDatabase(int $userId, array|string $role) : array
                                                                                                                                                                                    • haveUserMetaInDatabase(int $userId, string $meta_key, mixed $meta_value) : array
                                                                                                                                                                                    • importSql(array $sql) : void
                                                                                                                                                                                    • importSqlDumpFile(?string [$dumpFile]) : void
                                                                                                                                                                                    • performInDatabase($databaseKey, $actions) : void
                                                                                                                                                                                    • seeAttachmentInDatabase(array $criteria) : void
                                                                                                                                                                                    • seeBlogInDatabase(array $criteria) : void
                                                                                                                                                                                    • seeCommentInDatabase(array $criteria) : void
                                                                                                                                                                                    • seeCommentMetaInDatabase(array $criteria) : void
                                                                                                                                                                                    • seeInDatabase(string $table, array [$criteria]) : void
                                                                                                                                                                                    • seeLinkInDatabase(array $criteria) : void
                                                                                                                                                                                    • seeNumRecords(int $expectedNumber, string $table, array [$criteria]) : void
                                                                                                                                                                                    • seeOptionInDatabase(array|string $criteriaOrName, mixed [$value]) : void
                                                                                                                                                                                    • seePageInDatabase(array $criteria) : void
                                                                                                                                                                                    • seePostInDatabase(array $criteria) : void
                                                                                                                                                                                    • seePostMetaInDatabase(array $criteria) : void
                                                                                                                                                                                    • seePostWithTermInDatabase(int $post_id, int $term_taxonomy_id, ?int [$term_order], ?string [$taxonomy]) : void
                                                                                                                                                                                    • seeSiteOptionInDatabase(array|string $criteriaOrName, mixed [$value]) : void
                                                                                                                                                                                    • seeSiteSiteTransientInDatabase(string $key, mixed [$value]) : void
                                                                                                                                                                                    • seeTableInDatabase(string $table) : void
                                                                                                                                                                                    • seeTermInDatabase(array $criteria) : void
                                                                                                                                                                                    • seeTermMetaInDatabase(array $criteria) : void
                                                                                                                                                                                    • seeTermRelationshipInDatabase(array $criteria) : void
                                                                                                                                                                                    • seeTermTaxonomyInDatabase(array $criteria) : void
                                                                                                                                                                                    • seeUserInDatabase(array $criteria) : void
                                                                                                                                                                                    • seeUserMetaInDatabase(array $criteria) : void
                                                                                                                                                                                    • updateInDatabase(string $table, array $data, array [$criteria]) : void
                                                                                                                                                                                    • useBlog(int [$blogId]) : void
                                                                                                                                                                                    • useMainBlog() : void
                                                                                                                                                                                    • useTheme(string $stylesheet, ?string [$template], ?string [$themeName]) : void

                                                                                                                                                                                    Read more in Codeception documentation for the Db module.

                                                                                                                                                                                    "},{"location":"modules/WPFilesystem/","title":"WPFilesystem","text":""},{"location":"modules/WPFilesystem/#wpfilesystem-module","title":"WPFilesystem module","text":"

                                                                                                                                                                                    Interact and make assertions on the WordPress file structure.

                                                                                                                                                                                    This module is used together with the WPDb module to manage the state of the WordPress installation in the context of end-to-end tests.

                                                                                                                                                                                    This module extends the Filesystem module from Codeception, you can reference to the Codeception documentation to find out more about the module configuration and usage.

                                                                                                                                                                                    This module should be with Cest and Cept test cases.

                                                                                                                                                                                    "},{"location":"modules/WPFilesystem/#configuration","title":"Configuration","text":"

                                                                                                                                                                                    wpRootFolder - required; the path to the WordPress installation root folder. This can be a relative path to the codeception root directory, or an absolute path to the WordPress installation directory. The WordPress installation directory is the directory that contains the wp-load.php file. themes - the path, relative to the path specified in the wpRootFolder parameter, to the themes directory. By default, it's /wp-content/themes. plugins - the path, relative to the path specified in the wpRootFolder parameter, to the plugins directory. By default, it's /wp-content/plugins. mu-plugins - the path, relative to the path specified in the wpRootFolder parameter, to the must-use plugins. By default, it's /wp-content/mu-plugins. directory. uploads - the path, relative to the path specified in the wpRootFolder parameter, to the uploads directory. By default, it's /wp-content/uploads.

                                                                                                                                                                                    The following is an example of the module configuration to run tests on the /var/wordpress site:

                                                                                                                                                                                    modules:\nenabled:\nlucatume\\WPBrowser\\Module\\WPFilesystem:\nwpRootFolder: /var/wordpress\nthemes: wp-content/themes\nplugins: wp-content/plugins\nmu-plugins: wp-content/mu-plugins\nuploads: wp-content/uploads\n

                                                                                                                                                                                    The following configuration uses dynamic configuration parameters to set the module configuration:

                                                                                                                                                                                    modules:\nenabled:\nlucatume\\WPBrowser\\Module\\WPFilesystem:\nwpRootFolder: '%WP_ROOT_FOLDER%'\n
                                                                                                                                                                                    "},{"location":"modules/WPFilesystem/#methods","title":"Methods","text":"

                                                                                                                                                                                    The module provides the following methods:

                                                                                                                                                                                    • amInMuPluginPath(string $path) : void
                                                                                                                                                                                    • amInPath(string $path) : void
                                                                                                                                                                                    • amInPluginPath(string $path) : void
                                                                                                                                                                                    • amInThemePath(string $path) : void
                                                                                                                                                                                    • amInUploadsPath(?string [$path]) : void
                                                                                                                                                                                    • assertDirectoryExists(string $directory, string [$message]) : void
                                                                                                                                                                                    • cleanDir(string $dirname) : void
                                                                                                                                                                                    • cleanMuPluginDir(string $dir) : void
                                                                                                                                                                                    • cleanPluginDir(string $dir) : void
                                                                                                                                                                                    • cleanThemeDir(string $dir) : void
                                                                                                                                                                                    • cleanUploadsDir(?string [$dir], DateTime|string|int|null [$date]) : void
                                                                                                                                                                                    • copyDir(string $src, string $dst) : void
                                                                                                                                                                                    • copyDirToMuPlugin(string $src, string $pluginDst) : void
                                                                                                                                                                                    • copyDirToPlugin(string $src, string $pluginDst) : void
                                                                                                                                                                                    • copyDirToTheme(string $src, string $themeDst) : void
                                                                                                                                                                                    • copyDirToUploads(string $src, string $dst, DateTime|string|int|null [$date]) : void
                                                                                                                                                                                    • deleteDir(string $dirname) : void
                                                                                                                                                                                    • deleteFile(string $filename) : void
                                                                                                                                                                                    • deleteMuPluginFile(string $file) : void
                                                                                                                                                                                    • deletePluginFile(string $file) : void
                                                                                                                                                                                    • deleteThemeFile(string $file) : void
                                                                                                                                                                                    • deleteThisFile() : void
                                                                                                                                                                                    • deleteUploadedDir(string $dir, DateTime|string|int|null [$date]) : void
                                                                                                                                                                                    • deleteUploadedFile(string $file, string|int|null [$date]) : void
                                                                                                                                                                                    • dontSeeFileFound(string $filename, string [$path]) : void
                                                                                                                                                                                    • dontSeeInMuPluginFile(string $file, string $contents) : void
                                                                                                                                                                                    • dontSeeInPluginFile(string $file, string $contents) : void
                                                                                                                                                                                    • dontSeeInThemeFile(string $file, string $contents) : void
                                                                                                                                                                                    • dontSeeInThisFile(string $text) : void
                                                                                                                                                                                    • dontSeeInUploadedFile(string $file, string $contents, string|int|null [$date]) : void
                                                                                                                                                                                    • dontSeeMuPluginFileFound(string $file) : void
                                                                                                                                                                                    • dontSeePluginFileFound(string $file) : void
                                                                                                                                                                                    • dontSeeThemeFileFound(string $file) : void
                                                                                                                                                                                    • dontSeeUploadedFileFound(string $file, string|int|null [$date]) : void
                                                                                                                                                                                    • getBlogUploadsPath(int $blogId, string [$file], DateTimeImmutable|DateTime|string|null [$date]) : string
                                                                                                                                                                                    • getUploadsPath(string [$file], mixed [$date]) : string
                                                                                                                                                                                    • getWpRootFolder() : string
                                                                                                                                                                                    • haveMuPlugin(string $filename, string $code) : void
                                                                                                                                                                                    • havePlugin(string $path, string $code) : void
                                                                                                                                                                                    • haveTheme(string $folder, string $indexFileCode, string [$functionsFileCode]) : void
                                                                                                                                                                                    • makeUploadsDir(string $path) : string
                                                                                                                                                                                    • openFile(string $filename) : void
                                                                                                                                                                                    • openUploadedFile(string $filename, DateTime|string|int|null [$date]) : void
                                                                                                                                                                                    • seeFileContentsEqual(string $text) : void
                                                                                                                                                                                    • seeFileFound(string $filename, string [$path]) : void
                                                                                                                                                                                    • seeInMuPluginFile(string $file, string $contents) : void
                                                                                                                                                                                    • seeInPluginFile(string $file, string $contents) : void
                                                                                                                                                                                    • seeInThemeFile(string $file, string $contents) : void
                                                                                                                                                                                    • seeInThisFile(string $text) : void
                                                                                                                                                                                    • seeInUploadedFile(string $file, string $contents, string|int|null [$date]) : void
                                                                                                                                                                                    • seeMuPluginFileFound(string $file) : void
                                                                                                                                                                                    • seeNumberNewLines(int $number) : void
                                                                                                                                                                                    • seePluginFileFound(string $file) : void
                                                                                                                                                                                    • seeThemeFileFound(string $file) : void
                                                                                                                                                                                    • seeThisFileMatches(string $regex) : void
                                                                                                                                                                                    • seeUploadedFileFound(string $filename, string|int|null [$date]) : void
                                                                                                                                                                                    • writeToFile(string $filename, string $contents) : void
                                                                                                                                                                                    • writeToMuPluginFile(string $file, string $data) : void
                                                                                                                                                                                    • writeToPluginFile(string $file, string $data) : void
                                                                                                                                                                                    • writeToThemeFile(string $file, string $data) : void
                                                                                                                                                                                    • writeToUploadedFile(string $filename, string $data, DateTime|string|int|null [$date]) : string

                                                                                                                                                                                    Read more in Codeception documentation.

                                                                                                                                                                                    "},{"location":"modules/WPLoader/","title":"WPLoader","text":""},{"location":"modules/WPLoader/#wploader-module","title":"WPLoader module","text":"

                                                                                                                                                                                    A module to load WordPress and make its code available in tests.

                                                                                                                                                                                    Depending on the value of the loadOnly configuration parameter, the module will behave differently:

                                                                                                                                                                                    • loadOnly: false - The module will load WordPress like the Core PHPUnit suite does to run integration tests in a controlled environment. Use the module in this mode with test cases generated using the generate:wpunit command.
                                                                                                                                                                                    • loadOnly: true - The module will load WordPress to make it available in the context of tests. Use the module in this mode in Cest, Cept and Codeception unit test cases.
                                                                                                                                                                                    "},{"location":"modules/WPLoader/#configuration-with-loadonly-false","title":"Configuration with loadOnly: false","text":"

                                                                                                                                                                                    The module will load WordPress like the Core PHPUnit suite does to run integration tests in a controlled environment. Together with the test case generated by the generate:wpunit command the module will:

                                                                                                                                                                                    • take care of running any test method in a database transaction rolled back after each test
                                                                                                                                                                                    • manage and clean up the global environment and context between tests

                                                                                                                                                                                    When used in this mode, the module supports the following configuration parameters:

                                                                                                                                                                                    • loadOnly - false to load WordPress and run tests in a controlled environment.
                                                                                                                                                                                    • wpRootFolder - required; the path to the WordPress installation root folder. This can be a relative path to the codeception root directory, or an absolute path to the WordPress installation directory. The WordPress installation directory is the directory that contains the wp-load.php file.
                                                                                                                                                                                    • dbUrl - required; the URL to the database to use to run tests. The URL must be in the form mysql://username:password@host:port/database to use a MySQL database, or in the form sqlite://path/to/database to use a SQLite database. Alternatively, you can use the dbName, dbUser, dbPassword, dbHost configuration parameters to specify the database connection details.
                                                                                                                                                                                    • dump - the path to a database dump, or a set of database dumps, to load before running tests. The dump will be loaded only once, after the tests run.
                                                                                                                                                                                    • tablePrefix - the database table prefix to use when loading WordPress, defaults to wp_.
                                                                                                                                                                                    • multisite - a boolean value to indicate if WordPress should be loaded and initialized in multisite mode.
                                                                                                                                                                                    • dbCharset - the database charset to use when loading WordPress.
                                                                                                                                                                                    • dbCollate - the database collate to use when loading WordPress.
                                                                                                                                                                                    • domain - the domain to use when loading WordPress. Equivalent to defining the WP_TESTS_DOMAIN constant.
                                                                                                                                                                                    • adminEmail - the administrator email to use when loading WordPress. Equivalent to defining the WP_TESTS_EMAIL constant.
                                                                                                                                                                                    • title - the site title to use when loading WordPress. Equivalent to defining the WP_TESTS_TITLE constant.
                                                                                                                                                                                    • phpBinary - the path to the PHP binary to use to run tests. Defaults to the WP_PHP_BINARY constant.
                                                                                                                                                                                    • language - the language to use when loading WordPress. Equivalent to defining the WPLANG constant.
                                                                                                                                                                                    • configFile - a configuration file, or a set of configuration files, to load before the tests to further customize and control the WordPress testing environment.
                                                                                                                                                                                    • pluginsFolder - the path to the plugins folder to use when loading WordPress. Equivalent to defining the WP_PLUGIN_DIR constant.
                                                                                                                                                                                    • plugins - a list of plugins to activate and load in the WordPress installation. Each plugin must be specified in a format like hello.php or my-plugin/my-plugin.php format.
                                                                                                                                                                                    • bootstrapActions - a list of actions or callbacks to call after WordPress is loaded and before the tests run.
                                                                                                                                                                                    • theme - the theme to activate and load in the WordPress installation. The theme must be specified in slug format like twentytwentythree.
                                                                                                                                                                                    • AUTH_KEY - the AUTH_KEY constant value to use when loading WordPress. If the wpRootFolder path points at a configured installation, containing the wp-config.php file, then the value of the constant in the configuration file will be used, else it will be randomly generated.
                                                                                                                                                                                    • SECURE_AUTH_KEY - the SECURE_AUTH_KEY constant value to use when loading WordPress. If the wpRootFolder path points at a configured installation, containing the wp-config.php file, then the value of the constant in the configuration file will be used, else it will be randomly generated.
                                                                                                                                                                                    • LOGGED_IN_KEY - the LOGGED_IN_KEY constant value to use when loading WordPress. If the wpRootFolder path points at a configured installation, containing the wp-config.php file, then the value of the constant in the configuration file will be used, else it will be randomly generated.
                                                                                                                                                                                    • NONCE_KEY - the NONCE_KEY constant value to use when loading WordPress. If the wpRootFolder path points at a configured installation, containing the wp-config.php file, then the value of the constant in the configuration file will be used, else it will be randomly generated.
                                                                                                                                                                                    • AUTH_SALT - the AUTH_SALT constant value to use when loading WordPress. If the wpRootFolder path points at a configured installation, containing the wp-config.php file, then the value of the constant in the configuration file will be used, else it will be randomly generated.
                                                                                                                                                                                    • SECURE_AUTH_SALT - the SECURE_AUTH_SALT constant value to use when loading WordPress. If the wpRootFolder path points at a configured installation, containing the wp-config.php file, then the value of the constant in the configuration file will be used, else it will be randomly generated.
                                                                                                                                                                                    • LOGGED_IN_SALT - the LOGGED_IN_SALT constant value to use when loading WordPress. If the wpRootFolder path points at a configured installation, containing the wp-config.php file, then the value of the constant in the configuration file will be used, else it will be randomly generated.
                                                                                                                                                                                    • NONCE_SALT - the NONCE_SALT constant value to use when loading WordPress. If the wpRootFolder path points at a configured installation, containing the wp-config.php file, then the value of the constant in the configuration file will be used, else it will be randomly generated.
                                                                                                                                                                                    • AUTOMATIC_UPDATER_DISABLED - the AUTOMATIC_UPDATER_DISABLED constant value to use when loading WordPress. If the wpRootFolder path points at a configured installation, containing the wp-config.php file, then the value of the constant in the configuration file will be used, else it will be randomly generated.
                                                                                                                                                                                    • WP_HTTP_BLOCK_EXTERNAL - the WP_HTTP_BLOCK_EXTERNAL constant value to use when loading WordPress. If the wpRootFolder path points at a configured installation, containing the wp-config.php file, then the value of the constant in the configuration file will be used, else it will be randomly generated.

                                                                                                                                                                                    This is an example of an integration suite configured to use the module:

                                                                                                                                                                                    actor: IntegrationTester\nbootstrap: _bootstrap.php\nmodules:\nenabled:\n- \\Helper\\Integration\n- lucatume\\WPBrowser\\Module\\WPLoader:\nwpRootFolder: /var/wordpress\ndbUrl: mysql://root:root@mysql:3306/wordpress\ntablePrefix: test_\ndomain: wordpress.test\nadminEmail: admin@wordpress.test\ntitle: 'Integration Tests'\nplugins:\n- hello.php\n- woocommerce/woocommerce.php\n- my-plugin/my-plugin.php\ntheme: twentytwentythree\n

                                                                                                                                                                                    The following configuration uses dynamic configuration parameters to set the module configuration:

                                                                                                                                                                                    actor: IntegrationTester\nbootstrap: _bootstrap.php\nmodules:\nenabled:\n- \\Helper\\Integration\n- lucatume\\WPBrowser\\Module\\WPLoader:\nwpRootFolder: '%WP_ROOT_FOLDER%'\ndbUrl: '%WP_DB_URL%'\ntablePrefix: '%WP_TABLE_PREFIX%'\ndomain: '%WP_DOMAIN%'\nadminEmail: '%WP_ADMIN_EMAIL%'\ntitle: '%WP_TITLE%'\nplugins:\n- hello.php\n- woocommerce/woocommerce.php\n- my-plugin/my-plugin.php\ntheme: twentytwentythree\n

                                                                                                                                                                                    The following example configuration uses a SQLite database and loads a database fixture before the tests run:

                                                                                                                                                                                    actor: IntegrationTester\nbootstrap: _bootstrap.php\nmodules:\nenabled:\n- \\Helper\\Integration\n- lucatume\\WPBrowser\\Module\\WPLoader:\nwpRootFolder: /var/wordpress\ndbUrl: sqlite:///var/wordpress/wp-tests.sqlite\ndump:\n- tests/_data/products.sql\n- tests/_data/users.sql\n- tests/_data/orders.sql\ntablePrefix: test_\ndomain: wordpress.test\nadminEmail: admin@wordpress.test\ntitle: 'Integration Tests'\nplugins:\n- hello.php\n- woocommerce/woocommerce.php\n- my-plugin/my-plugin.php\ntheme: twentytwentythree\n
                                                                                                                                                                                    "},{"location":"modules/WPLoader/#handling-a-custom-site-structure","title":"Handling a custom site structure","text":"

                                                                                                                                                                                    If you're working on a site project using a custom file structure, e.g. [Bedrock][4], you should use a custom configuration and, together with that, configure the WPLoader module to load WordPress, plugins and themes code from the correct locations. Take care to point the wpRootFolder parameter to the directory containing the wp-load.php file, the /var/my-site/web/wp one in the following example, and the module will read the project configuration file to load the WordPress code from the correct location.

                                                                                                                                                                                    Here's an example of how the module should be configured to run integration tests on a Bedrock installation:

                                                                                                                                                                                    actor: IntegrationTester\nbootstrap: _bootstrap.php\nmodules:\nenabled:\n- \\Helper\\Integration\n- lucatume\\WPBrowser\\Module\\WPLoader:\nwpRootFolder: /var/my-site/web/wp\ndbUrl: mysql://root:root@mysql:3306/wordpress\ntablePrefix: test_\ndomain: my-project.test\nadminEmail: admin@my-project.test\ntitle: 'Integration Tests'\nplugins:\n- hello.php\n- woocommerce/woocommerce.php\n- my-plugin/my-plugin.php\ntheme: twentytwentythree\n

                                                                                                                                                                                    In general, pointing the wpRootFolder parameter to the directory containing the wp-load.php file should take care of loading WordPress code from the correct location. Should that not be the case, use the configFile parameter to point the module to the project test configuration file: a PHP file defining the constants and environment variables to use to load WordPress, plugins and themes correctly.

                                                                                                                                                                                    "},{"location":"modules/WPLoader/#configuration-with-loadonly-true","title":"Configuration with loadOnly: true","text":"

                                                                                                                                                                                    The module will load WordPress from the location specified by the wpRootFodler parameter, relying on the WPDb module to manage the database state.

                                                                                                                                                                                    When used in this mode, the module supports the following configuration parameters:

                                                                                                                                                                                    • loadOnly - true to load WordPress and make it available in the context of tests.
                                                                                                                                                                                    • wpRootFolder - required; the path to the WordPress installation root folder. This can be a relative path to the codeception root directory, or an absolute path to the WordPress installation directory. The WordPress installation directory is the directory that contains the wp-load.php file.
                                                                                                                                                                                    • dbUrl - required; the URL to the database to use to run tests. The URL must be in the form mysql://username:password@host:port/database to use a MySQL database, or in the form sqlite://path/to/database to use a SQLite database. Alternatively, you can use the dbName, dbUser, dbPassword, dbHost configuration parameters to specify the database connection details.
                                                                                                                                                                                    • domain - the domain to use when loading WordPress. Equivalent to defining the WP_TESTS_DOMAIN constant.

                                                                                                                                                                                    The following is an example of the module configuration to run end-to-end tests on the site served at http://localhost:8080 URL and served from the /var/wordpress directory:

                                                                                                                                                                                    actor: EndToEndTester\nbootstrap: _bootstrap.php\nmodules:\nenabled:\n- \\Helper\\Integration\n- lucatume\\WPBrowser\\Module\\WPDb:\ndbUrl: 'mysql://root:password@localhost:3306/wordpress'\nurl: 'http://localhost:8080'\ntablePrefix: 'wp_'\ndump: 'tests/_data/dump.sql'\npopulate: true\ncleanup: true\nreconnect: false\nurlReplacement: true\noriginalUrl: http://wordpress.test\nwaitlock: 10\ncreateIfNotExists: true\n- lucatume\\WPBrowser\\Module\\WPLoader:\nloadOnly: true\nwpRootFolder: /var/wordpress\ndbUrl: 'mysql://root:password@localhost:3306/wordpress'\ndomain: wordpress.test\n
                                                                                                                                                                                    "},{"location":"modules/WPLoader/#methods","title":"Methods","text":"

                                                                                                                                                                                    The module provides the following methods:

                                                                                                                                                                                    • factory() : lucatume\\WPBrowser\\Module\\WPLoader\\FactoryStore
                                                                                                                                                                                    • getContentFolder(string [$path]) : string
                                                                                                                                                                                    • getInstallation() : lucatume\\WPBrowser\\WordPress\\Installation
                                                                                                                                                                                    • getPluginsFolder(string [$path]) : string
                                                                                                                                                                                    • getThemesFolder(string [$path]) : string
                                                                                                                                                                                    • getWpRootFolder(?string [$path]) : string
                                                                                                                                                                                    "},{"location":"modules/WPQueries/","title":"WPQueries","text":""},{"location":"modules/WPQueries/#wpqueries-module","title":"WPQueries module","text":"

                                                                                                                                                                                    This module provides assertions for WordPress queries.

                                                                                                                                                                                    This module can be used in any test context where the global $wpdb variable is defined, this usually means in any suite where the WPLoader module is used.

                                                                                                                                                                                    "},{"location":"modules/WPQueries/#configuration","title":"Configuration","text":"

                                                                                                                                                                                    The method does not require configuration.

                                                                                                                                                                                    "},{"location":"modules/WPQueries/#methods","title":"Methods","text":"

                                                                                                                                                                                    The module provides the following methods:

                                                                                                                                                                                    • assertCountQueries(int $n, string [$message]) : void
                                                                                                                                                                                    • assertNotQueries(string [$message]) : void
                                                                                                                                                                                    • assertNotQueriesByAction(string $action, string [$message]) : void
                                                                                                                                                                                    • assertNotQueriesByFilter(string $filter, string [$message]) : void
                                                                                                                                                                                    • assertNotQueriesByFunction(string $function, string [$message]) : void
                                                                                                                                                                                    • assertNotQueriesByMethod(string $class, string $method, string [$message]) : void
                                                                                                                                                                                    • assertNotQueriesByStatement(string $statement, string [$message]) : void
                                                                                                                                                                                    • assertNotQueriesByStatementAndAction(string $statement, string $action, string [$message]) : void
                                                                                                                                                                                    • assertNotQueriesByStatementAndFilter(string $statement, string $filter, string [$message]) : void
                                                                                                                                                                                    • assertNotQueriesByStatementAndFunction(string $statement, string $function, string [$message]) : void
                                                                                                                                                                                    • assertNotQueriesByStatementAndMethod(string $statement, string $class, string $method, string [$message]) : void
                                                                                                                                                                                    • assertQueries(string [$message]) : void
                                                                                                                                                                                    • assertQueriesByAction(string $action, string [$message]) : void
                                                                                                                                                                                    • assertQueriesByFilter(string $filter, string [$message]) : void
                                                                                                                                                                                    • assertQueriesByFunction(string $function, string [$message]) : void
                                                                                                                                                                                    • assertQueriesByMethod(string $class, string $method, string [$message]) : void
                                                                                                                                                                                    • assertQueriesByStatement(string $statement, string [$message]) : void
                                                                                                                                                                                    • assertQueriesByStatementAndAction(string $statement, string $action, string [$message]) : void
                                                                                                                                                                                    • assertQueriesByStatementAndFilter(string $statement, string $filter, string [$message]) : void
                                                                                                                                                                                    • assertQueriesByStatementAndFunction(string $statement, string $function, string [$message]) : void
                                                                                                                                                                                    • assertQueriesByStatementAndMethod(string $statement, string $class, string $method, string [$message]) : void
                                                                                                                                                                                    • assertQueriesCountByAction(int $n, string $action, string [$message]) : void
                                                                                                                                                                                    • assertQueriesCountByFilter(int $n, string $filter, string [$message]) : void
                                                                                                                                                                                    • assertQueriesCountByFunction(int $n, string $function, string [$message]) : void
                                                                                                                                                                                    • assertQueriesCountByMethod(int $n, string $class, string $method, string [$message]) : void
                                                                                                                                                                                    • assertQueriesCountByStatement(int $n, string $statement, string [$message]) : void
                                                                                                                                                                                    • assertQueriesCountByStatementAndAction(int $n, string $statement, string $action, string [$message]) : void
                                                                                                                                                                                    • assertQueriesCountByStatementAndFilter(int $n, string $statement, string $filter, string [$message]) : void
                                                                                                                                                                                    • assertQueriesCountByStatementAndFunction(int $n, string $statement, string $function, string [$message]) : void
                                                                                                                                                                                    • assertQueriesCountByStatementAndMethod(int $n, string $statement, string $class, string $method, string [$message]) : void
                                                                                                                                                                                    • countQueries(?wpdb [$wpdb]) : int
                                                                                                                                                                                    • getQueries(?wpdb [$wpdb]) : array
                                                                                                                                                                                    "},{"location":"modules/WPWebDriver/","title":"WPWebDriver","text":""},{"location":"modules/WPWebDriver/#wpwebdriver-module","title":"WPWebDriver module","text":"

                                                                                                                                                                                    This module drives a browser using a solution like Selenium or Chromedriver to simulate user interactions with the WordPress project.

                                                                                                                                                                                    The module has full Javascript support, differently from the WPBrowser module, and can be used to test sites that use Javascript to render the page or to make assertions that require Javascript support.

                                                                                                                                                                                    The method extends the Codeception WebDriver module and is used in the context of Cest and Cept test cases.

                                                                                                                                                                                    "},{"location":"modules/WPWebDriver/#configuration","title":"Configuration","text":"
                                                                                                                                                                                    • browser - the browser to use; e.g. 'chrome'
                                                                                                                                                                                    • url - required; the start URL of your WordPress project.
                                                                                                                                                                                    • adminUsername - required; the site administrator username to use in actions like loginAsAdmin.
                                                                                                                                                                                    • adminPassword - required; the site administrator password to use in actions like loginAsAdmin.
                                                                                                                                                                                    • adminPath - the path to the WordPress admin directory; defaults to /wp-admin.

                                                                                                                                                                                    More configuration options, and their explanation, are available in the Codeception WebDriver module documentation.

                                                                                                                                                                                    The following is an example of the module configuration to run tests on thehttp://localhost:8080 site:

                                                                                                                                                                                    modules:\nenabled:\nlucatume\\WPBrowser\\Module\\WPBrowser:\nurl: 'http://localhost:8080'\nadminUsername: 'admin'\nadminPassword: 'password'\nadminPath: '/wp-admin'\nbrowser: chrome\nhost: 'localhost'\nport: '4444'\nwindow_size: false\ncapabilities:\nchromeOptions:\nargs: [ \"--headless\", \"--disable-gpu\", \"--proxy-server='direct://'\", \"--proxy-bypass-list=*\", \"--no-sandbox\", \"--disable-dev-shm-usage\" ]\n

                                                                                                                                                                                    The following configuration uses dynamic configuration parameters to set the module configuration:

                                                                                                                                                                                    modules:\nenabled:\nlucatume\\WPBrowser\\Module\\WPBrowser:\nurl: 'http://localhost:8080'\nadminUsername: 'admin'\nadminPassword: 'password'\nadminPath: '/wp-admin'\nbrowser: chrome\nhost: '%CHROME_HOST%'\nport: '%CHROME_PORT%'\nwindow_size: `1920,1080`\ncapabilities:\nchromeOptions:\nargs: [ \"--disable-gpu\", \"--proxy-server='direct://'\", \"--proxy-bypass-list=*\", \"--no-sandbox\", \"--disable-dev-shm-usage\" ]\n

                                                                                                                                                                                    Furthermore, the above configuration will not run Chrome in headless mode: the browser window will be visible.

                                                                                                                                                                                    "},{"location":"modules/WPWebDriver/#methods","title":"Methods","text":"

                                                                                                                                                                                    The module provides the following methods:

                                                                                                                                                                                    • acceptPopup() : void
                                                                                                                                                                                    • activatePlugin(array|string $pluginSlug) : void
                                                                                                                                                                                    • amEditingPostWithId(int $id) : void
                                                                                                                                                                                    • amOnAdminAjaxPage(array|string|null [$queryVars]) : void
                                                                                                                                                                                    • amOnAdminPage(string $page) : void
                                                                                                                                                                                    • amOnCronPage(array|string|null [$queryVars]) : void
                                                                                                                                                                                    • amOnPage($page) : void
                                                                                                                                                                                    • amOnPagesPage() : void
                                                                                                                                                                                    • amOnPluginsPage() : void
                                                                                                                                                                                    • amOnSubdomain(string $subdomain) : void
                                                                                                                                                                                    • amOnUrl($url) : void
                                                                                                                                                                                    • appendField($field, string $value) : void
                                                                                                                                                                                    • attachFile($field, string $filename) : void
                                                                                                                                                                                    • cancelPopup() : void
                                                                                                                                                                                    • checkOption($option) : void
                                                                                                                                                                                    • clearField($field) : void
                                                                                                                                                                                    • click($link, [$context]) : void
                                                                                                                                                                                    • clickWithLeftButton([$cssOrXPath], ?int [$offsetX], ?int [$offsetY]) : void
                                                                                                                                                                                    • clickWithRightButton([$cssOrXPath], ?int [$offsetX], ?int [$offsetY]) : void
                                                                                                                                                                                    • closeTab() : void
                                                                                                                                                                                    • deactivatePlugin(array|string $pluginSlug) : void
                                                                                                                                                                                    • debugWebDriverLogs(?Codeception\\TestInterface [$test]) : void
                                                                                                                                                                                    • deleteSessionSnapshot($name) : void
                                                                                                                                                                                    • dontSee($text, [$selector]) : void
                                                                                                                                                                                    • dontSeeCheckboxIsChecked($checkbox) : void
                                                                                                                                                                                    • dontSeeCookie($cookie, array [$params], bool [$showDebug]) : void
                                                                                                                                                                                    • dontSeeCurrentUrlEquals(string $uri) : void
                                                                                                                                                                                    • dontSeeCurrentUrlMatches(string $uri) : void
                                                                                                                                                                                    • dontSeeElement($selector, array [$attributes]) : void
                                                                                                                                                                                    • dontSeeElementInDOM($selector, array [$attributes]) : void
                                                                                                                                                                                    • dontSeeInCurrentUrl(string $uri) : void
                                                                                                                                                                                    • dontSeeInField($field, $value) : void
                                                                                                                                                                                    • dontSeeInFormFields($formSelector, array $params) : void
                                                                                                                                                                                    • dontSeeInPageSource(string $text) : void
                                                                                                                                                                                    • dontSeeInPopup(string $text) : void
                                                                                                                                                                                    • dontSeeInSource($raw) : void
                                                                                                                                                                                    • dontSeeInTitle($title) : void
                                                                                                                                                                                    • dontSeeLink(string $text, string [$url]) : void
                                                                                                                                                                                    • dontSeeOptionIsSelected($selector, $optionText) : void
                                                                                                                                                                                    • dontSeePluginInstalled(string $pluginSlug) : void
                                                                                                                                                                                    • doubleClick($cssOrXPath) : void
                                                                                                                                                                                    • dragAndDrop($source, $target) : void
                                                                                                                                                                                    • executeAsyncJS(string $script, array [$arguments]) : void
                                                                                                                                                                                    • executeInSelenium(Closure $function) : void
                                                                                                                                                                                    • executeJS(string $script, array [$arguments]) : void
                                                                                                                                                                                    • fillField($field, $value) : void
                                                                                                                                                                                    • grabAttributeFrom($cssOrXpath, $attribute) : ?string
                                                                                                                                                                                    • grabCookie($cookie, array [$params]) : mixed
                                                                                                                                                                                    • grabCookiesWithPattern(string $cookiePattern) : ?array
                                                                                                                                                                                    • grabFromCurrentUrl([$uri]) : mixed
                                                                                                                                                                                    • grabFullUrl() : string
                                                                                                                                                                                    • grabMultiple($cssOrXpath, [$attribute]) : array
                                                                                                                                                                                    • grabPageSource() : string
                                                                                                                                                                                    • grabTextFrom($cssOrXPathOrRegex) : mixed
                                                                                                                                                                                    • grabValueFrom($field) : ?string
                                                                                                                                                                                    • grabWordPressTestCookie(?string [$name]) : ?Symfony\\Component\\BrowserKit\\Cookie
                                                                                                                                                                                    • loadSessionSnapshot($name, bool [$showDebug]) : bool
                                                                                                                                                                                    • logOut(string|bool [$redirectTo]) : void
                                                                                                                                                                                    • loginAs(string $username, string $password, int [$timeout], int [$maxAttempts]) : void
                                                                                                                                                                                    • loginAsAdmin(int [$timeout], int [$maxAttempts]) : void
                                                                                                                                                                                    • makeElementScreenshot($selector, ?string [$name]) : void
                                                                                                                                                                                    • makeHtmlSnapshot(?string [$name]) : void
                                                                                                                                                                                    • makeScreenshot(?string [$name]) : void
                                                                                                                                                                                    • maximizeWindow() : void
                                                                                                                                                                                    • moveBack() : void
                                                                                                                                                                                    • moveForward() : void
                                                                                                                                                                                    • moveMouseOver([$cssOrXPath], ?int [$offsetX], ?int [$offsetY]) : void
                                                                                                                                                                                    • openNewTab() : void
                                                                                                                                                                                    • performOn($element, $actions, int [$timeout]) : void
                                                                                                                                                                                    • pressKey($element, ...[$chars]) : void
                                                                                                                                                                                    • reloadPage() : void
                                                                                                                                                                                    • resetCookie($cookie, array [$params], bool [$showDebug]) : void
                                                                                                                                                                                    • resizeWindow(int $width, int $height) : void
                                                                                                                                                                                    • saveSessionSnapshot($name) : void
                                                                                                                                                                                    • scrollTo($selector, ?int [$offsetX], ?int [$offsetY]) : void
                                                                                                                                                                                    • see($text, [$selector]) : void
                                                                                                                                                                                    • seeCheckboxIsChecked($checkbox) : void
                                                                                                                                                                                    • seeCookie($cookie, array [$params], bool [$showDebug]) : void
                                                                                                                                                                                    • seeCurrentUrlEquals(string $uri) : void
                                                                                                                                                                                    • seeCurrentUrlMatches(string $uri) : void
                                                                                                                                                                                    • seeElement($selector, array [$attributes]) : void
                                                                                                                                                                                    • seeElementInDOM($selector, array [$attributes]) : void
                                                                                                                                                                                    • seeErrorMessage(array|string [$classes]) : void
                                                                                                                                                                                    • seeInCurrentUrl(string $uri) : void
                                                                                                                                                                                    • seeInField($field, $value) : void
                                                                                                                                                                                    • seeInFormFields($formSelector, array $params) : void
                                                                                                                                                                                    • seeInPageSource(string $text) : void
                                                                                                                                                                                    • seeInPopup(string $text) : void
                                                                                                                                                                                    • seeInSource($raw) : void
                                                                                                                                                                                    • seeInTitle($title) : void
                                                                                                                                                                                    • seeLink(string $text, ?string [$url]) : void
                                                                                                                                                                                    • seeMessage(array|string [$classes]) : void
                                                                                                                                                                                    • seeNumberOfElements($selector, $expected) : void
                                                                                                                                                                                    • seeNumberOfElementsInDOM($selector, $expected) : void
                                                                                                                                                                                    • seeNumberOfTabs(int $number) : void
                                                                                                                                                                                    • seeOptionIsSelected($selector, $optionText) : void
                                                                                                                                                                                    • seePluginActivated(string $pluginSlug) : void
                                                                                                                                                                                    • seePluginDeactivated(string $pluginSlug) : void
                                                                                                                                                                                    • seePluginInstalled(string $pluginSlug) : void
                                                                                                                                                                                    • seeWpDiePage() : void
                                                                                                                                                                                    • selectOption($select, $option) : void
                                                                                                                                                                                    • setCookie($name, $value, array [$params], [$showDebug]) : void
                                                                                                                                                                                    • submitForm($selector, array $params, [$button]) : void
                                                                                                                                                                                    • switchToFrame(?string [$locator]) : void
                                                                                                                                                                                    • switchToIFrame(?string [$locator]) : void
                                                                                                                                                                                    • switchToNextTab(int [$offset]) : void
                                                                                                                                                                                    • switchToPreviousTab(int [$offset]) : void
                                                                                                                                                                                    • switchToWindow(?string [$name]) : void
                                                                                                                                                                                    • type(string $text, int [$delay]) : void
                                                                                                                                                                                    • typeInPopup(string $keys) : void
                                                                                                                                                                                    • uncheckOption($option) : void
                                                                                                                                                                                    • unselectOption($select, $option) : void
                                                                                                                                                                                    • wait($timeout) : void
                                                                                                                                                                                    • waitForElement($element, int [$timeout]) : void
                                                                                                                                                                                    • waitForElementChange($element, Closure $callback, int [$timeout]) : void
                                                                                                                                                                                    • waitForElementClickable($element, int [$timeout]) : void
                                                                                                                                                                                    • waitForElementNotVisible($element, int [$timeout]) : void
                                                                                                                                                                                    • waitForElementVisible($element, int [$timeout]) : void
                                                                                                                                                                                    • waitForJS(string $script, int [$timeout]) : void
                                                                                                                                                                                    • waitForJqueryAjax(int [$time]) : void
                                                                                                                                                                                    • waitForText(string $text, int [$timeout], [$selector]) : void

                                                                                                                                                                                    Read more in Codeception documentation.

                                                                                                                                                                                    "},{"location":"v3/","title":"Welcome","text":"

                                                                                                                                                                                    This is the documentation for version 3 of the project. The current version is version 4 and the documentation can be found here.

                                                                                                                                                                                    The wp-browser project provides a Codeception based solution to test WordPress plugins, themes and whole sites at all levels of testing.

                                                                                                                                                                                    The purpose of this documentation is to help you set up, run and iterate over your project and test code using the powerful APIs provided by Codeception while trying to alleviate the pains of setting it up for WordPress projects.

                                                                                                                                                                                    Throughout the documentation you will find references to test terminology: I've tried to condense those into small, digestable chunks to provide a rough idea without and a limited context; where required I tried to provide links to dive deeper into the subjects.

                                                                                                                                                                                    Happy testing!

                                                                                                                                                                                    "},{"location":"v3/codeception-4-support/","title":"Using wp-browser with Codeception 4.0","text":"

                                                                                                                                                                                    This is the documentation for version 3 of the project. The current version is version 4 and the documentation can be found here.

                                                                                                                                                                                    "},{"location":"v3/codeception-4-support/#using-wp-browser-with-codeception-40","title":"Using wp-browser with Codeception 4.0","text":"

                                                                                                                                                                                    Codeception version 4.0 introduced a number of new features to the framework and it's the version of wp-browser that will be maintained from now on.

                                                                                                                                                                                    I've made an effort to keep wp-browser compatible with PHP 5.6 and Codeception versions from 2.5 up.

                                                                                                                                                                                    One the biggest changes of Codeception version 4.0 is that modules have been broken out into separate packages. To use wp-browser with Codeception 4.0 all you need to do is to add this to your project composer.json file:

                                                                                                                                                                                    {\n\"require-dev\": {\n\"lucatume/wp-browser\": \"^2.4\",\n\"codeception/module-asserts\": \"^1.0\",\n\"codeception/module-phpbrowser\": \"^1.0\",\n\"codeception/module-webdriver\": \"^1.0\",\n\"codeception/module-db\": \"^1.0\",\n\"codeception/module-filesystem\": \"^1.0\",\n\"codeception/module-cli\": \"^1.0\",\n\"codeception/util-universalframework\": \"^1.0\"\n}\n}\n

                                                                                                                                                                                    You might not need all the modules listed here, depending on the wp-browser modules you use in your test suites. This is a scheme of what Codeception modules you will need for which wp-browser module to help you choose only the required modules:

                                                                                                                                                                                    • \"codeception/module-asserts\" - Required for Codeception 4.0 compatibility.
                                                                                                                                                                                    • \"codeception/module-phpbrowser\" - Required by the WPBrowser module.
                                                                                                                                                                                    • \"codeception/module-webdriver\" - Required by the WPWebDriver module.
                                                                                                                                                                                    • \"codeception/module-db\" - Required by the WPDb module.
                                                                                                                                                                                    • \"codeception/module-filesystem\" - Required by the WPFilesystem module.
                                                                                                                                                                                    • \"codeception/module-cli\" - Required by the WPCLI module.
                                                                                                                                                                                    • \"codeception/util-universalframework\" - Required by the WordPress framework module.
                                                                                                                                                                                    "},{"location":"v3/codeception-phpunit-and-wpbrowser/","title":"Codeception, PHPUnit and wp-browser","text":"

                                                                                                                                                                                    This is the documentation for version 3 of the project. The current version is version 4 and the documentation can be found here.

                                                                                                                                                                                    "},{"location":"v3/codeception-phpunit-and-wpbrowser/#the-wp-browser-stack","title":"The wp-browser stack","text":"

                                                                                                                                                                                    The wp-browser project is built leveraging the power of a number of open-source projects.

                                                                                                                                                                                    While I'm not listing all of them here it's worth mentioning those that will come up, again and again, in the documentation.

                                                                                                                                                                                    "},{"location":"v3/codeception-phpunit-and-wpbrowser/#wordpress","title":"WordPress","text":"

                                                                                                                                                                                    WordPress is open source software you can use to create a beautiful website, blog, or app.

                                                                                                                                                                                    The line is taken directly from WordPress.org site.

                                                                                                                                                                                    In the context of this documentation WordPress is the PHP and JavaScript framework websites and web applications can be built on, the one anyone can download from here.

                                                                                                                                                                                    "},{"location":"v3/codeception-phpunit-and-wpbrowser/#codeception","title":"Codeception","text":"

                                                                                                                                                                                    Codeception (home) is a modern, powerful PHP testing framework written in PHP.

                                                                                                                                                                                    It comes with a number of modules and extensions that are comparable to WordPress plugins and themes.

                                                                                                                                                                                    Modules and extensions are combined in suites to be able to run a specific type of test. Each suite will handle a specific type of test for a specific set of code.

                                                                                                                                                                                    wp-browser is none other than a collection of modules and extensions for Codeception made specifically to test WordPress applications.

                                                                                                                                                                                    "},{"location":"v3/codeception-phpunit-and-wpbrowser/#phpunit","title":"PHPUnit","text":"

                                                                                                                                                                                    PHPUnit is the most widely known PHP testing framework. As the name implies it was born to make unit testing of PHP code easier but its scope and power has grown well below that.

                                                                                                                                                                                    Codeception is based, and uses, PhpUnit to wrap some of its functionalities into an easy-to-use API. The two are so compatible one with the other that Codeception can run PHPUnit tests with little to no changes.

                                                                                                                                                                                    This documentation will not cover this subject and will only deal with Codeception-native test methods but you can find more information here.

                                                                                                                                                                                    "},{"location":"v3/commands/","title":"Commands","text":"

                                                                                                                                                                                    This is the documentation for version 3 of the project. The current version is version 4 and the documentation can be found here.

                                                                                                                                                                                    "},{"location":"v3/commands/#custom-commands-provided-by-wp-browser","title":"Custom commands provided by wp-browser","text":"

                                                                                                                                                                                    The project comes with its own set of custom Codeception commands.

                                                                                                                                                                                    The commands provide functionalities to quickly scaffold different types of tests. Any other codecept command remains intact and available.

                                                                                                                                                                                    "},{"location":"v3/commands/#adding-the-commands-to-an-existing-project","title":"Adding the commands to an existing project","text":"

                                                                                                                                                                                    The commands are added to the main Codeception configuration file, codeception.yml, when scaffolding a project via the codecept init wp-browser command.

                                                                                                                                                                                    They can be added to any existing project adding, or editing, the commands section of the configuration file:

                                                                                                                                                                                    extensions:\ncommands:\n- \"Codeception\\\\Command\\\\GenerateWPUnit\"\n- \"Codeception\\\\Command\\\\GenerateWPRestApi\"\n- \"Codeception\\\\Command\\\\GenerateWPRestController\"\n- \"Codeception\\\\Command\\\\GenerateWPRestPostTypeController\"\n- \"Codeception\\\\Command\\\\GenerateWPAjax\"\n- \"Codeception\\\\Command\\\\GenerateWPCanonical\"\n- \"Codeception\\\\Command\\\\GenerateWPXMLRPC\"\n
                                                                                                                                                                                    "},{"location":"v3/commands/#generation-commands","title":"Generation commands","text":"

                                                                                                                                                                                    The library provides commands to quickly scaffold integration test cases for specific types of WordPress components, see levels of testing for more information.

                                                                                                                                                                                    The tests are almost identical to the ones you could write in a PHPUnit based Core suite with the exception of extending the Codeception\\TestCase\\WPTestCase test case.

                                                                                                                                                                                    "},{"location":"v3/commands/#generatewpunit","title":"generate:wpunit","text":"

                                                                                                                                                                                    Generates a test case extending the \\Codeception\\TestCase\\WPTestCase class using the

                                                                                                                                                                                      codecept generate:wpunit suite SomeClass\n

                                                                                                                                                                                    The command will generate a skeleton test case like

                                                                                                                                                                                    <?php\nclass SomeClassTest extends \\Codeception\\TestCase\\WPTestCase\n{\npublic function setUp()\n{\nparent::setUp();\n}\npublic function tearDown()\n{\nparent::tearDown();\n}\n// tests\npublic function testMe()\n{\n}\n}\n
                                                                                                                                                                                    "},{"location":"v3/commands/#generatewprest","title":"generate:wprest","text":"

                                                                                                                                                                                    Generates a test case extending the \\Codeception\\TestCase\\WPRestApiTestCase class using the

                                                                                                                                                                                      codecept generate:wprest suite SomeClass\n

                                                                                                                                                                                    The command will generate a skeleton test case like

                                                                                                                                                                                    <?php\nclass SomeClassTest extends \\Codeception\\TestCase\\WPRestApiTestCase\n{\npublic function setUp()\n{\nparent::setUp();\n}\npublic function tearDown()\n{\nparent::tearDown();\n}\n// tests\npublic function testMe()\n{\n}\n}\n
                                                                                                                                                                                    "},{"location":"v3/commands/#generatewprestcontroller","title":"generate:wprestcontroller","text":"

                                                                                                                                                                                    Generates a test case extending the \\Codeception\\TestCase\\WPRestControllerTestCase class using the

                                                                                                                                                                                      codecept generate:wprest suite SomeClass\n

                                                                                                                                                                                    The command will generate a skeleton test case like

                                                                                                                                                                                    <?php\nclass SomeClassTest extends \\Codeception\\TestCase\\WPRestControllerTestCase\n{\npublic function setUp()\n{\nparent::setUp();\n}\npublic function tearDown()\n{\nparent::tearDown();\n}\n// tests\npublic function testMe()\n{\n}\n}\n
                                                                                                                                                                                    "},{"location":"v3/commands/#generatewprestposttypecontroller","title":"generate:wprestposttypecontroller","text":"

                                                                                                                                                                                    Generates a test case extending the \\Codeception\\TestCase\\WPRestPostTypeControllerTestCase class using the

                                                                                                                                                                                      codecept generate:wprest suite SomeClass\n

                                                                                                                                                                                    The command will generate a skeleton test case like

                                                                                                                                                                                    <?php\nclass SomeClassTest extends \\Codeception\\TestCase\\WPRestPostTypeControllerTestCase\n{\npublic function setUp()\n{\nparent::setUp();\n}\npublic function tearDown()\n{\nparent::tearDown();\n}\n// tests\npublic function testMe()\n{\n}\n}\n
                                                                                                                                                                                    "},{"location":"v3/commands/#generatewpajax","title":"generate:wpajax","text":"

                                                                                                                                                                                    Generates a test case extending the \\Codeception\\TestCase\\WPAjaxTestCase class using the

                                                                                                                                                                                      codecept generate:wpajax suite SomeClass\n

                                                                                                                                                                                    The command will generate a skeleton test case like

                                                                                                                                                                                    <?php\nclass SomeClassTest extends \\Codeception\\TestCase\\WPAjaxTestCase\n{\npublic function setUp()\n{\nparent::setUp();\n}\npublic function tearDown()\n{\nparent::tearDown();\n}\n// tests\npublic function testMe()\n{\n}\n}\n
                                                                                                                                                                                    "},{"location":"v3/commands/#generatewpxmlrpc","title":"generate:wpxmlrpc","text":"

                                                                                                                                                                                    Generates a test case extending the \\Codeception\\TestCase\\WPXMLRPCTestCase class using the

                                                                                                                                                                                      codecept generate:wpxmlrpc suite SomeClass\n

                                                                                                                                                                                    The command will generate a skeleton test case like

                                                                                                                                                                                    <?php\nclass SomeClassTest extends \\Codeception\\TestCase\\WPXMLRPCTestCase\n{\npublic function setUp()\n{\nparent::setUp();\n}\npublic function tearDown()\n{\nparent::tearDown();\n}\n// tests\npublic function testMe()\n{\n}\n}\n
                                                                                                                                                                                    "},{"location":"v3/commands/#generatewpcanonical","title":"generate:wpcanonical","text":"

                                                                                                                                                                                    Generates a test case extending the \\Codeception\\TestCase\\WPCanonicalTestCase class using the

                                                                                                                                                                                      codecept generate:wpcanonical suite SomeClass\n

                                                                                                                                                                                    The command will generate a skeleton test case like

                                                                                                                                                                                    <?php\nclass SomeClassTest extends \\Codeception\\TestCase\\WPCanonicalTestCase\n{\npublic function setUp()\n{\nparent::setUp();\n}\npublic function tearDown()\n{\nparent::tearDown();\n}\n// tests\npublic function testMe()\n{\n}\n}\n
                                                                                                                                                                                    "},{"location":"v3/configuration/","title":"Configuration","text":"

                                                                                                                                                                                    This is the documentation for version 3 of the project. The current version is version 4 and the documentation can be found here.

                                                                                                                                                                                    "},{"location":"v3/configuration/#initializing-wp-browser","title":"Initializing wp-browser","text":"

                                                                                                                                                                                    While wp-browser can be configured manually creating each file the fastest way to bootstrap its configuration is by using its initialization template.

                                                                                                                                                                                    Throughout the steps below I will use the WordPress setup I've prepared before From the root folder of the project, /Users/luca/Sites/wordpress/wp-content/plugins/acme-plugin in the example, run the command:

                                                                                                                                                                                    vendor/bin/codecept init wpbrowser\n

                                                                                                                                                                                    Composer installed Codeception binary (codecept) in the vendor folder of my project.

                                                                                                                                                                                    With the command above I'm telling Codeception to initialize a wp-browser project in the current folder. When I click enter I'm presented with a list of questions, each answer will be used to configure the wp-browser project for me; one by one.

                                                                                                                                                                                    In the screenshot the answers I've provided to each question, with reference to the setup above:

                                                                                                                                                                                    wp-browser will try to provide a brief explanation of what each question is but below is the long version.

                                                                                                                                                                                    "},{"location":"v3/configuration/#long-question-explanation","title":"Long question explanation","text":"

                                                                                                                                                                                    I've tried to condense as much clarity as possible in the questions the codecept init wpbrowser command will ask but, for sake of brevity and space, there's no way I could provide inline a deeper explanation of each.

                                                                                                                                                                                    Below is a longer explanation of each question:

                                                                                                                                                                                    • How would you like the acceptance suite to be called?
                                                                                                                                                                                    • How would you like the functional suite to be called?
                                                                                                                                                                                    • How would you like the WordPress unit and integration suite to be called?
                                                                                                                                                                                    • How would you like to call the env configuration file?
                                                                                                                                                                                    • Where is WordPress installed?
                                                                                                                                                                                    • What is the path, relative to WordPress root URL, of the admin area of the test site?
                                                                                                                                                                                    • What is the name of the test database used by the test site?
                                                                                                                                                                                    • What is the host of the test database used by the test site?
                                                                                                                                                                                    • What is the user of the test database WPLoader should use?
                                                                                                                                                                                    • What is the password of the test database WPLoader should use?
                                                                                                                                                                                    • What is the table prefix of the test database WPLoader should use?
                                                                                                                                                                                    • What is the URL the test site?
                                                                                                                                                                                    • What is the email of the test site WordPress administrator?
                                                                                                                                                                                    • What is the title of the test site?
                                                                                                                                                                                    • What is the login of the administrator user of the test site?
                                                                                                                                                                                    • What is the password of the administrator user of the test site?
                                                                                                                                                                                    • Are you testing a plugin, a theme or a combination of both?
                                                                                                                                                                                    • What is the folder/plugin.php name of the plugin?
                                                                                                                                                                                    • Are you developing a child theme?
                                                                                                                                                                                    • Are you using a child theme?
                                                                                                                                                                                    • What is the slug of the parent theme?
                                                                                                                                                                                    • What is the slug of the theme?
                                                                                                                                                                                    • What is the slug of the theme you are using?
                                                                                                                                                                                    • Does your project needs additional plugins to be activated to work?
                                                                                                                                                                                    "},{"location":"v3/configuration/#how-would-you-like-the-acceptance-suite-to-be-called","title":"How would you like the acceptance suite to be called?","text":"

                                                                                                                                                                                    With reference to the testing levels definition this question provides you with the possibility to change the name of the acceptance-like test suite.

                                                                                                                                                                                    Common, alternative, names are ui, rest and user.

                                                                                                                                                                                    "},{"location":"v3/configuration/#how-would-you-like-the-functional-suite-to-be-called","title":"How would you like the functional suite to be called?","text":"

                                                                                                                                                                                    With reference to the testing levels definition this question provides you with the possibility to change the name of the functional-like test suite.

                                                                                                                                                                                    A common alternative name is service.

                                                                                                                                                                                    "},{"location":"v3/configuration/#how-would-you-like-the-wordpress-unit-and-integration-suite-to-be-called","title":"How would you like the WordPress unit and integration suite to be called?","text":"

                                                                                                                                                                                    With reference to the testing levels definition this question provides you with the possibility to change the name of the suite dedicated to integration and \"WordPress unit\" tests.

                                                                                                                                                                                    A common alternative name is integration.

                                                                                                                                                                                    "},{"location":"v3/configuration/#how-would-you-like-to-call-the-env-configuration-file","title":"How would you like to call the env configuration file?","text":"

                                                                                                                                                                                    Instead of configuring each module in each suite with the same parameters over and over Codeception supports dynamic configuration via environment files.

                                                                                                                                                                                    wp-browser will scaffold such a configuration for you and will use, by default, a file called .env to store the configuration parameters.

                                                                                                                                                                                    The file name might not suit all setups especially and this question allows changing that file name; common, alternative, file names are .env.tests, .env.codeception and similar.

                                                                                                                                                                                    "},{"location":"v3/configuration/#where-is-wordpress-installed","title":"Where is WordPress installed?","text":"

                                                                                                                                                                                    During tests the test code will need to access WordPress code, precisely wp-browser requires being pointed to the folder that contains the wp-load.php file.

                                                                                                                                                                                    The answer can be an absolute path, like /Users/luca/Sites/wordrpress, or a path relative to the folder where Codeception is installed like vendor/wordpress.

                                                                                                                                                                                    This path should be accessible by the machine that is running the tests; if you're running the tests from your machine (e.g. your laptop) that's just the path to the folder where WordPress is installed, /Users/luca/Sites/wordpress in the example configuration above.

                                                                                                                                                                                    If you are, instead, running the tests from within a virtualized machine (e.g. Vagrant or Docker) then the path should be the one used by the virtualized machine.

                                                                                                                                                                                    To make an example:

                                                                                                                                                                                    • on my machine WordPress is installed at /Users/luca/Sites/wordpress
                                                                                                                                                                                    • I've created a Docker container using the official WordPress image and bound the above folder into the container
                                                                                                                                                                                    • internally the container will put WordPress in the /var/www/html folder

                                                                                                                                                                                    If I run the tests from my host machine then WordPress root directory will be /Users/luca/Sites/wordpress, if I run the tests from within the Docker container then WordPress root folder will be /var/www/html.

                                                                                                                                                                                    Another example is Local by Flywheel:

                                                                                                                                                                                    • in the host machine the path to the WordPress root folder will be /Users/luca/Local\\ Sites/wordpress/app/public
                                                                                                                                                                                    • from within the Docker container managed by Local the path will be /app/public

                                                                                                                                                                                    If you need a solution that will work in both instances use a relative path: wp-browser will accept paths like ./../../../wordpress and will attempt to resolve them.

                                                                                                                                                                                    "},{"location":"v3/configuration/#what-is-the-path-relative-to-wordpress-root-url-of-the-admin-area-of-the-test-site","title":"What is the path, relative to WordPress root URL, of the admin area of the test site?","text":"

                                                                                                                                                                                    This is usually /wp-admin but you might have the web-server, or a plugin, redirect or hide requests for the administration area to another path.

                                                                                                                                                                                    Some examples are /admin, /login and the like.

                                                                                                                                                                                    Mind that this is not the path to the login page but the path to the administrationo area; this will be used by wp-browser to find to the administration area in acceptance and functional tests.

                                                                                                                                                                                    "},{"location":"v3/configuration/#what-is-the-name-of-the-test-database-used-by-the-test-site","title":"What is the name of the test database used by the test site?","text":"

                                                                                                                                                                                    In my example setup it's wordpress.

                                                                                                                                                                                    This is the name of the database that is storing the information used by the site I can reach at http://localhost:8080.

                                                                                                                                                                                    I want to underline the word \"test\". Any site and any database you use and expose to wp-browser should be intended for tests; this means that it does not contain any data you care about as it will be lost.

                                                                                                                                                                                    "},{"location":"v3/configuration/#what-is-the-host-of-the-test-database-used-by-the-test-site","title":"What is the host of the test database used by the test site?","text":"

                                                                                                                                                                                    In my example setup it's 127.0.0.1:3306.

                                                                                                                                                                                    Here the same principle valid for Where is WordPress installed? applies: the database host is relative to the machine that is running the tests.

                                                                                                                                                                                    In my example I'm hosting the database locally, on my laptop, and my machine can reach it at the localhost address (127.0.0.1) on MySQL default port (3306).

                                                                                                                                                                                    If I am using the database of a Local by Flywheel site from my host machine then it might be something like 192.168.92.100:4050 (from the site \"Database\" tab); the same principle applies if I am using a Vagrant-based or Docker-based solution.

                                                                                                                                                                                    If I am running the tests from within a virtualized machine (a Docker container, a Vagrant box et cetera) then it would probably be localhost or 1270.0.0.1.

                                                                                                                                                                                    This detail will be used in the context of acceptance and functional tests by the WPDb module.

                                                                                                                                                                                    "},{"location":"v3/configuration/#what-is-the-user-of-the-test-database-used-by-the-test-site","title":"What is the user of the test database used by the test site?","text":"

                                                                                                                                                                                    In my example setup it's root as I'm using MySQL server root user to access the database during tests.

                                                                                                                                                                                    Depending on your setup it might be different; since wp-browser will need to not only read but write too to the database make sure to use a user that has full access to the database specified in the answer to the What is the host of the test database used by the test site? question.

                                                                                                                                                                                    This detail will be used in the context of acceptance and functional tests by the WPDb module.

                                                                                                                                                                                    "},{"location":"v3/configuration/#what-is-the-password-of-the-test-database-used-by-the-test-site","title":"What is the password of the test database used by the test site?","text":"

                                                                                                                                                                                    In my example setup it's empty as I've not set any password for the root account.

                                                                                                                                                                                    In your case it might be different and it should be the password associated with the user specified in the answer to the What is the user of the test database used by the test site? question.

                                                                                                                                                                                    This detail will be used in the context of acceptance and functional tests by the WPDb module.

                                                                                                                                                                                    "},{"location":"v3/configuration/#what-is-the-table-prefix-of-the-test-database-used-by-the-test-site","title":"What is the table prefix of the test database used by the test site?","text":"

                                                                                                                                                                                    In my example setup it's wp_; that value is taken from the WordPress installation configuration file.

                                                                                                                                                                                    To have any influence on the site wp-browser will need to modify the same database tables WordPress is using; as I did you can take this value from the wp-config.php file directly: it's the value of the $table_prefix variable.

                                                                                                                                                                                    This detail will be used in the context of acceptance and functional tests by the WPDb module.

                                                                                                                                                                                    "},{"location":"v3/configuration/#what-is-the-name-of-the-test-database-wploader-should-use","title":"What is the name of the test database WPLoader should use?","text":"

                                                                                                                                                                                    In my example setup it's tests.

                                                                                                                                                                                    During integration, or WordPress \"unit\" tests, wp-loader will need to load WordPress code.

                                                                                                                                                                                    Since WordPress code is not meant to be \"modular\" it does not support auto-loading or loading just parts of it; it's either almost all or nothing.

                                                                                                                                                                                    One of the first things WordPress does, when loading, is trying to connect to a database: if that database is not available then WordPress will not load.

                                                                                                                                                                                    In the answer to the question Where is WordPress installed? I've told wp-browser where to find WordPress code, in this answer I'm telling wp-browser what database it should use to bootstrap WordPress.

                                                                                                                                                                                    This detail will be used by the WPLoader module to bootstrap WordPress. It's highly recommended to use a different database from the one used for functional and acceptance tests.

                                                                                                                                                                                    "},{"location":"v3/configuration/#what-is-the-host-of-the-test-database-wploader-should-use","title":"What is the host of the test database WPLoader should use?","text":"

                                                                                                                                                                                    In my example setup it's 127.0.0.1:3306.

                                                                                                                                                                                    As in the answer to the question What is the name of the test database WPLoader should use? we're providing connection details about the database that should be used to bootstrap WordPress during integration and WordPress \"unit\" tests.

                                                                                                                                                                                    Again the database host is in relation to the machine running the tests, all the considerations done for What is the host of the test database used by the test site? apply.

                                                                                                                                                                                    This detail will be used by the WPLoader module to bootstrap WordPress.

                                                                                                                                                                                    "},{"location":"v3/configuration/#what-is-the-user-of-the-test-database-wploader-should-use","title":"What is the user of the test database WPLoader should use?","text":"

                                                                                                                                                                                    In my example it's root.

                                                                                                                                                                                    Similar to the question What is the user of the test database used by the test site? but in relation to the database specified in the question What is the name of the test database WPLoader should use?.

                                                                                                                                                                                    This detail will be used by the WPLoader module to bootstrap WordPress.

                                                                                                                                                                                    "},{"location":"v3/configuration/#what-is-the-password-of-the-test-database-wploader-should-use","title":"What is the password of the test database WPLoader should use?","text":"

                                                                                                                                                                                    In my example setup it's empty as I've not set any password for the root account.

                                                                                                                                                                                    Similar to the question What is the password of the test database used by the test site? but in relation to the database specified in the question What is the name of the test database WPLoader should use?.

                                                                                                                                                                                    This detail will be used by the WPLoader module to bootstrap WordPress.

                                                                                                                                                                                    "},{"location":"v3/configuration/#what-is-the-table-prefix-of-the-test-database-wploader-should-use","title":"What is the table prefix of the test database WPLoader should use?","text":"

                                                                                                                                                                                    In my example setup it's wp_.

                                                                                                                                                                                    Similar to the question What is the table prefix of the test database used by the test site? but in relation to the database specified in the question What is the name of the test database WPLoader should use?.

                                                                                                                                                                                    This detail will be used by the WPLoader module to bootstrap WordPress.

                                                                                                                                                                                    "},{"location":"v3/configuration/#what-is-the-url-the-test-site","title":"What is the URL the test site?","text":"

                                                                                                                                                                                    In my example setup it's http://localhost:8080.

                                                                                                                                                                                    This is the full URL you would have to enter in the browser, on the machine that is running the tests, to reach the test WordPress site homepage.

                                                                                                                                                                                    "},{"location":"v3/configuration/#what-is-the-email-of-the-test-site-wordpress-administrator","title":"What is the email of the test site WordPress administrator?","text":"

                                                                                                                                                                                    In my example setup it's admin@wp.localhost.

                                                                                                                                                                                    This detail will be used by the WPLoader module to bootstrap WordPress and, while required, it's usually not relevant unless you're testing email communications.

                                                                                                                                                                                    "},{"location":"v3/configuration/#what-is-the-title-of-the-test-site","title":"What is the title of the test site?","text":"

                                                                                                                                                                                    In my example setup it's Acme Plugin Test Site.

                                                                                                                                                                                    This detail will be used by the WPLoader module to bootstrap WordPress and, while required, it's usually not relevant unless you're testing around the site title.

                                                                                                                                                                                    "},{"location":"v3/configuration/#what-is-the-login-of-the-administrator-user-of-the-test-site","title":"What is the login of the administrator user of the test site?","text":"

                                                                                                                                                                                    In my example setup it's admin.

                                                                                                                                                                                    This detail will be used by the WPBrowser or WPWebDriver modules to fill in the login details for the administrator user.

                                                                                                                                                                                    It should be the same as the one that allows you to access the site administration area in the WordPress test site, http://localhost:8080/wp-admin in my example.

                                                                                                                                                                                    "},{"location":"v3/configuration/#what-is-the-password-of-the-administrator-user-of-the-test-site","title":"What is the password of the administrator user of the test site?","text":"

                                                                                                                                                                                    In my example setup it's password.

                                                                                                                                                                                    This detail will be used by the WPBrowser or WPWebDriver modules to fill in the login details for the administrator user.

                                                                                                                                                                                    It should be the same as the one that allows you to access the site administration area in the WordPress test site, http://localhost:8080/wp-admin in my example.

                                                                                                                                                                                    "},{"location":"v3/configuration/#are-you-testing-a-plugin-a-theme-or-a-combination-of-both","title":"Are you testing a plugin, a theme or a combination of both?","text":"

                                                                                                                                                                                    Depending on the answer the WPLoader module will load, during integration or WordPress \"unit\" tests, your WordPress plugin or theme.

                                                                                                                                                                                    If you replied with both (for \"a combination of both\") then you'll be able to choose the plugins and theme to load in integration and WordPress \"unit\" tests in the following questions.

                                                                                                                                                                                    "},{"location":"v3/configuration/#what-is-the-folderpluginphp-name-of-the-plugin","title":"What is the folder/plugin.php name of the plugin?","text":"

                                                                                                                                                                                    This question will be asked only if you replied plugin to the question Are you testing a plugin, a theme or a combination of both?. In my example setup it's acme-plugin/plugin.php.

                                                                                                                                                                                    This is the <folder>/<main-plugin-file>.php path, relative to the WordPress installation plugins folder, to the plugin you are testing.

                                                                                                                                                                                    The main plugin file is the one that contains the plugin header.

                                                                                                                                                                                    This detail will be used by the WPLoader module to bootstrap WordPress and load your plugin or theme in integration and WordPress \"unit\" tests.

                                                                                                                                                                                    "},{"location":"v3/configuration/#are-you-developing-a-child-theme","title":"Are you developing a child theme?","text":"

                                                                                                                                                                                    This question will be asked only if you replied theme to the question Are you testing a plugin, a theme or a combination of both?. Enter yes if you are developing a child theme.

                                                                                                                                                                                    This detail will be used by the WPLoader module to bootstrap WordPress and load a parent theme along with your theme in integration and WordPress \"unit\" tests.

                                                                                                                                                                                    Please note that wp-browser will not download and install the parent theme in the WordPress installation for you.

                                                                                                                                                                                    "},{"location":"v3/configuration/#are-you-using-a-child-theme","title":"Are you using a child theme?","text":"

                                                                                                                                                                                    This question will be asked only if you replied both to the question Are you testing a plugin, a theme or a combination of both?. Enter yes if you are using a child theme.

                                                                                                                                                                                    This detail will be used by the WPLoader module to bootstrap WordPress and load a parent theme along with your theme in integration and WordPress \"unit\" tests.

                                                                                                                                                                                    Please note that wp-browser will not download and install the parent theme in the WordPress installation for you.

                                                                                                                                                                                    "},{"location":"v3/configuration/#what-is-the-slug-of-the-parent-theme","title":"What is the slug of the parent theme?","text":"

                                                                                                                                                                                    This question will be asked only if you replied yes to the question Are you developing a child theme?.

                                                                                                                                                                                    Reply with the slug of the parent theme, that's usually the name of the folder the parent theme lives in, e.g. twentyseventeen.

                                                                                                                                                                                    This detail will be used by the WPLoader module to bootstrap WordPress and load a parent theme along with your theme in integration and WordPress \"unit\" tests.

                                                                                                                                                                                    Please note that wp-browser will not download and install the parent theme in the WordPress installation for you.

                                                                                                                                                                                    "},{"location":"v3/configuration/#what-is-the-slug-of-the-theme","title":"What is the slug of the theme?","text":"

                                                                                                                                                                                    This question will be asked only if you replied theme to the question Are you testing a plugin, a theme or a combination of both?. Reply with the slug of the theme, that's usually the name of the folder the theme lives in, e.g. twentyseventeen.

                                                                                                                                                                                    This detail will be used by the WPLoader module to bootstrap WordPress and load your theme in integration and WordPress \"unit\" tests.

                                                                                                                                                                                    "},{"location":"v3/configuration/#what-is-the-slug-of-the-theme-you-are-using","title":"What is the slug of the theme you are using?","text":"

                                                                                                                                                                                    This question will be asked only if you replied both to the question Are you testing a plugin, a theme or a combination of both?. Reply with the slug of the theme you are using, that's usually the name of the folder the theme lives in, e.g. twentyseventeen.

                                                                                                                                                                                    This detail will be used by the WPLoader module to bootstrap WordPress and load the theme integration and WordPress \"unit\" tests.

                                                                                                                                                                                    "},{"location":"v3/configuration/#does-your-project-needs-additional-plugins-to-be-activated-to-work","title":"Does your project needs additional plugins to be activated to work?","text":"

                                                                                                                                                                                    Whether you're testing a plugin, a theme or a combination of both you might need some additional plugins to run your tests.

                                                                                                                                                                                    As an example if I'm testing a WooCommerce extension I need the WooCommerce plugin to test it; this is the place where I can define it.

                                                                                                                                                                                    The required plugins follow the same format as the one used in the question What is the folder/plugin.php name of the plugin?: <plugin-folder>/<plugin-main-file>.php; in the case of WooCommerce it would be woocommerce/woocommerce.php.

                                                                                                                                                                                    This detail will be used by the WPLoader module to bootstrap WordPress and load the required plugins in integration and WordPress \"unit\" tests.

                                                                                                                                                                                    Please note that wp-browser will not download and install the required plugins in the WordPress installation for you.

                                                                                                                                                                                    "},{"location":"v3/configuration/#if-you-entered-a-wrong-value","title":"If you entered a wrong value","text":"

                                                                                                                                                                                    No worries, just correct the value in the environment file or in the suites configuration files.

                                                                                                                                                                                    The environment file will have the name you specified in the answer the question How would you like to call the env configuration file?.

                                                                                                                                                                                    The suites configuration files can be found in tests/<suite>.suite.yml; e.g. the wpunit suite configuration file will be tests/wpunit.suite.yml file.

                                                                                                                                                                                    "},{"location":"v3/configuration/#final-steps","title":"Final steps","text":"

                                                                                                                                                                                    To complete the setup I have removed any demo content from the site and activated my plugin in the plugins administration page.

                                                                                                                                                                                    In the tests/acceptance.suite.yml file and in the tests/functional.suite.yml file, the configuration file for the acceptance and functional suites respectively, the WPDb module configuration contains a dump configuration parameter:

                                                                                                                                                                                    class_name: AcceptanceTester\nmodules:\nenabled:\n- WPDb\nconfig:\nWPDb:\ndump: 'tests/_data/dump.sql'\n

                                                                                                                                                                                    The dump parameter is inherited by the WPDb module from the Codeception Db module and defines the SQL dump file that should be loaded before, and between, tests to reset the testing environment to a base known state.

                                                                                                                                                                                    As for any other database-related operation wp-browser will not create the dump for me. I use MySQL binary to export the database state (a dump) with the command:

                                                                                                                                                                                    mysqldump -u root -h 127.0.0.1 -P 3306 wordpress > /Users/luca/Sites/wordpress/wp-content/plugins/acme-plugin/tests/_data/dump.sql\n

                                                                                                                                                                                    I could use any other combination of tools to produce the dump; using mysql binary is not a requirement.

                                                                                                                                                                                    Graphic interfaces like SequelPro, Adminer and the like would be perfectly fine.

                                                                                                                                                                                    "},{"location":"v3/configuration/#pre-flight-check","title":"Pre-flight check","text":"

                                                                                                                                                                                    There is one last check I need to make before jumping into the creation of tests: making sure all the paths and credentials I've configured wp-browser with are correct.

                                                                                                                                                                                    The bootstrap process generated four suites for me: acceptance, functional, integration and unit. If you have modified the default suite names during the setup your suites names might differ though.

                                                                                                                                                                                    To test the setup I will run each suite and make sure it can run correctly empty of any test. To run a suite of tests I will use the codecept run command:

                                                                                                                                                                                    codecept run acceptance\ncodecept run functional\ncodecept run integration\ncodecept run unit\n

                                                                                                                                                                                    How comes I'm not using the command codecept run (without specifying the suite names)? See the FAQ entry.

                                                                                                                                                                                    If you cannot run all the suites without issues then check your configuration settings again, read the errors and see If you entered a wrong value

                                                                                                                                                                                    "},{"location":"v3/events-api/","title":"Events API","text":"

                                                                                                                                                                                    This is the documentation for version 3 of the project. The current version is version 4 and the documentation can be found here.

                                                                                                                                                                                    "},{"location":"v3/events-api/#events-api","title":"Events API","text":"

                                                                                                                                                                                    Codeception comes with a set of events modules and extensions can subscribe to.

                                                                                                                                                                                    Codeception Events API is, but, only available to Modules and Extensions, and while that might be good for most cases, it might not cover a number of edge cases.

                                                                                                                                                                                    Similarly to WordPress add_action function, wp-browser provides the tad\\WPBrowser\\addListener function:

                                                                                                                                                                                    function addListener($eventName, callable $listener, $priority = 0);\n

                                                                                                                                                                                    The priority works the reverse way as it does in WordPress: highest number will be processed first!

                                                                                                                                                                                    Again similarly to WordPress do_action function, the tad\\WPBrowser\\dispatch function:

                                                                                                                                                                                    function dispatch($eventName, $origin = null, array $context = []);\n

                                                                                                                                                                                    This is the kind of API that is better shown with an example, though.

                                                                                                                                                                                    "},{"location":"v3/events-api/#example","title":"Example","text":"

                                                                                                                                                                                    In this example I'm writing acceptance tests and would like to avoid the performance hit that the cleanup configuration parameter of the Db, or WPDb, module implies. The cleanup parameter will trigger the drop of all tables in the test database and the re-import of the SQL dump file, or files, between each test. This will ensure a clean starting fixture between tests, but for larger setup fixtures this might be a long operation that wastes precious seconds when, say, the only change is the addition of 3 posts, as in this example.

                                                                                                                                                                                    The Events API allows implementing a tailored clean-up procedure that can avoid costly clean ups between tests.

                                                                                                                                                                                    In the suite bootstrap file, e.g. tests/acceptance/_bootstrap.php, I add a listener on the my-plugin-test/setup-posts event. The event will contain information about what post IDs I've set up in the tests and will provide an instance of the tester object to handle database manipulation. With that information, the costly cleanup procedure can be avoided.

                                                                                                                                                                                    <?php\n$registerPostsCleanup = static function (tad\\WPBrowser\\Events\\WpbrowserEvent $event) {\n$ids = $event->get('ids', []);\n/** @var \\EventsTester $db */\n$db = $event->get('db');\n// When tests are done, then remove all the posts we've created at the start of the test, if any.\ntad\\WPBrowser\\addListener(\nCodeception\\Events::TEST_AFTER,\nstatic function () use ($ids, $db) {\nforeach ($ids as $id) {\n$db->dontHavePostInDatabase([ 'ID' => $id ], true);\n// Ensure the clean up did happen correctly.\n$db->dontSeePostInDatabase([ 'ID' => $id ]);\n$db->dontSeePostMetaInDatabase([ 'post_id' => $id ]);\n}\n}\n);\n};\n// Listen for this event to register the posts to remove, along with their custom fields, after the test.\ntad\\WPBrowser\\addListener('test-event-1/setup-posts', $registerPostsCleanup);\n

                                                                                                                                                                                    In this simple test I'm adding 3 posts [using the factory provided by the WPLoader module in loadOnly mode][2] and want to make sure those, and the relative meta, are removed at the end of the tests. The WPDb module, extending the Db module from Codeception, will remove the inserted rows, but will not take care of modified rows, or rows not inserted by the WPDb module.

                                                                                                                                                                                    Mirroring the requirement of the clean up function I've defined above, I'm passing the post IDs of the posts I've created and the current tester to provide the clean up function with database handling capabilities.

                                                                                                                                                                                    <?php\n/** @var Codeception\\Scenario $scenario */\n$I = new AcceptanceTester($scenario);\n$I->wantTo('add posts and clean them up using the Events API');\n/*\n * Use WordPress methods, thanks to the `WPLoader` module, to use WordPress, or our own, API to insert posts.\n * This will prevent, but, `WPDb` from removing the inserted rows and clean up, so we remove the posts and meta\n * with an event and our custom clean-up function.\n */\n$ids = $I->factory()->post->create_many(3, [ 'post_type' => 'some_post_type' ]);\ntad\\WPBrowser\\dispatch('test-event-1/setup-posts', __FILE__, [\n'ids' => $ids,\n'db'  => $I\n]);\n
                                                                                                                                                                                    "},{"location":"v3/extensions/","title":"Extensions","text":"

                                                                                                                                                                                    This is the documentation for version 3 of the project. The current version is version 4 and the documentation can be found here.

                                                                                                                                                                                    "},{"location":"v3/extensions/#extensions","title":"Extensions","text":"

                                                                                                                                                                                    The Codeception testing framework can be extended in a number of ways.

                                                                                                                                                                                    The one this project leverages the most are modules but [extensions are another way].

                                                                                                                                                                                    Modules extend the functionality of Codeception in the context of the tests, while extensions extend its interaction capacities; this is by no means a strict rule but that's usually the case.

                                                                                                                                                                                    The package contains two additional extensions to facilitate testers' life.

                                                                                                                                                                                    "},{"location":"v3/extensions/#symlinker","title":"Symlinker","text":"

                                                                                                                                                                                    The tad\\WPBrowser\\Extension\\Symlinker extension provides an automation to have the Codeception root directory symbolically linked in a WordPress local installation.

                                                                                                                                                                                    Since version 3.9 WordPress supports this feature (with some precautions) and the extension takes charge of:

                                                                                                                                                                                    • symbolically linking a plugin or theme folder in the specified destination before any suite boots up
                                                                                                                                                                                    • unlinking that symbolic link after all of the suites did run

                                                                                                                                                                                    It's the equivalent of doing something like this from the command line (on a Mac):

                                                                                                                                                                                    ln -s /my/central/plugin/folder/my-plugin /my/local/wordpress/installation/wp-content/plugins/my-plugin\n/my/central/plugin/folder/my-plugin/vendor/bin/codecept run\nrm -rf /my/local/wordpress/installation/wp-content/plugins/my-plugin\n

                                                                                                                                                                                    The extension needs small configuration in the codeception.yml file:

                                                                                                                                                                                    extensions:\nenabled:\n- tad\\WPBrowser\\Extension\\Symlinker\nconfig:\ntad\\WPBrowser\\Extension\\Symlinker:\nmode: plugin\ndestination: /my/local/wordpress/installation/wp-content/plugins\nrootFolder: /some/plugin/folder\n

                                                                                                                                                                                    The arguments are:

                                                                                                                                                                                    • mode - can be plugin or theme and indicates whether the current Codeception root folder being symlinked is a plugin or a theme one
                                                                                                                                                                                    • destination - the absolute path to the WordPress local installation plugins or themes folder; to take the never ending variety of possible setups into account the extension will make no checks on the nature of the destination: could be any folder.
                                                                                                                                                                                    • rootFolder - optional absolute path to the WordPress plugin or theme to be symlinked root folder; will default to the Codeception root folder
                                                                                                                                                                                    "},{"location":"v3/extensions/#copier","title":"Copier","text":"

                                                                                                                                                                                    The tad\\WPBrowser\\Extension\\Copier extension provides an automation to have specific files and folders copied to specified destination files and folders before the suites run.

                                                                                                                                                                                    While WordPress handles symbolic linking pretty well there are some cases, like themes and drop-ins, where there is a need for \"real\" files to be put in place.

                                                                                                                                                                                    One of such cases is, currently, one where Docker is used to to host and serve the code under test: symbolically linked files cannot be bound inside a container and Docker containers will fail to start in this case.

                                                                                                                                                                                    The extension follows the standard Codeception extension activation and has one configuration parameter only:

                                                                                                                                                                                    extensions:\nenabled:\n- tad\\WPBrowser\\Extension\\Copier\nconfig:\ntad\\WPBrowser\\Extension\\Copier:\nfiles:\ntests/_data/required-drop-in.php: /var/www/wordpress/wp-content/drop-in.php\ntests/_data/themes/dummy: /var/www/wordpress/wp-content/themes/dummy\n/Users/Me/Repos/required-plugin: /var/www/wordpress/wp-content/plugins/required-plugin.php\n/Users/Me/Repos/mu-plugin.php: ../../../../wp-content/mu-plugins/mu-plugin.php\n

                                                                                                                                                                                    The extension will handle absolute and relative paths for sources and destinations and will resolve relative paths from the project root folder.

                                                                                                                                                                                    When copying directories the extension will only create the destination folder and not the folder tree required; in the example configuration above the last entry specifies that a mu-plugin.php file should be copied to the mu-plugins folder: that mu-plugins folder must be there already.

                                                                                                                                                                                    "},{"location":"v3/extensions/#environments-support","title":"Environments support","text":"

                                                                                                                                                                                    Being able to symlink a plugin or theme folder into a WordPress installation for testing purposes could make sense when trying to test, as an example, a plugin in a single site and in multi site environment.

                                                                                                                                                                                    Codeception supports environments and the extension does as well specifying a destination for each.

                                                                                                                                                                                    As an example the acceptance.suite.yml file might be configured to support single and multisite environments:

                                                                                                                                                                                    env:\nsingle:\nmodules:\nconfig:\nWPBrowser:\nurl: 'http://wp.dev'\nWPDb:\ndsn: 'mysql:host=127.0.0.1;dbname=wp'\nmultisite:\nmodules:\nconfig:\nWPBrowser:\nurl: 'http://mu.dev'\nWPDb:\ndsn: 'mysql:host=127.0.0.1;dbname=mu'\n

                                                                                                                                                                                    In the codeception.yml file specifying a destination for each supported environment will tell the extension to symbolically link the plugin or theme file to different locations according to the current environment:

                                                                                                                                                                                    extensions:\nenabled:\n- tad\\WPBrowser\\Extension\\Symlinker\nconfig:\ntad\\WPBrowser\\Extension\\Symlinker:\nmode: plugin\ndestination:\nsingle: /var/www/wp/wp-content/plugins\nmultisite: /var/www/mu/wp-content/plugins\n

                                                                                                                                                                                    If no destination is specified for the current environment the extension will fallback to the first specified one.

                                                                                                                                                                                    A default destination can be specified to override this behaviour.

                                                                                                                                                                                    extensions:\nenabled:\n- tad\\WPBrowser\\Extension\\Symlinker\nconfig:\ntad\\WPBrowser\\Extension\\Symlinker:\nmode: plugin\ndestination:\ndefault: /var/www/default/wp-content/plugins\nsingle: /var/www/wp/wp-content/plugins\nmultisite: /var/www/mu/wp-content/plugins\n

                                                                                                                                                                                    When running a suite specifying more than one environment like

                                                                                                                                                                                    codecept run acceptance --env foo,baz,multisite\n

                                                                                                                                                                                    Then the extension will use the first matched one, in the case above the multisite destination will be used.

                                                                                                                                                                                    The rootFolder parameter too can be set to be environment-aware and it will follow the same logic as the destination:

                                                                                                                                                                                    extensions:\nenabled:\n- tad\\WPBrowser\\Extension\\Symlinker\nconfig:\ntad\\WPBrowser\\Extension\\Symlinker:\nmode: plugin\nrootFolder:\ndev: /\ndist: /dist\ndefault: /\ndestination:\ndefault: /var/www/dev/wp-content/plugins\ndev: /var/www/dev/wp-content/plugins\ndist: /var/www/dist/wp-content/plugins\n

                                                                                                                                                                                    When running a suite specifying more than one environment like

                                                                                                                                                                                    codecept run acceptance --env dist\n

                                                                                                                                                                                    Then the extension will symlink the files from /dist into the /var/www/dist/wp-content/plugins folder.

                                                                                                                                                                                    "},{"location":"v3/extensions/#events","title":"Events","text":"

                                                                                                                                                                                    Due to some internal changes in Codeception 4.0, the internal API (really a collection of low-level hacks on my part) that allowed wp-browser to dispatch, and listen for, events in the modules has been removed.

                                                                                                                                                                                    If you want to leverage [the event system wp-browser provides] with Codeception default events (e.g. suite.init or test.before), then you will need to use this extension.

                                                                                                                                                                                    You will not need this extension if you're not using Codeception version 4.0.

                                                                                                                                                                                    You will need to enable it in your Codeception main configuration file (e.g. codeception.dist.yml).

                                                                                                                                                                                    extensions:\nenabled:\n- tad\\WPBrowser\\Extension\\Events\nconfig:\ntad\\WPBrowser\\Extension\\Events:\nsuites: ['acceptance']\n

                                                                                                                                                                                    The extension only configuration is the suites parameter that allows specifying the suites the extension should apply to. If the suites parameter is not specified, then the extension will apply to all suites.

                                                                                                                                                                                    "},{"location":"v3/faq/","title":"Frequently asked questions","text":"

                                                                                                                                                                                    This is the documentation for version 3 of the project. The current version is version 4 and the documentation can be found here.

                                                                                                                                                                                    "},{"location":"v3/faq/#some-common-questions","title":"Some common questions","text":"

                                                                                                                                                                                    There are questions I keep receiving via email, GitHub or in person at conferences.

                                                                                                                                                                                    I tried to address some of them here.

                                                                                                                                                                                    "},{"location":"v3/faq/#is-codeceptionwp-browser-php-52-compatible","title":"Is Codeception/wp-browser PHP 5.2 compatible?","text":"

                                                                                                                                                                                    No, Codeception, and wp-browser by extension, will require PHP 5.6 minimum.

                                                                                                                                                                                    This does not mean your code cannot be PHP 5.2 compatible: you can test your code using all the possibilities of newer PHP versions and still keep it PHP 5.2 compatible.

                                                                                                                                                                                    Just because you can doesn't mean you should though: this documentation will assume a minimum PHP version, for the example and test code, of PHP 5.6.

                                                                                                                                                                                    "},{"location":"v3/faq/#can-i-run-unit-tests-with-wp-browsercodeception","title":"Can I run unit tests with wp-browser/Codeception?","text":"

                                                                                                                                                                                    Yes, with some distinctions.

                                                                                                                                                                                    In the WordPress ecosystem there's a tendency to call any kind of test a \"unit test\". Under that definition will fall tests that are not \"unit\" tests at all.

                                                                                                                                                                                    Without drowning into a long and painful battle for definitions this guide will use the following definitions for different levels of testing.

                                                                                                                                                                                    The next section will detail the conventions this documentation uses to define different levels of testing in more detail.

                                                                                                                                                                                    "},{"location":"v3/faq/#isnt-wordpress-untestable","title":"Isn't WordPress untestable?","text":"

                                                                                                                                                                                    No; it's sometimes difficult to test and not as straightforward as other PHP frameworks but it's definitely not untestable.

                                                                                                                                                                                    You are writing code that runs on WordPress, not the Core code for WordPress so the question should really be: will you write testable code?

                                                                                                                                                                                    It's up to you to decide at what level you want to make your code testable and how much you want to test it.

                                                                                                                                                                                    "},{"location":"v3/faq/#do-i-need-to-use-a-specific-local-development-environment-to-use-wp-browser","title":"Do I need to use a specific local development environment to use wp-browser?","text":"

                                                                                                                                                                                    No. I've started using wp-browser on a vanilla PHP built-in server to, then, move to MAMP (or XAMP) and, from there, to other solutions.

                                                                                                                                                                                    I've configured and used wp-browser on Docker, Vagrant, VVV, Valet and various CI solutions.

                                                                                                                                                                                    To this day I keep using different setups on different machines and personally prefer Docker for its portability.

                                                                                                                                                                                    "},{"location":"v3/faq/#can-i-only-test-plugins-with-wp-browser","title":"Can I only test plugins with wp-browser?","text":"

                                                                                                                                                                                    No, you can test any kind of WordPress application.

                                                                                                                                                                                    With \"application\" I mean any PHP software built on top of WordPress: plugins, themes, whole sites.

                                                                                                                                                                                    "},{"location":"v3/faq/#if-im-testing-a-site-do-i-have-to-use-the-default-wordpress-file-structure","title":"If I'm testing a site do I have to use the default WordPress file structure?","text":"

                                                                                                                                                                                    No, you can use any file structure you want.

                                                                                                                                                                                    Some wp-browser modules will need a little help to find your code but, so far, I've never been unable to set it up.

                                                                                                                                                                                    "},{"location":"v3/faq/#can-i-use-wp-browser-even-if-my-wordpress-application-doesnt-use-composer","title":"Can I use wp-browser even if my WordPress application doesn't use Composer?","text":"

                                                                                                                                                                                    Yes, although wp-browser, as a development tool, cannot be installed without Composer.

                                                                                                                                                                                    "},{"location":"v3/faq/#should-i-use-wp-browser-to-test-my-production-servers","title":"Should I use wp-browser to test my production servers?","text":"

                                                                                                                                                                                    No. Unless you know very well what you're doing that's a dangerous idea that might leave you with a broken site and an empty database.

                                                                                                                                                                                    As almost any testing tool, wp-browser should be used locally on local installations of WordPress that do not contain any valuable information.

                                                                                                                                                                                    "},{"location":"v3/faq/#how-can-i-avoid-the-wpdb-module-from-replacing-the-contents-of-my-database","title":"How can I avoid the WPDb module from replacing the contents of my database?","text":"

                                                                                                                                                                                    You should always backup any database that contains any information you care about before running any test.

                                                                                                                                                                                    You can read the answer to this question in the WPDb module documentation.

                                                                                                                                                                                    "},{"location":"v3/faq/#can-i-run-all-my-tests-with-one-command","title":"Can I run all my tests with one command?","text":"

                                                                                                                                                                                    Theoretically: yes, in practice: no.

                                                                                                                                                                                    When you use codecept run Codeception will run all the tests from all the suites.

                                                                                                                                                                                    This, done in the context of other frameworks, will generally not create any problem but, in the context of WordPress it will.

                                                                                                                                                                                    While handling a single HTTP request WordPress will set, and use, a number of constants and globals and, likewise, will do plugins and themes that follow WordPress standards.

                                                                                                                                                                                    This means that the global context (variable scope) will be left \"dirty\" and contain \"left-over\" constants and globals from the previous tests.

                                                                                                                                                                                    An example is one where a test for the handling of Ajax requests sets the DOING_AJAX constant: this will be now set for any test after the one that set it thus breaking, or worse altering, all the following ones.

                                                                                                                                                                                    So, in short, run each suite separately.

                                                                                                                                                                                    "},{"location":"v3/faq/#can-i-have-more-than-one-suite-of-one-kind","title":"Can I have more than one suite of one kind?","text":"

                                                                                                                                                                                    Yes, you should.

                                                                                                                                                                                    As an example you might have a frontend suite running acceptance tests on the site frontend and a backend suite running acceptance tests on the site backend.

                                                                                                                                                                                    Think of suites as a tool to organize your tests: there's a good measure between too organized and not organized at all.

                                                                                                                                                                                    "},{"location":"v3/faq/#ive-used-phpunit-before-for-my-unit-tests-can-i-reuse-that-knowledge-and-code-with-wp-browser","title":"I've used PHPUnit before for my unit tests, can I reuse that knowledge and code with wp-browser?","text":"

                                                                                                                                                                                    Yes.

                                                                                                                                                                                    Codeception uses PHPUnit as one of its main components and can run PHPUnit tests with little or no modification.

                                                                                                                                                                                    As such you can just move your existing PHPUnit tests in a dedicated suite and be ready to run in minutes.

                                                                                                                                                                                    "},{"location":"v3/faq/#ive-already-set-up-my-tests-to-run-using-the-core-phpunit-based-test-suite-can-i-keep-using-my-tests","title":"I've already set up my tests to run using the Core PHPUnit-based test suite, can I keep using my tests?","text":"

                                                                                                                                                                                    Yes.

                                                                                                                                                                                    Codeception uses PHPUnit as one of its main components and can run PHPUnit tests with little or no modification.

                                                                                                                                                                                    One of the goals of wp-browser was to make it easier to test WordPress application at an integration level (or \"WordPress unit\" level).

                                                                                                                                                                                    As such migrating those tests could be a matter of minutes requiring no modification to the tests if not for moving some files and creating a dedicated suite.

                                                                                                                                                                                    "},{"location":"v3/faq/#why-is-the-project-called-wp-browser","title":"Why is the project called wp-browser?","text":"

                                                                                                                                                                                    When I started working with Codeception to run my acceptance tests I kept creating steps that I would reuse over and over in my projects.

                                                                                                                                                                                    I packed them in a module extending the PHPBrowser module.

                                                                                                                                                                                    Being a natural talent in naming things I've called the module WPBrowser and published it. As I started relying on Codeception more and more I kept adding modules but the name remained.

                                                                                                                                                                                    "},{"location":"v3/installation/","title":"Installation","text":"

                                                                                                                                                                                    This is the documentation for version 3 of the project. The current version is version 4 and the documentation can be found here.

                                                                                                                                                                                    "},{"location":"v3/installation/#installation","title":"Installation","text":""},{"location":"v3/installation/#where-should-i-install-wp-browser","title":"Where should I install wp-browser?","text":"

                                                                                                                                                                                    As a rule-of-thumb wp-browser should be installed in the root folder of your project.

                                                                                                                                                                                    If your project is a plugin then it should be installed in the root folder of your plugin; if your project is a theme it should be installed in the root folder of your theme.

                                                                                                                                                                                    If your project is a site I'd, personally install it in the site root folder.

                                                                                                                                                                                    The purpose of installing wp-browser in the root folder of a project is to keep the code and its tests under version control together.

                                                                                                                                                                                    Exceptions apply but, for most projects, that's what I would do.

                                                                                                                                                                                    "},{"location":"v3/installation/#initializing-the-composer-project","title":"Initializing the Composer project","text":"

                                                                                                                                                                                    Since Composer is a requirement of wp-browser and the only way to install it you should, first thing, initialize the Composer project.

                                                                                                                                                                                    If you've already initialized the Composer project you can skip this section.

                                                                                                                                                                                    Once you've decided where to install wp-browser navigate to that folder using the terminal and type:

                                                                                                                                                                                    composer init\n

                                                                                                                                                                                    Composer will take you through a number of questions to setup some meta information about your project.

                                                                                                                                                                                    Do not install any dependency yet when asked (unless you know what you're doing) and, as a suggestion, set wordpress-plugin as \"Package Type\".

                                                                                                                                                                                    Also, since WordPress is licensed under the GPL-2.0+ you might want to set the \"License\" of your project to GPL-2.0-or-later.

                                                                                                                                                                                    "},{"location":"v3/installation/#installing-wp-browser-as-a-development-dependency","title":"Installing wp-browser as a development dependency","text":"

                                                                                                                                                                                    Once you've initialized the Composer project it's time to require wp-browser ; you can read more about the usage of the require command on the Composer documentation.

                                                                                                                                                                                    wp-browser is a testing tool and, as such, should be installed as a project development dependency, not as a normal (production) one.

                                                                                                                                                                                    From the terminal type:

                                                                                                                                                                                    composer require --dev lucatume/wp-browser\n

                                                                                                                                                                                    This will install the latest stable version of wp-browser and, along with it, Codeception and PHPUnit in the vendor folder of your project.

                                                                                                                                                                                    Once that's done it's time to move to the setup and configuration of wp-browser.

                                                                                                                                                                                    "},{"location":"v3/levels-of-testing/","title":"Levels of testing","text":"

                                                                                                                                                                                    This is the documentation for version 3 of the project. The current version is version 4 and the documentation can be found here.

                                                                                                                                                                                    "},{"location":"v3/levels-of-testing/#what-is-a-unit-test-an-acceptance-test","title":"What is a unit test? An acceptance test?","text":"

                                                                                                                                                                                    This page has no pretense to be THE source of truth about what is called how in the context of tests; the purpose of this page is to lay out the terminology that I'll use in the documentation to define the levels and component of testing. Wikipedia, forums and other documents online will offer alternate, and equally valid, definitions.

                                                                                                                                                                                    "},{"location":"v3/levels-of-testing/#the-signup-page-example","title":"The signup page example","text":"

                                                                                                                                                                                    Let's assume I'm testing a WordPress plugin that adds mailing list management and subscription functionalities to a site.

                                                                                                                                                                                    The plugin provides a number of functions and, among them, it will add a sign-up page to receive users applications.

                                                                                                                                                                                    "},{"location":"v3/levels-of-testing/#acceptance-tests","title":"Acceptance tests","text":"

                                                                                                                                                                                    In brief: make assertions as a user would.

                                                                                                                                                                                    The user might be tech-savvy as much as I want her to be but still make assertions only on what feedback the site provides.

                                                                                                                                                                                    The code below tests a user can subscribe to the mailing list:

                                                                                                                                                                                    <?php\n// UserSuccessfulSignupTest.php\n// Add a page that contains the shortcode that will render the signup form.\n$I->havePageInDatabase( [\n'post_name' => 'signup',\n'post_content'=> 'Sign-up for our awesome thing! [signup]',\n] );\n// Go to the page.\n$I->amOnPage( '/signup' );\n// Submit the form as a user would submit it. \n$I->submitForm( '#signup-form', [\n'name' => 'Luca',\n'email' => 'luca@theAverageDev.com',\n] );\n// Make sure I see a confirmation message. \n$I->waitForElement( '#signup-confirmation' );\n
                                                                                                                                                                                    "},{"location":"v3/levels-of-testing/#functional-tests","title":"Functional tests","text":"

                                                                                                                                                                                    In brief: make assertions as a developer would.

                                                                                                                                                                                    The test code below asserts front-end submissions are correctly processed from the developer perspective:

                                                                                                                                                                                    <?php\n// file tests/functional/SignupSubmissionCest.php\nclass SignupSubmissionCest {\npublic function _before( FunctionalTester $I ) {\n// Add a page that contains the shortcode that will render the signup form.\n$I->havePageInDatabase( [\n'post_name' => 'signup',\n'post_content'=> 'Sign-up for our awesome thing! [signup]',\n] );\n$I->amOnPage( '/signup' );\n}\npublic function test_good_signup( FunctionalTester $I ) {\n$I->sendAjaxPostRequest( '/wp-json/acme/v1/signup', [\n'_wpnonce' => $I->grabAttributeFrom( '#signup-nonce', 'value' ),\n'name' => 'Luca',\n'email' => 'luca@theAverageDev.com',\n] );\n$I->seeResponseCodeIsSuccessful();\n$I->seeUserInDatabase( [ 'user_login' => 'luca', 'user_email' => 'luca@theaveragedev.com' ] );\n}\npublic function test_bad_email_signup( FunctionalTester $I ) {\n$I->sendAjaxPostRequest( '/wp-json/acme/v1/signup', [\n'_wpnonce' => $I->grabAttributeFrom( '#signup-nonce', 'value' ),\n'name' => 'Luca',\n'email' => 'not-really-an-email',\n] );\n$I->seeResponseCodeIs( 400 );\n$I->dontSeeUserInDatabase( [ 'user_login' => 'luca', 'user_email' => 'not-really-an-email' ] );\n}\n}\n

                                                                                                                                                                                    The code looks, initially, like an acceptance test, but differs in its action and assertion phase: in place of filling a form and clicking \"Submit\" it sends a POST request to a REST API endpoint and checks the effect of the submission in the database.

                                                                                                                                                                                    All of these actions fall squarely into what a developer would do, not into what a user could/should be able to do.

                                                                                                                                                                                    Furthermore, the format of the test is not the same as the one used in the acceptance test.

                                                                                                                                                                                    The acceptance test is written in the most eloquent testing format supported by Codeception, the Cept format, this test uses a more PHPUnit-like format, the Cest format.

                                                                                                                                                                                    While the first is easier to skim for non-developers the second harnesses the power of a re-using pieces of code, the page creation and navigation in the example, to optimize the test code.

                                                                                                                                                                                    "},{"location":"v3/levels-of-testing/#integration-tests","title":"Integration tests","text":"

                                                                                                                                                                                    In brief: test code modules in the context of a WordPress website.

                                                                                                                                                                                    In this type of test the WordPress, and additional plugins code, is loaded in the same variable scope as the tests; this is why in the example below I'm using classes (WP_REST_Request, WP_REST_Response) and methods (register_rest_route) defined by WordPress, not the plugin code.

                                                                                                                                                                                    The REST API request sent by the application form will be handled by a class, Acme\\Signup\\SubmissionHandler, that's been attached to the /wp-json/acme/v1/signup path:

                                                                                                                                                                                    <?php\n// file src/rest.php\nadd_action( 'rest_api_init', function () {\nregister_rest_route( 'acme/v1', '/signup', array(\n'methods' => 'POST',\n'callback' => function( WP_Rest_Request $request ) {\n$email_validator = new Acme\\Signup\\EmailValidator();\n$handler = new Acme\\Signup\\SubmissionHandler( $email_validator );\nreturn $handler->handle( $request );\n},\n) );\n} );\n

                                                                                                                                                                                    I want to test the chain of classes and methods that's handling such a request in the context of a WordPress installation.

                                                                                                                                                                                    Integration is usually about testing \"modules\" of code: groups of classes and functions working together to provide a service or complete a task.

                                                                                                                                                                                    In the context of integration testing the class dependencies and/or the context are not mocked.

                                                                                                                                                                                    <?php\n// file tests/integration/SubmissionHandlingTest.php\nclass SubmissionHandlingTest extends \\Codeception\\TestCase\\WPTestCase {\npublic function test_good_request() {\n$request = new WP_Rest_Request();\n$request->set_body_params( [ 'name' => 'luca', 'email' => 'luca@theaveragedev.com' ] );\n$handler = new  Acme\\Signup\\SubmissionHandler();\n$response = $handler->handle( $request );\n$this->assertIntsanceOf( WP_REST_Response::class, $response );\n$this->assertEquals( 200, $response->get_status() );\n$this->assertInstanceOf( Acme\\Signup\\Submission_Good::class, $handler->last_submission() );\n$this->assertEquals( 'luca', $handler->last_submission()->name() );\n$this->assertEquals( 'luca@theaveragedev.com', $handler->last_submission()->email() );\n}\npublic function test_bad_email_request() {\n$request = new WP_Rest_Request();\n$request->set_body_params( [ 'name' => 'luca', 'email' => 'not-a-valid-email' ] );\n$handler = new  Acme\\Signup\\SubmissionHandler();\n$response = $handler->handle( $request );\n$this->assertIntsanceOf( WP_REST_Response::class, $response );\n$this->assertEquals( 400, $response->get_status() );\n$this->assertInstanceOf( Acme\\Signup\\Submission_Bad::class, $handler->last_submission() );\n$this->assertEquals( 'luca', $handler->last_submission()->name() );\n$this->assertEquals( 'not-a-valid-email', $handler->last_submission()->email() );\n}\n}\n

                                                                                                                                                                                    The test format used is the familiar PhpUnit one; the only difference is the base test class that's being extended (\\Codeception\\TestCase\\WPTestCase) is one provided by wp-browser.

                                                                                                                                                                                    In the context of WordPress \"integration\" might also mean testing that filters used by the code have the expected effect.

                                                                                                                                                                                    "},{"location":"v3/levels-of-testing/#unit-tests","title":"Unit tests","text":"

                                                                                                                                                                                    In brief: test single classes or functions in isolation.

                                                                                                                                                                                    The email address is validated by the Acme\\Signup\\EmailValidator class.

                                                                                                                                                                                    In the test code below I want to make sure the validation works as intended.

                                                                                                                                                                                    <?php\n// file tests/unit/EmailValidatorTest.php\nclass EmailValidatorTest extends Codeception\\Test\\Test {\npublic function test_good_email_validation() {\n$validator = new Acme\\Signup\\EmailValidator();\n$this->assertTrue( $validator->validate( 'luca@theaveragedev.com' ) ); \n}\npublic function test_bad_email_validation(){\n$validator = new Acme\\Signup\\EmailValidator();\n$this->assertTrue( $validator->validate( 'not-an-email' ) );\n}\npublic function test_tricky_email_validation() {\n$validator = new Acme\\Signup\\EmailValidator();\n$this->assertTrue( $validator->validate( 'luca+signup@theaveragedev.com' ) ); \n}\npublic function test_validation_with_service(){\n// Stub the validation service.\n$validation_service = $this->prophesize( Acme\\Signup\\ValidationService::class );\n$validation_service->validate( 'luca@theaveragedev.com' )->willReturn( true );\n$validation_service->validate( 'lucas@theaveragedev.com' )->willReturn( false );\n// Build the validator and set it to use the mock validation service.\n$validator = new Acme\\Signup\\EmailValidator();\n$validator->use_service( $validation_service->reveal() );\n$this->assertTrue( $validator->validate( 'luca@theaveragedev.com' ) );\n$this->assertFalse( $validator->validate( 'lucas@theaveragedev.com' ) );\n}\n}\n

                                                                                                                                                                                    Unit tests is where stubbing/mocking/spying of dependencies is used to gain total control over the input and context the class is using.

                                                                                                                                                                                    In the last test method I'm doing exactly that testing the email validator with an external validation service.

                                                                                                                                                                                    In the example I'm using the Prophecy mock engine that comes with PHPUnit along with its own mocking/stubbing/spying solutions.

                                                                                                                                                                                    There are other mocking engines (e.g Mockery) that could be used.

                                                                                                                                                                                    "},{"location":"v3/levels-of-testing/#wordpress-unit-tests","title":"WordPress \"unit\" tests","text":"

                                                                                                                                                                                    In brief: test single classes or functions that require WordPress code in as much isolation as possible.

                                                                                                                                                                                    This is what most people referring to \"unit tests\" in the context of WordPress is talking about.

                                                                                                                                                                                    The purpose of this kind of tests is to test one class of a WordPress application, or one function, that requires a WordPress-defined function or class with a unit testing approach.

                                                                                                                                                                                    In the example below I'm testing the Acme\\Signup\\SubmissionHandler class on a \"unit\" level making sure it will mark a request as bad if the email is not a valid one.

                                                                                                                                                                                    <?php\n// file tests/unit/SubmissionHandlerTest.php\nclass SubmissionHandlerTest extends Codeception\\Test\\Test {\nprotected  $request;\nprotected $validator;\npublic function setUp() {\n// Mock the request.\n$this->request = $this->prophesize( WP_REST_Request::class );\n// Spy on the validator.\n$this->validator = $this->prophesize( Acme\\Signup\\EmailValidator::class );\n}\npublic function test_email_is_validated_by_default() {\n$this->request->get_param( 'name' )->willReturn( 'luca' );\n$this->request->get_param( 'email' )->willReturn( 'luca@theaveragedev.com' );\n$handler = new Acme\\Signup\\SubmissionHandler( $this->validator->reveal() );\n$handler->set_validator( $this->validator );\n$response = $handler->handle( $this->request->reveal() );\n$this->assertInstanceOf( WP_REST_Response::class, $response );\n// Verify on the validator spy.\n$this->validator->validate( 'luca@theaveragedev.com' )->shouldHaveBeenCalled();\n}\npublic function test_will_not_validate_email_if_missing() {\n$this->request->get_param( 'name' )->willReturn( 'luca' );\n$this->request->get_param( 'email' )->willReturn( '' );\n$handler = new Acme\\Signup\\SubmissionHandler( $this->validator->reveal() );\n$handler->set_validator( $this->validator );\n$response = $handler->handle( $this->request->reveal() );\n$this->assertInstanceOf( WP_REST_Response::class, $response );\n// Verify on the validator spy.\n$this->validator->validate( Argument::any() )->shouldNotHaveBeenCalled();\n}\n}\n

                                                                                                                                                                                    The class uses the WP_REST_Request and WP_Rest_Response classes as input and output and will probably, internally, use more functions defined by WordPress.

                                                                                                                                                                                    One solution to avoid loading WordPress, could be to rewrite test versions of each and all the WordPress functions and classes needed by all the classes I want to unit test; this would require updating each time the classes requirements change.

                                                                                                                                                                                    Furthermore internationalization (e.g. __()) and filtering (e.g apply_filters) functions would not need to be mocked if not in specific cases and would pretty much be copy and paste versions of the WordPres ones.

                                                                                                                                                                                    Loading single pieces of WordPress is a dangerous and brittle endeavour and it's not supported by the framework.

                                                                                                                                                                                    To avoid all this WordPress \"unit tests\" pay the price of having to bootstrap WordPress, thus requiring a database connection.

                                                                                                                                                                                    This kind of test setup and level is the one you can see in the PHPUnit Core suite of WordPress itself.

                                                                                                                                                                                    "},{"location":"v3/requirements/","title":"Requirements","text":"

                                                                                                                                                                                    This is the documentation for version 3 of the project. The current version is version 4 and the documentation can be found here.

                                                                                                                                                                                    "},{"location":"v3/requirements/#requirements","title":"Requirements","text":"

                                                                                                                                                                                    wp-browser has some requirements your development environment will need to fulfill for it to work correctly.

                                                                                                                                                                                    "},{"location":"v3/requirements/#php","title":"PHP","text":"

                                                                                                                                                                                    The minimum supported version of PHP supported by wp-browser is 5.6.

                                                                                                                                                                                    This requirement does not reflect on the minimum PHP version your plugin might require; see the FAQs for more information.

                                                                                                                                                                                    "},{"location":"v3/requirements/#composer","title":"Composer","text":"

                                                                                                                                                                                    There is no phar version of wp-browser and it can only be installed using Composer.

                                                                                                                                                                                    See Composer installation guide for more information.

                                                                                                                                                                                    "},{"location":"v3/requirements/#wordpress-mysql-apachenginx","title":"WordPress, MySQL, Apache/Nginx","text":"

                                                                                                                                                                                    wp-browser will not download, install and configure WordPress for you.

                                                                                                                                                                                    It will also not download, install and setup MySQL, Apache, Nginx or any other technology required by a fully functional WordPress installation for you.

                                                                                                                                                                                    You need to set up a local WordPress installation on your own; you can use your preferred solution to do it.

                                                                                                                                                                                    In the documentation I will show automated ways to do this but, for most projects, that's not the best solution.

                                                                                                                                                                                    "},{"location":"v3/setting-up-minimum-wordpress-installation/","title":"Setting up a minimum WordPress installation","text":"

                                                                                                                                                                                    This is the documentation for version 3 of the project. The current version is version 4 and the documentation can be found here.

                                                                                                                                                                                    "},{"location":"v3/setting-up-minimum-wordpress-installation/#setting-up-a-minimum-wordpress-installation","title":"Setting up a minimum WordPress installation","text":"

                                                                                                                                                                                    As mentioned in Installation section wp-browser will not download, configure and install WordPress for you.

                                                                                                                                                                                    On a high level, once WordPress is installed and configured, whatever local development environment solution you've used, there are some information you'll need to gather before moving into wp-browser configuration.

                                                                                                                                                                                    While there will be a section dedicated to different environments and setups I will outline below the example setup I will use, in the next section, to configure wp-browser:

                                                                                                                                                                                    • WordPress is installed, on my machine, at /Users/luca/Sites/wordpress.
                                                                                                                                                                                    • I'm running MySQL server locally; I can connect to the MySQL server with the command mysql -u root -h 127.0.0.1 -P 3306; there is no password.
                                                                                                                                                                                    • I've created two databases, wordpress and tests, with the command:
                                                                                                                                                                                      mysql -u root -h 127.0.0.1 -P 3306 -e \"create database if not exists wordpress; create database if not exists tests\"\n
                                                                                                                                                                                    • I've configured the /Users/luca/Sites/wordpress/wp-config.php file like below (redacted for brevity):
                                                                                                                                                                                      <?php\ndefine( 'DB_NAME', 'wordpress' );\ndefine( 'DB_USER', 'root' );\ndefine( 'DB_PASSWORD', '' );\ndefine( 'DB_HOST', '127.0.0.1' );\ndefine( 'DB_CHARSET', 'utf8' );\ndefine( 'DB_COLLATE', '' );\n$table_prefix = 'wp_';\nif ( ! defined( 'ABSPATH' ) )\ndefine( 'ABSPATH', dirname( __FILE__ ) . '/' );\nrequire_once ABSPATH . 'wp-settings.php';\n
                                                                                                                                                                                    • To serve the site I'm using PHP built-in server with the command:
                                                                                                                                                                                      (cd /Users/luca/Sites/wordpress; php -S localhost:8080)\n
                                                                                                                                                                                    • I can access the WordPress homepage at http://localhost:8080 and the administration area at http://localhost:8080/wp-admin.
                                                                                                                                                                                    • I've installed WordPress via its UI (http://localhost:8080/wp-admin), the administrator username is admin, the administrator password is password.
                                                                                                                                                                                    • I'm testing a plugin and that plugin is in the folder, relative to the WordPress root folder, wp-content/plugins/acme-plugin.

                                                                                                                                                                                    With all the steps above done I can now move into the actual wp-browser configuration phase.

                                                                                                                                                                                    "},{"location":"v3/advanced/run-in-separate-process/","title":"Running tests in separate processes","text":"

                                                                                                                                                                                    This is the documentation for version 3 of the project. The current version is version 4 and the documentation can be found here.

                                                                                                                                                                                    "},{"location":"v3/advanced/run-in-separate-process/#running-tests-in-separate-processes","title":"Running tests in separate processes","text":"

                                                                                                                                                                                    PHPUnit offers the possibility to run tests in a separate PHP process; Codeception does not officially support the option as of version 4.0.

                                                                                                                                                                                    The wp-browser project tries to fill that gap by supporting the @runInSeparateProcess annotation. This support comes with some caveats, though:

                                                                                                                                                                                    1. The support is only for test cases extending the Codeception\\TestCase\\WPTestCase class (the base test case for integration or \"WordPress unit\" tests)
                                                                                                                                                                                    2. The support wp-browser provides only supports the @preserveGlobalState annotation with the disabled value; this means there is no support for preserving global state between tests.

                                                                                                                                                                                    Read more about what this means in PHPUnit documentation.

                                                                                                                                                                                    "},{"location":"v3/advanced/run-in-separate-process/#why-run-tests-in-a-separate-php-process","title":"Why run tests in a separate PHP process?","text":"

                                                                                                                                                                                    One main reason: isolation.

                                                                                                                                                                                    What does \"isolation\" means?

                                                                                                                                                                                    Before answering that question, it's essential to understand, via an example, why a lack of isolation might be an issue.

                                                                                                                                                                                    I want to test the get_api function. The function will return the correct singleton instance of an API handling class: an instance of Api when the function is called in non-admin context, and an instance of AdminApi when the function is called in admin context. The get_api function is acting as a service locator.

                                                                                                                                                                                    <?php\nfunction get_api(){\nstatic $api;\nif(null !== $api){\nreturn $api;\n}\nif( is_admin() ) {\n$api = new Admin_Api();\n} else {\n$api = new Api();\n}\nreturn $api;\n}\n

                                                                                                                                                                                    There are two challenges to testing this function:

                                                                                                                                                                                    1. The is_admin function, defined by WordPress, looks up a WP_ADMIN constant to know if the context of the current request is an administration UI one or not.
                                                                                                                                                                                    2. The get_api function will check for the context and resolve and build the correct instance only once, the first time it's called in the context of a request.

                                                                                                                                                                                    There are some possible solutions to this problem:

                                                                                                                                                                                    a. Refactor the get_api function into a method of an Api_Factory object taking the context as a dependency, thus allowing injection of the \"context\" (which implies the creation of a Context adapter that will proxy its is_admin method to the is_admin function). You can find the code for such refactoring in the OOP refactoring of get_api section. b. Refactor the get_api function to accept the current is_admin value as an input argument, get_api( $is_admin ), this refactoring moves part of the complexity of getting hold of the correct instance of the API handler on the client code. Adding more build condition and checks, e.g., if the current request is a REST request or not or some tests on the user authorizations, then, requires adding more input arguments to the get_api function: the knowledge of the implementation of the get_api method will \"leak\" to the client code having to replicate complexity throughout the system.

                                                                                                                                                                                    I want to layout possible solutions to the problem to show there is always a design alternative to make code testable that might or might not fit the current time or scope constraint.

                                                                                                                                                                                    In this example, I've inherited the get_api function from the existing code, and it cannot be changed, yet I want to test it dealing with the two problems outlined above.

                                                                                                                                                                                    "},{"location":"v3/advanced/run-in-separate-process/#running-tests-in-separate-php-processes","title":"Running tests in separate PHP processes","text":"

                                                                                                                                                                                    To test the get_api function shown above I've created a new wpunit type of test:

                                                                                                                                                                                    vendor/bin/codecept g:wpunit integration \"api\"\n

                                                                                                                                                                                    The command scaffolds a test/integration/apiTest.php file that I've modified to ensure full coverage of the get_api function:

                                                                                                                                                                                    <?php\nclass apiTest extends \\Codeception\\TestCase\\WPTestCase\n{\npublic function test_get_api_exists()\n{\n$this->assertTrue(function_exists('get_api'));\n}\npublic function test_get_api_will_cache()\n{\n$this->assertSame(get_api(), get_api());\n}\n/**\n     * @runInSeparateProcess\n     * @preserveGlobalState disabled\n     */\npublic function test_get_api_will_return_api_if_not_admin()\n{\n// Let's make sure we're NOT in admin context.\ndefine('WP_ADMIN', false);\n$api = get_api();\n$this->assertInstanceOf(Api::class, $api);\n}\n/**\n     * @runInSeparateProcess\n     * @preserveGlobalState disabled\n     */\npublic function test_get_api_will_cache_api_if_not_admin()\n{\n// Let's make sure we're NOT in admin context.\ndefine('WP_ADMIN', false);\n$api = get_api();\n$this->assertSame(get_api(), $api);\n}\n/**\n     * @runInSeparateProcess\n     * @preserveGlobalState disabled\n     */\npublic function test_get_api_will_return_api_if_is_admin()\n{\n// Let's make sure we're NOT in admin context.\ndefine('WP_ADMIN', true);\n$api = get_api();\n$this->assertInstanceOf(AdminApi::class, $api);\n}\n/**\n     * @runInSeparateProcess\n     * @preserveGlobalState disabled\n     */\npublic function test_get_api_will_cache_api_if_is_admin()\n{\n// Let's make sure we're NOT in admin context.\ndefine('WP_ADMIN', true);\n$api = get_api();\n$this->assertSame(get_api(), $api);\n}\n}\n

                                                                                                                                                                                    Some pieces of this code are worth pointing out:

                                                                                                                                                                                    1. There are two test methods, test_get_api_exists and test_get_api_will_cache that are not running in a separate process. Running tests in a separate process provide isolation at the cost of speed, only tests that require isolation should run in a separate PHP process.
                                                                                                                                                                                    2. I instruct the Codeception and PHPUnit test runner to run a test method in a different process by adding two annotations that are both required ** precisely as shown**:
                                                                                                                                                                                      /**\n * @runInSeparateProcess\n * @preserveGlobalState disabled\n */\n
                                                                                                                                                                                    3. The isolation part of this testing approach shines through when I define, in the last four tests, the WP_ADMIN constant multiple times. If I try to do that in test code running in the same PHP process, then the second define call would cause a fatal error.
                                                                                                                                                                                    4. The isolation has also taken care of the second issue where the get_api function caches the $api instance after its first resolution in a static variable: since each test happens in a self-contained, dedicated PHP process, the static $api variable will be null at the start of each test.
                                                                                                                                                                                    "},{"location":"v3/advanced/run-in-separate-process/#can-i-run-some-tests-in-the-same-process-and-some-in-a-separate-process","title":"Can I run some tests in the same process and some in a separate process?","text":"

                                                                                                                                                                                    Yes. In the example test code in the previous section, the test_get_api_exists and test_get_api_will_cache test methods are not running in separate processes.

                                                                                                                                                                                    In your test cases extending the Codeception\\TestCase\\WPTestCase, you can mix test methods running in the primary PHP process and those running in a separate PHP process without issues.

                                                                                                                                                                                    "},{"location":"v3/advanced/run-in-separate-process/#oop-refactoring-of-get_api","title":"OOP refactoring of get_api","text":"

                                                                                                                                                                                    In the Why run tests in a separate PHP process? section I've outlined a possible refactoring of the get_api function to make it testable without requiring the use of separate PHP processes.

                                                                                                                                                                                    I'm providing this refactoring code below for the sake of completeness, the judgment of which approach is \"better\" is up to the reader.

                                                                                                                                                                                    <?php\nclass Context_Adapter{\npublic function is_admin(){\nreturn \\is_admin();\n}\n}\nclass Api_Factory{\nprivate $api;\nprivate $context;\npublic function __construct(Context_Adapter $context){\n$this->context = $context;\n}\npublic function getApi(){\nif(null !== $this->api){\nreturn $this->api;    \n}\nif($this->context->is_admin()){\n$api = new Admin_Api;\n} else {\n$api = new Api;\n}\nreturn $api;\n}\n}\n

                                                                                                                                                                                    Now the Api_Factory class can be injected by injecting a mocked Context_Adapter class, modifying the return value of the Context_Adapter::is_admin method.

                                                                                                                                                                                    Due to the supposed requirement of the API instance being a singleton, this solution will also require some container or service-locator to ensure at most only one instance of the Api_Factory exists at any given time in the context of a request.

                                                                                                                                                                                    "},{"location":"v3/migration/from-version-2-to-version-3/","title":"Version 2 to version 3","text":"

                                                                                                                                                                                    This is the documentation for version 3 of the project. The current version is version 4 and the documentation can be found here.

                                                                                                                                                                                    "},{"location":"v3/migration/from-version-2-to-version-3/#migrating-projects-from-version-2-of-wp-browser-to-version-3","title":"Migrating projects from version 2 of wp-browser to version 3","text":"

                                                                                                                                                                                    Version 3 of wp-browser removed, to allow for broader compatibility with PHP and Composer versions, some of its dependencies and modified some of its methods. Here is a list of changes and the suggested courses of action:

                                                                                                                                                                                    • Removed symfony/process to launch and manage external processes; re-add it your project development requirements using composer require --dev symfony/process.
                                                                                                                                                                                    • Removed the wp-cli/wp-cli-bundle dependency; if you were relying on non-core packages, then re-add it to your project development requirements using composer require --dev wp-cli/wp-cli-bundle.
                                                                                                                                                                                    • Removed the WithWpCli::executeBackgroundWpCliCommand trait method, and, as a consequence, the WPCLI::executeBackgroundWpCliCommand module method; you could have used the latter, if this was the case, then require the symfony/process as explained above and launch processes in background using its API; find out more.
                                                                                                                                                                                    • Refactored the WPCLI module to build and escape string command lines differently; the handling of command-line arguments for the WPCLI module has been modified to make it a bit more consistent and robust; as a consequence, you might experience some breakages in string commands that used to work correctly before; should this be the case then either modify your code to provide the command in array format (taking care of the correct escaping in your code), or make sure to pass a correctly structured command string to the WPCLI module.
                                                                                                                                                                                    "},{"location":"v3/modules/WPBrowser/","title":"WPBrowser","text":"

                                                                                                                                                                                    This is the documentation for version 3 of the project. The current version is version 4 and the documentation can be found here.

                                                                                                                                                                                    "},{"location":"v3/modules/WPBrowser/#wpbrowser-module","title":"WPBrowser module","text":"

                                                                                                                                                                                    This module should be used in acceptance and functional tests, see levels of testing for more information.

                                                                                                                                                                                    This module extends the PHPBrowser module adding WordPress-specific configuration parameters and methods.

                                                                                                                                                                                    The module simulates a user interaction with the site without Javascript support; if you need to test your project with Javascript support use the WPWebDriver module.

                                                                                                                                                                                    "},{"location":"v3/modules/WPBrowser/#module-requirements-for-codeception-40","title":"Module requirements for Codeception 4.0+","text":"

                                                                                                                                                                                    This module requires the codeception/module-phpbrowser Composer package to work when wp-browser is used with Codeception 4.0.

                                                                                                                                                                                    To install the package run:

                                                                                                                                                                                    composer require --dev codeception/module-phpbrowser:^1.0\n
                                                                                                                                                                                    "},{"location":"v3/modules/WPBrowser/#configuration","title":"Configuration","text":"

                                                                                                                                                                                    Since this module extends the PHPBrowser module provided by Codeception, please refer to the PHPBrowser configuration section for more information about the base configuration parameters.

                                                                                                                                                                                    • url required - Start URL of your WordPress project, e.g. http://wp.test.
                                                                                                                                                                                    • headers - Default headers are set before each test; this might be useful to simulate a specific user agent during the tests or to identify the request source. Note that the headers defined in the config should be prefaced with HTTP_ in your wp-config.php file. This can be used to select which database to use.
                                                                                                                                                                                    • handler (default: curl) - The Guzzle handler to use. By default curl is used, also possible to pass stream, or any valid class name as Handler.
                                                                                                                                                                                    • middleware - The Guzzle middlewares to add. An array of valid callables is required; see here for more information.
                                                                                                                                                                                    • curl - curl options; only applied if using the curl handler; more options are available.
                                                                                                                                                                                    • adminUsername required - This is the login name, not the \"nice\" name, of the administrator user of the WordPress test site. This will be used to fill the username field in WordPress login page.
                                                                                                                                                                                    • adminPassword required - This is the the password of the administrator use of the WordPress test site. This will be used to fill the password in WordPress login page.
                                                                                                                                                                                    • adminPath required - The path, relative to the WordPress test site home URL, to the administration area, usually /wp-admin.
                                                                                                                                                                                    "},{"location":"v3/modules/WPBrowser/#example-configuration","title":"Example configuration","text":"
                                                                                                                                                                                      modules:\nenabled:\n- WPBrowser\nconfig:\nWPBrowser:\nurl: 'http://wordpress.localhost'\nadminUsername: 'admin'\nadminPassword: 'password'\nadminPath: '/wp-admin'\nheaders:\nX_TEST_REQUEST: 1\nX_WPBROWSER_REQUEST: 1\n

                                                                                                                                                                                    Read here how to use the headers information to automatically change the database during acceptance and functional tests.

                                                                                                                                                                                    "},{"location":"v3/modules/WPBrowser/#public-api","title":"Public API","text":"
                                                                                                                                                                                    • activatePlugin
                                                                                                                                                                                    • amEditingPostWithId
                                                                                                                                                                                    • amOnAdminAjaxPage
                                                                                                                                                                                    • amOnAdminPage
                                                                                                                                                                                    • amOnCronPage
                                                                                                                                                                                    • amOnPagesPage
                                                                                                                                                                                    • amOnPluginsPage
                                                                                                                                                                                    • deactivatePlugin
                                                                                                                                                                                    • dontSeePluginInstalled
                                                                                                                                                                                    • grabCookiesWithPattern
                                                                                                                                                                                    • grabWordPressTestCookie
                                                                                                                                                                                    • logOut
                                                                                                                                                                                    • loginAs
                                                                                                                                                                                    • loginAsAdmin
                                                                                                                                                                                    • seeErrorMessage
                                                                                                                                                                                    • seeMessage
                                                                                                                                                                                    • seePluginActivated
                                                                                                                                                                                    • seePluginDeactivated
                                                                                                                                                                                    • seePluginInstalled
                                                                                                                                                                                    • seeWpDiePage
                                                                                                                                                                                    activatePlugin

                                                                                                                                                                                    In the plugin administration screen activates a plugin clicking the \"Activate\" link. The method will not handle authentication to the admin area.

                                                                                                                                                                                    // Activate a plugin.\n  $I->loginAsAdmin();\n  $I->amOnPluginsPage();\n  $I->activatePlugin('hello-dolly');\n  // Activate a list of plugins.\n  $I->loginAsAdmin();\n  $I->amOnPluginsPage();\n  $I->activatePlugin(['hello-dolly','another-plugin']);\n
                                                                                                                                                                                    Parameters
                                                                                                                                                                                    • string/\\Codeception\\Module\\array $pluginSlug - The plugin slug, like \"hello-dolly\" or a list of plugin slugs. amEditingPostWithId

                                                                                                                                                                                      Go to the admin page to edit the post with the specified ID. The method will not handle authentication the admin area.

                                                                                                                                                                                      $I->loginAsAdmin();\n  $postId = $I->havePostInDatabase();\n  $I->amEditingPostWithId($postId);\n  $I->fillField('post_title', 'Post title');\n
                                                                                                                                                                                      Parameters
                                                                                                                                                                                      • int $id - The post ID.
                                                                                                                                                                                      amOnAdminAjaxPage

                                                                                                                                                                                      Go to the admin-ajax.php page to start a synchronous, and blocking, GET AJAX request. The method will not handle authentication, nonces or authorization.

                                                                                                                                                                                      $I->amOnAdminAjaxPage(['action' => 'my-action', 'data' => ['id' => 23], 'nonce' => $nonce]);\n
                                                                                                                                                                                      Parameters
                                                                                                                                                                                      • string/\\Codeception\\Module\\array $queryVars - A string or array of query variables to append to the AJAX path. amOnAdminPage

                                                                                                                                                                                        Go to a page in the admininstration area of the site. This method will not handle authentication to the administration area.

                                                                                                                                                                                        $I->loginAs('user', 'password');\n  // Go to the plugins management screen.\n  $I->amOnAdminPage('/plugins.php');\n
                                                                                                                                                                                        Parameters
                                                                                                                                                                                        • string $page - The path, relative to the admin area URL, to the page.
                                                                                                                                                                                        amOnCronPage

                                                                                                                                                                                        Go to the cron page to start a synchronous, and blocking, GET request to the cron script.

                                                                                                                                                                                        // Triggers the cron job with an optional query argument.\n  $I->amOnCronPage('/?some-query-var=some-value');\n
                                                                                                                                                                                        Parameters
                                                                                                                                                                                        • string/\\Codeception\\Module\\array $queryVars - A string or array of query variables to append to the AJAX path. amOnPagesPage

                                                                                                                                                                                          Go the \"Pages\" administration screen. The method will not handle authentication.

                                                                                                                                                                                          $I->loginAsAdmin();\n  $I->amOnPagesPage();\n  $I->see('Add New');\n
                                                                                                                                                                                          amOnPluginsPage

                                                                                                                                                                                          Go to the plugins administration screen. The method will not handle authentication.

                                                                                                                                                                                          $I->loginAsAdmin();\n  $I->amOnPluginsPage();\n  $I->activatePlugin('hello-dolly');\n
                                                                                                                                                                                          deactivatePlugin

                                                                                                                                                                                          In the plugin administration screen deactivate a plugin clicking the \"Deactivate\" link. The method will not handle authentication and navigation to the plugins administration page.

                                                                                                                                                                                          // Deactivate one plugin.\n  $I->loginAsAdmin();\n  $I->amOnPluginsPage();\n  $I->deactivatePlugin('hello-dolly');\n  // Deactivate a list of plugins.\n  $I->loginAsAdmin();\n  $I->amOnPluginsPage();\n  $I->deactivatePlugin(['hello-dolly', 'my-plugin']);\n
                                                                                                                                                                                          Parameters
                                                                                                                                                                                          • string/\\Codeception\\Module\\array $pluginSlug - The plugin slug, like \"hello-dolly\", or a list of plugin slugs. dontSeePluginInstalled

                                                                                                                                                                                            Assert a plugin is not installed in the plugins administration screen. The method will not handle authentication and navigation to the plugin administration screen.

                                                                                                                                                                                            $I->loginAsAdmin();\n  $I->amOnPluginsPage();\n  $I->dontSeePluginInstalled('my-plugin');\n
                                                                                                                                                                                            Parameters
                                                                                                                                                                                            • string $pluginSlug - The plugin slug, like \"hello-dolly\".
                                                                                                                                                                                            grabCookiesWithPattern

                                                                                                                                                                                            Returns all the cookies whose name matches a regex pattern.

                                                                                                                                                                                            $I->loginAs('customer','password');\n  $I->amOnPage('/shop');\n  $cartCookies = $I->grabCookiesWithPattern(\"#^shop_cart\\\\.*#\");\n
                                                                                                                                                                                            Parameters
                                                                                                                                                                                            • string $cookiePattern - The regular expression pattern to use for the matching.
                                                                                                                                                                                            grabWordPressTestCookie

                                                                                                                                                                                            Returns WordPress default test cookie object if present.

                                                                                                                                                                                            // Grab the default WordPress test cookie.\n  $wpTestCookie = $I->grabWordPressTestCookie();\n  // Grab a customized version of the test cookie.\n  $myTestCookie = $I->grabWordPressTestCookie('my_test_cookie');\n
                                                                                                                                                                                            Parameters
                                                                                                                                                                                            • string $name - Optional, overrides the default cookie name.
                                                                                                                                                                                            logOut

                                                                                                                                                                                            Navigate to the default WordPress logout page and click the logout link.

                                                                                                                                                                                            // Log out using the `wp-login.php` form and return to the current page.\n  $I->logOut(true);\n  // Log out using the `wp-login.php` form and remain there.\n  $I->logOut(false);\n  // Log out using the `wp-login.php` form and move to another page.\n  $I->logOut('/some-other-page');\n
                                                                                                                                                                                            Parameters
                                                                                                                                                                                            • bool/bool/string $redirectTo - Whether to redirect to another (optionally specified) page after the logout.
                                                                                                                                                                                            loginAs

                                                                                                                                                                                            Login as the specified user. The method will not follow redirection, after the login, to any page.

                                                                                                                                                                                            $I->loginAs('user', 'password');\n  $I->amOnAdminPage('/');\n  $I->see('Dashboard');\n
                                                                                                                                                                                            Parameters
                                                                                                                                                                                            • string $username - The user login name.
                                                                                                                                                                                            • string $password - The user password in plain text.
                                                                                                                                                                                            loginAsAdmin

                                                                                                                                                                                            Login as the administrator user using the credentials specified in the module configuration. The method will not follow redirection, after the login, to any page.

                                                                                                                                                                                            $I->loginAsAdmin();\n  $I->amOnAdminPage('/');\n  $I->see('Dashboard');\n
                                                                                                                                                                                            seeErrorMessage

                                                                                                                                                                                            In an administration screen look for an error admin notice. The check is class-based to decouple from internationalization. The method will not handle authentication and navigation the administration area. .notice.notice-error ones.

                                                                                                                                                                                            $I->loginAsAdmin()\n  $I->amOnAdminPage('/');\n  $I->seeErrorMessage('.my-plugin');\n
                                                                                                                                                                                            Parameters
                                                                                                                                                                                            • string/string/\\Codeception\\Module\\array $classes - A list of classes the notice should have other than the seeMessage

                                                                                                                                                                                              In an administration screen look for an admin notice. The check is class-based to decouple from internationalization. The method will not handle authentication and navigation the administration area.

                                                                                                                                                                                              $I->loginAsAdmin()\n  $I->amOnAdminPage('/');\n  $I->seeMessage('.missing-api-token.my-plugin');\n
                                                                                                                                                                                              Parameters
                                                                                                                                                                                              • string/\\Codeception\\Module\\array/string $classes - A list of classes the message should have in addition to the .notice one. seePluginActivated

                                                                                                                                                                                                Assert a plugin is activated in the plugin administration screen. The method will not handle authentication and navigation to the plugin administration screen.

                                                                                                                                                                                                $I->loginAsAdmin();\n  $I->amOnPluginsPage();\n  $I->seePluginActivated('my-plugin');\n
                                                                                                                                                                                                Parameters
                                                                                                                                                                                                • string $pluginSlug - The plugin slug, like \"hello-dolly\".
                                                                                                                                                                                                seePluginDeactivated

                                                                                                                                                                                                Assert a plugin is not activated in the plugins administration screen. The method will not handle authentication and navigation to the plugin administration screen.

                                                                                                                                                                                                $I->loginAsAdmin();\n  $I->amOnPluginsPage();\n  $I->seePluginDeactivated('my-plugin');\n
                                                                                                                                                                                                Parameters
                                                                                                                                                                                                • string $pluginSlug - The plugin slug, like \"hello-dolly\".
                                                                                                                                                                                                seePluginInstalled

                                                                                                                                                                                                Assert a plugin is installed, no matter its activation status, in the plugin administration screen. The method will not handle authentication and navigation to the plugin administration screen.

                                                                                                                                                                                                $I->loginAsAdmin();\n  $I->amOnPluginsPage();\n  $I->seePluginInstalled('my-plugin');\n
                                                                                                                                                                                                Parameters
                                                                                                                                                                                                • string $pluginSlug - The plugin slug, like \"hello-dolly\".
                                                                                                                                                                                                seeWpDiePage

                                                                                                                                                                                                Checks that the current page is one generated by the wp_die function. The method will try to identify the page based on the default WordPress die page HTML attributes.

                                                                                                                                                                                                $I->loginAs('user', 'password');\n  $I->amOnAdminPage('/forbidden');\n  $I->seeWpDiePage();\n

                                                                                                                                                                                                This class extends \\Codeception\\Module\\PhpBrowser

                                                                                                                                                                                                This class implements \\Codeception\\Lib\\Interfaces\\MultiSession, \\Codeception\\Lib\\Interfaces\\Remote, \\Codeception\\Lib\\Interfaces\\Web, \\Codeception\\Lib\\Interfaces\\PageSourceSaver, \\Codeception\\Lib\\Interfaces\\ElementLocator, \\Codeception\\Lib\\Interfaces\\ConflictsWithModule

                                                                                                                                                                                                "},{"location":"v3/modules/WPCLI/","title":"WPCLI","text":"

                                                                                                                                                                                                This is the documentation for version 3 of the project. The current version is version 4 and the documentation can be found here.

                                                                                                                                                                                                "},{"location":"v3/modules/WPCLI/#wpcli-module","title":"WPCLI module","text":"

                                                                                                                                                                                                This module should be used in acceptance and functional tests to setup, or verify, tests pre and post conditions using WP-CLI commands. This module allows invoking WP-CLI commands, refer to the official site for more information.

                                                                                                                                                                                                The module will use its own version of WP-CLI, not the one installed in the machine running the tests!

                                                                                                                                                                                                By default, wp-browser will only include the wp-cli/wp-cli package; this package contains the basic files to run WP-CLI and does not contain all the commands that come with a typical wp-cli installation. If, in your tests, you require all the commands that usually come installed with WP-CLI, then you should require the wp-cli/wp-cli-bundle package as a development dependency of your project, see below.

                                                                                                                                                                                                "},{"location":"v3/modules/WPCLI/#fixing-not-a-registered-command-issue","title":"Fixing \"not a registered command\" issue","text":"

                                                                                                                                                                                                To keep the conflicts at a manageable level, the wp-browser project does not include all the commands WP-CLI usually comes bundled with. Running, in the context of an automated test, a WP-CLI command that would work on your machine, e.g. wp plugin list --status=active, will not work on a default installation of wp-browser and you will get the following error message:

                                                                                                                                                                                                [ModuleException] WPCLI: wp-cli terminated with status [1] and output [Error: 'plugin' is not a registered wp command. See 'wp help' for available commands.]\n

                                                                                                                                                                                                To resolve the message just add the package you require as a development dependency or add the whole WP-CLI bundle:

                                                                                                                                                                                                composer require --dev wp-cli/wp-cli-bundle\n

                                                                                                                                                                                                The package will make all the default WP-CLI commands available to the WP-CLI version used in tests.

                                                                                                                                                                                                "},{"location":"v3/modules/WPCLI/#module-requirements-for-codeception-40","title":"Module requirements for Codeception 4.0+","text":"

                                                                                                                                                                                                This module requires the codeception/module-cli Composer package to work when wp-browser is used with Codeception 4.0.

                                                                                                                                                                                                To install the package run:

                                                                                                                                                                                                composer require --dev codeception/module-cli:^1.0\n
                                                                                                                                                                                                "},{"location":"v3/modules/WPCLI/#detecting-requests-coming-from-this-module","title":"Detecting requests coming from this module","text":"

                                                                                                                                                                                                When it runs this module will set the WPBROWSER_HOST_REQUEST environment variable. You can detect and use that information to, as an example, use the correct database in your test site wp-config.php file:

                                                                                                                                                                                                <?php\nif ( \n// Custom header.\nisset( $_SERVER['HTTP_X_TESTING'] )\n// Custom user agent.\n|| ( isset( $_SERVER['HTTP_USER_AGENT'] ) && $_SERVER['HTTP_USER_AGENT'] === 'wp-browser' )\n// The env var set by the WPClIr or WordPress modules.\n|| getenv( 'WPBROWSER_HOST_REQUEST' )\n) {\n// Use the test database if the request comes from a test.\ndefine( 'DB_NAME', 'wordpress_test' );\n} else {\n// Else use the default one.\ndefine( 'DB_NAME', 'wordpress' );\n}\n

                                                                                                                                                                                                "},{"location":"v3/modules/WPCLI/#configuration","title":"Configuration","text":"
                                                                                                                                                                                                • path required - the absolute, or relative, path to the WordPress root folder. This will be mapped to the --path argument of the wp-cli binary.
                                                                                                                                                                                                • throw - defaults to true to throw an exception when a wp-cli command does not return an exit status of 0; if set to false then the exit status of the commands will be returned as is.
                                                                                                                                                                                                • timeout - defaults to 60 (seconds) to set each process execution timeout to a certain value; set to null, false or 0 to disable timeout completely.

                                                                                                                                                                                                Additionally the module configuration will forward any configuration parameter to wp-cli as a flag or option. In the example configuration below the allow-root flag and the some-option option will be passed to wp-cli directly and prepended to the command as global options.

                                                                                                                                                                                                Note: these extract configuration flags and options will be prepended to all commands executed by wp-cli!

                                                                                                                                                                                                "},{"location":"v3/modules/WPCLI/#environment-configuration","title":"Environment configuration","text":"

                                                                                                                                                                                                The wp-cli binary supports a set of environment variables to modify its behavior.

                                                                                                                                                                                                These environment variables can be set on the commands ran by the WPCLI module using the optional env array in the module configuration. The example configuration below shows all of them with some example values. Most of the times you won't need any of these, but they are there for more fine-grained control over the module operations.

                                                                                                                                                                                                The module is not validating the environment variables in any way! Those values will be evaluated by wp-cli at runtime and might generate errors if not correctly configured.

                                                                                                                                                                                                "},{"location":"v3/modules/WPCLI/#example-configuration","title":"Example configuration","text":"
                                                                                                                                                                                                modules:\nenabled:\n- WPCLI\nconfig:\nWPCLI:\npath: /Users/Luca/Sites/wp\nthrow: true\ntimeout: 60\n# This will be prepended to the command, `wp --allow-root <command>`.\nallow-root: true\n# This will be prepended to the command, `wp --some-option=some-value <command>`.\nsome-option: some-value\nenv:\n# Any one of these, if provided, will be set as environment variable for the the cli command process. \n# See https://make.wordpress.org/cli/handbook/config/#environment-variables for information.\n# Equivalent to `WP_CLI_STRICT_ARGS_MODE=1 wp <command>'.\nstrict-args: true\n# Equivalent to `WP_CLI_CACHE_DIR=/tmp/wp-cli-cache wp <command>'.\ncache-dir: '/tmp/wp-cli-cache'\n# Equivalent to `WP_CLI_CONFIG_PATH=/app/public wp <command>'.\nconfig-path: '/app/public'\n# Equivalent to `WP_CLI_CUSTOM_SHELL=/bin/zsh wp <command>'.\ncustom-shell: '/bin/zsh'\n# Equivalent to `WP_CLI_DISABLE_AUTO_CHECK_UPDATE=1 wp <command>'.\ndisable-auto-update: true\n# Equivalent to `WP_CLI_PACKAGES_DIR=/wp-cli/packages wp <command>'.\npackages-dir: '/wp-cli/packages'\n# Equivalent to `WP_CLI_PHP=/usr/local/bin/php/7.2/php wp <command>'.\nphp: '/usr/local/bin/php/7.2/php'\n# Equivalent to `WP_CLI_PHP_ARGS='foo=bar some=23' wp <command>'.\nphp-args: 'foo=bar some=23'\n
                                                                                                                                                                                                "},{"location":"v3/modules/WPCLI/#public-api","title":"Public API","text":"
                                                                                                                                                                                                • buildFullCommand
                                                                                                                                                                                                • cli
                                                                                                                                                                                                • cliToArray
                                                                                                                                                                                                • cliToString
                                                                                                                                                                                                • dontSeeInShellOutput
                                                                                                                                                                                                • seeInShellOutput
                                                                                                                                                                                                • seeResultCodeIs
                                                                                                                                                                                                • seeResultCodeIsNot
                                                                                                                                                                                                • seeShellOutputMatches
                                                                                                                                                                                                buildFullCommand

                                                                                                                                                                                                Builds the full command to run including the PHP binary and the wp-cli boot file path.

                                                                                                                                                                                                // This method is defined in the WithWpCli trait.\n  // Set the wp-cli path, `$this` is a test case.\n  $this->setUpWpCli( '/var/www/html' );\n  // Builds the full wp-cli command, including the `path` variable.\n  $fullCommand =  $this->buildFullCommand(['core', 'version']);\n  // The full command can then be used to run it with another process handler.\n  $wpCliProcess = new Process($fullCommand);\n  $wpCliProcess->run();\n
                                                                                                                                                                                                Parameters
                                                                                                                                                                                                • \\Codeception\\Module\\array/string $command - The command to run. cli

                                                                                                                                                                                                  Executes a wp-cli command targeting the test WordPress installation. minus wp. For back-compatibility purposes you can still pass the commandline as a string, but the array format is the preferred and supported method.

                                                                                                                                                                                                  // Activate a plugin via wp-cli in the test WordPress site.\n  $I->cli(['plugin', 'activate', 'my-plugin']);\n  // Change a user password.\n  $I->cli(['user', 'update', 'luca', '--user_pass=newpassword']);\n
                                                                                                                                                                                                  Parameters
                                                                                                                                                                                                  • string/string/\\Codeception\\Module\\array $userCommand - The string of command and parameters as it would be passed to wp-cli cliToArray

                                                                                                                                                                                                    Returns the output of a wp-cli command as an array optionally allowing a callback to process the output. minus wp. For back-compatibility purposes you can still pass the commandline as a string, but the array format is the preferred and supported method.

                                                                                                                                                                                                    // Return a list of inactive themes, like ['twentyfourteen', 'twentyfifteen'].\n  $inactiveThemes = $I->cliToArray(['theme', 'list', '--status=inactive', '--field=name']);\n  // Get the list of installed plugins and only keep the ones starting with \"foo\".\n  $fooPlugins = $I->cliToArray(['plugin', 'list', '--field=name'], function($output){\n  return array_filter(explode(PHP_EOL, $output), function($name){\n  return strpos(trim($name), 'foo') === 0;\n  });\n  });\n
                                                                                                                                                                                                    Parameters
                                                                                                                                                                                                    • string/string/\\Codeception\\Module\\array $userCommand - The string of command and parameters as it would be passed to wp-cli
                                                                                                                                                                                                    • \\callable $splitCallback - An optional callback function to split the results array.
                                                                                                                                                                                                    • cliToString

                                                                                                                                                                                                      Returns the output of a wp-cli command as a string. minus wp. For back-compatibility purposes you can still pass the commandline as a string, but the array format is the preferred and supported method.

                                                                                                                                                                                                      // Return the current site administrator email, using string command format.\n  $adminEmail = $I->cliToString('option get admin_email');\n  // Get the list of active plugins in JSON format, two ways.\n  $activePlugins = $I->cliToString(['plugin', 'list','--status=active', '--format=json']);\n  $activePlugins = $I->cliToString(['option', 'get', 'active_plugins' ,'--format=json']);\n
                                                                                                                                                                                                      Parameters
                                                                                                                                                                                                      • string/\\Codeception\\Module\\array $userCommand - The string of command and parameters as it would be passed to wp-cli dontSeeInShellOutput

                                                                                                                                                                                                        Checks that output from last command doesn't contain text.

                                                                                                                                                                                                        // Return the current site administrator email, using string command format.\n  $I->cli('plugin list --status=active');\n  $I->dontSeeInShellOutput('my-inactive/plugin.php');\n
                                                                                                                                                                                                        Parameters
                                                                                                                                                                                                        • string $text - The text to assert is not in the output.
                                                                                                                                                                                                        seeInShellOutput

                                                                                                                                                                                                        Checks that output from last command contains text.

                                                                                                                                                                                                        // Return the current site administrator email, using string command format.\n  $I->cli('option get admin_email');\n
                                                                                                                                                                                                        Parameters
                                                                                                                                                                                                        • string $text - The text to assert is in the output.
                                                                                                                                                                                                        seeResultCodeIs

                                                                                                                                                                                                        Checks the result code from the last command.

                                                                                                                                                                                                        // Return the current site administrator email, using string command format.\n  $I->cli('option get admin_email');\n  $I->seeResultCodeIs(0);\n
                                                                                                                                                                                                        Parameters
                                                                                                                                                                                                        • int $code - The desired result code.
                                                                                                                                                                                                        seeResultCodeIsNot

                                                                                                                                                                                                        Checks the result code from the last command.

                                                                                                                                                                                                        // Return the current site administrator email, using string command format.\n  $I->cli('invalid command');\n  $I->seeResultCodeIsNot(0);\n
                                                                                                                                                                                                        Parameters
                                                                                                                                                                                                        • int $code - The result code the command should not have exited with.
                                                                                                                                                                                                        seeShellOutputMatches

                                                                                                                                                                                                        Checks that output from the last command matches a given regular expression.

                                                                                                                                                                                                        // Return the current site administrator email, using string command format.\n  $I->cli('option get admin_email');\n
                                                                                                                                                                                                        Parameters
                                                                                                                                                                                                        • string $regex - The regex pattern, including delimiters, to assert the output matches against.

                                                                                                                                                                                                        This class extends \\Codeception\\Module

                                                                                                                                                                                                        "},{"location":"v3/modules/WPDb/","title":"WPDb","text":"

                                                                                                                                                                                                        This is the documentation for version 3 of the project. The current version is version 4 and the documentation can be found here.

                                                                                                                                                                                                        "},{"location":"v3/modules/WPDb/#wpdb-module","title":"WPDb module","text":"

                                                                                                                                                                                                        This module should be used in acceptance and functional tests, see levels of testing for more information. This module extends the Db module adding WordPress-specific configuration parameters and methods. The module provides methods to read, write and update the WordPress database directly, without relying on WordPress methods, using WordPress functions or triggering WordPress filters.

                                                                                                                                                                                                        "},{"location":"v3/modules/WPDb/#module-requirements-for-codeception-40","title":"Module requirements for Codeception 4.0+","text":"

                                                                                                                                                                                                        This module requires the codeception/module-db Composer package to work when wp-browser is used with Codeception 4.0.

                                                                                                                                                                                                        To install the package run:

                                                                                                                                                                                                        composer require --dev codeception/module-db:^1.0\n
                                                                                                                                                                                                        "},{"location":"v3/modules/WPDb/#backup-your-content","title":"Backup your content","text":"

                                                                                                                                                                                                        This module, like the Codeception Db one it extends, by default will load a database dump in the database it's using. This means that the database contents will be replaced by the dump contents on each run of a suite using the module. You can set the populate and cleanup parameters to false to prevent this default behavior but it's usually not what you need in an automated test. Make a backup of any database you're using in tests that contains any information you care about before you run any test!

                                                                                                                                                                                                        "},{"location":"v3/modules/WPDb/#change-the-database-used-depending-on-whether-youre-running-tests-or-not","title":"Change the database used depending on whether you're running tests or not","text":"

                                                                                                                                                                                                        The chore of having to plug different databases, or backup them, depending on whether you're manually testing the site or automatically testing can be mitigated switching them automatically depending on the browser user agent or request headers. This module was born to be used in acceptance and functional tests (see levels of testing for more information) and will often be coupled with modules like the WPBrowser one or the WPWebDriver one. Depending on which of the two modules is being used in the suite there are different ways to automate the \"database switching\".

                                                                                                                                                                                                        "},{"location":"v3/modules/WPDb/#automatically-changing-database-based-on-the-browser-user-agent","title":"Automatically changing database based on the browser user agent","text":"

                                                                                                                                                                                                        If you would like to automate the \"switching above\" below you will find an example setup. Update the test site wp-config.php file from this:

                                                                                                                                                                                                        define( 'DB_NAME', 'wordpress' );\n
                                                                                                                                                                                                        to this:
                                                                                                                                                                                                        <?php\nif ( \n// Custom header.\nisset( $_SERVER['HTTP_X_TESTING'] )\n// Custom user agent.\n|| ( isset( $_SERVER['HTTP_USER_AGENT'] ) && $_SERVER['HTTP_USER_AGENT'] === 'wp-browser' )\n// The env var set by the WPClIr or WordPress modules.\n|| getenv( 'WPBROWSER_HOST_REQUEST' )\n) {\n// Use the test database if the request comes from a test.\ndefine( 'DB_NAME', 'wordpress_test' );\n} else {\n// Else use the default one.\ndefine( 'DB_NAME', 'wordpress' );\n}\n

                                                                                                                                                                                                        If you're using the WPWebDriver module set the user agent in the browser, in this example I'm setting the user agent in Chromedriver:

                                                                                                                                                                                                        class_name: AcceptanceTester\nmodules:\nenabled:\n- \\Helper\\Acceptance\n- WPDb\n- WPWebDriver\nconfig:\nWPDb:\ndsn: 'mysql:host=%WP_DB_HOST%;dbname=%WP_DB_NAME%'\nuser: %WP_DB_USER%\npassword: %WP_DB_PASSWORD%\ndump: tests/_data/dump.sql\npopulate: true\ncleanup: false\nurl: '%WP_URL%'\ntablePrefix: %WP_TABLE_PREFIX%\nurlReplacement: true\nWPWebDriver:\nurl: '%WP_URL%'\nadminUsername: '%WP_ADMIN_USERNAME%'\nadminPassword: '%WP_ADMIN_PASSWORD%'\nadminPath: '%WP_ADMIN_PATH%'\nbrowser: chrome\nhost: localhost\nport: 4444\nwindow_size: false\nwait: 5\ncapabilities:\n# Used in more recent releases of Selenium.\n\"goog:chromeOptions\":\nargs: [\"--no-sandbox\", \"--headless\", \"--disable-gpu\", \"--user-agent=wp-browser\"]\n# Support the old format for back-compatibility purposes. \n\"chromeOptions\":\nargs: [\"--no-sandbox\", \"--headless\", \"--disable-gpu\", \"--user-agent=wp-browser\"]\n

                                                                                                                                                                                                        If you're using the WPBrowser module send a specific header in the context of test requests:

                                                                                                                                                                                                        class_name: AcceptanceTester\nmodules:\nenabled:\n- \\Helper\\Acceptance\n- WPDb\n- WPBrowser\nconfig:\nWPDb:\ndsn: 'mysql:host=%DB_HOST%;dbname=%WP_DB_NAME%'\nuser: %WP_DB_USER%\npassword: %WP_DB_PASSWORD%\ndump: 'tests/_data/dump.sql'\npopulate: true\ncleanup: true\nreconnect: false\nurl: '%WP_URL%'\ntablePrefix: 'wp_'\nWPBrowser:\nurl: '%WP_URL%'\nadminUsername: 'admin'\nadminPassword: 'admin'\nadminPath: '/wp-admin'\nheaders: X-Testing: 'wp-browser'\n

                                                                                                                                                                                                        "},{"location":"v3/modules/WPDb/#configuration","title":"Configuration","text":"
                                                                                                                                                                                                        • dsn required - the database POD DSN connection details; read more on PHP PDO documentation. If the database is accessible (as is the case on the latest version of [Local by Flywheel][http://localwp.com]) via unix socket, then the string to insert here should look like this mysql:unix_socket=/path/to/the/mysql.sock;dbname=wordpress.
                                                                                                                                                                                                        • user required - the database user.
                                                                                                                                                                                                        • password required - the database password.
                                                                                                                                                                                                        • url required - the full URL, including the HTTP scheme, of the website whose database is being accessed. WordPress uses hard-codece URLs in the database, that URL will be set by this module when applying the SQL dump file during population or cleanup.
                                                                                                                                                                                                        • dump required - defaults to null; sets the path, relative to the project root folder, or absolute to the SQL dump file that will be used to set the tests initial database fixture. If set to null then the populate, cleanup and populator parameters will be ignored.
                                                                                                                                                                                                        • populate - defaults to true to empty the target database and import the SQL dump(s) specified in the dump argument before the test suite is started.
                                                                                                                                                                                                        • cleanup - defaults to true empty the target database and import the SQL dump(s) specified in the dump argument before each test.
                                                                                                                                                                                                        • urlReplacement - defaults to true to replace, while using the built-in, PHP-based, dump import solution the hard-coded WordPress URL in the database with the specified one.
                                                                                                                                                                                                        • originalUrl - specifies the original URL hard-coded into the version controlled SQL dump files. This can help prevent some URL replacement issues when the urlReplacement configuration parameter is set to true.
                                                                                                                                                                                                        • populator - defaults to null, if set to an executable shell command then that command will be used to populate the database in place of the built-in PHP solution; URL replacement will not apply in this case. Read more about this on Codeception documentation.
                                                                                                                                                                                                        • reconnect - defaults to true to force the module to reconnect to the database before each test in place of only connecting at the start of the tests.
                                                                                                                                                                                                        • waitlock - defaults to 10; wait lock (in seconds) that the database session should use for DDL statements.
                                                                                                                                                                                                        • tablePrefix - defaults to wp_; sets the prefix of the tables that the module will manipulate.
                                                                                                                                                                                                        • letAdminEmailVerification - defaults to an empty value to remove the Administrator Email Verification screen introduced in WordPress 5.3. Set to true to not remove the screen and show it when an administrator user first logs in.
                                                                                                                                                                                                        • letCron - defaults to an empty value to avoid wp-cron from being spawned during tests. Setting this to true will let wp-cron requests to fire during tests.
                                                                                                                                                                                                        "},{"location":"v3/modules/WPDb/#example-configuration","title":"Example configuration","text":"
                                                                                                                                                                                                        modules:\nenabled:\n- WPDb\nconfig:\nWPDb:\ndsn: 'mysql:host=localhost;dbname=wordpress'\nuser: 'root'\npassword: 'password'\ndump: 'tests/_data/dump.sql'\npopulate: true\ncleanup: true\nwaitlock: 10\nurl: 'http://wordpress.localhost'\nurlReplacement: true\ntablePrefix: 'wp_'\n
                                                                                                                                                                                                        "},{"location":"v3/modules/WPDb/#using-the-module-with-the-wploader-one","title":"Using the module with the WPLoader one","text":"

                                                                                                                                                                                                        This module is often used in conjunction with the WPLoader one to use WordPress-defined functions, classes and methods in acceptance or functional tests. The WPLoader module should be set to only load WordPress and this module should be listed, in the modules.enabled section of the suite configuration file before the WPLoader one:

                                                                                                                                                                                                        modules:\nenabled:\n- WPDb # this before...\n- WPLoader # ...this one.\nconfig:\nWPDb:\n# ...\nWPLoader:\nloadOnly: true\n# ... \n
                                                                                                                                                                                                        This will avoid issues where the WPLoader module could exit, terminating the test run, due to an inconsistent database state.

                                                                                                                                                                                                        "},{"location":"v3/modules/WPDb/#public-api","title":"Public API","text":"
                                                                                                                                                                                                        • countRowsInDatabase
                                                                                                                                                                                                        • dontHaveAttachmentFilesInDatabase
                                                                                                                                                                                                        • dontHaveAttachmentInDatabase
                                                                                                                                                                                                        • dontHaveBlogInDatabase
                                                                                                                                                                                                        • dontHaveCommentInDatabase
                                                                                                                                                                                                        • dontHaveCommentMetaInDatabase
                                                                                                                                                                                                        • dontHaveInDatabase
                                                                                                                                                                                                        • dontHaveLinkInDatabase
                                                                                                                                                                                                        • dontHaveOptionInDatabase
                                                                                                                                                                                                        • dontHavePostInDatabase
                                                                                                                                                                                                        • dontHavePostMetaInDatabase
                                                                                                                                                                                                        • dontHavePostThumbnailInDatabase
                                                                                                                                                                                                        • dontHaveSiteOptionInDatabase
                                                                                                                                                                                                        • dontHaveSiteTransientInDatabase
                                                                                                                                                                                                        • dontHaveTableInDatabase
                                                                                                                                                                                                        • dontHaveTermInDatabase
                                                                                                                                                                                                        • dontHaveTermMetaInDatabase
                                                                                                                                                                                                        • dontHaveTermRelationshipInDatabase
                                                                                                                                                                                                        • dontHaveTermTaxonomyInDatabase
                                                                                                                                                                                                        • dontHaveTransientInDatabase
                                                                                                                                                                                                        • dontHaveUserInDatabase
                                                                                                                                                                                                        • dontHaveUserInDatabaseWithEmail
                                                                                                                                                                                                        • dontHaveUserMetaInDatabase
                                                                                                                                                                                                        • dontSeeAttachmentInDatabase
                                                                                                                                                                                                        • dontSeeBlogInDatabase
                                                                                                                                                                                                        • dontSeeCommentInDatabase
                                                                                                                                                                                                        • dontSeeCommentMetaInDatabase
                                                                                                                                                                                                        • dontSeeLinkInDatabase
                                                                                                                                                                                                        • dontSeeOptionInDatabase
                                                                                                                                                                                                        • dontSeePageInDatabase
                                                                                                                                                                                                        • dontSeePostInDatabase
                                                                                                                                                                                                        • dontSeePostMetaInDatabase
                                                                                                                                                                                                        • dontSeePostWithTermInDatabase
                                                                                                                                                                                                        • dontSeeSiteOptionInDatabase
                                                                                                                                                                                                        • dontSeeTableInDatabase
                                                                                                                                                                                                        • dontSeeTermInDatabase
                                                                                                                                                                                                        • dontSeeTermMetaInDatabase
                                                                                                                                                                                                        • dontSeeTermTaxonomyInDatabase
                                                                                                                                                                                                        • dontSeeUserInDatabase
                                                                                                                                                                                                        • dontSeeUserMetaInDatabase
                                                                                                                                                                                                        • getSiteDomain
                                                                                                                                                                                                        • getUsersTableName
                                                                                                                                                                                                        • grabAllFromDatabase
                                                                                                                                                                                                        • grabAttachmentAttachedFile
                                                                                                                                                                                                        • grabAttachmentMetadata
                                                                                                                                                                                                        • grabBlogDomain
                                                                                                                                                                                                        • grabBlogPath
                                                                                                                                                                                                        • grabBlogTableName
                                                                                                                                                                                                        • grabBlogTableNames
                                                                                                                                                                                                        • grabBlogTablePrefix
                                                                                                                                                                                                        • grabBlogVersionsTableName
                                                                                                                                                                                                        • grabBlogsTableName
                                                                                                                                                                                                        • grabCommentmetaTableName
                                                                                                                                                                                                        • grabCommentsTableName
                                                                                                                                                                                                        • grabLatestEntryByFromDatabase
                                                                                                                                                                                                        • grabLinksTableName
                                                                                                                                                                                                        • grabOptionFromDatabase
                                                                                                                                                                                                        • grabPostMetaFromDatabase
                                                                                                                                                                                                        • grabPostmetaTableName
                                                                                                                                                                                                        • grabPostsTableName
                                                                                                                                                                                                        • grabPrefixedTableNameFor
                                                                                                                                                                                                        • grabRegistrationLogTableName
                                                                                                                                                                                                        • grabSignupsTableName
                                                                                                                                                                                                        • grabSiteMetaTableName
                                                                                                                                                                                                        • grabSiteOptionFromDatabase
                                                                                                                                                                                                        • grabSiteTableName
                                                                                                                                                                                                        • grabSiteTransientFromDatabase
                                                                                                                                                                                                        • grabSiteUrl
                                                                                                                                                                                                        • grabTablePrefix
                                                                                                                                                                                                        • grabTermIdFromDatabase
                                                                                                                                                                                                        • grabTermMetaTableName
                                                                                                                                                                                                        • grabTermRelationshipsTableName
                                                                                                                                                                                                        • grabTermTaxonomyIdFromDatabase
                                                                                                                                                                                                        • grabTermTaxonomyTableName
                                                                                                                                                                                                        • grabTermsTableName
                                                                                                                                                                                                        • grabUserIdFromDatabase
                                                                                                                                                                                                        • grabUserMetaFromDatabase
                                                                                                                                                                                                        • grabUsermetaTableName
                                                                                                                                                                                                        • grabUsersTableName
                                                                                                                                                                                                        • haveAttachmentInDatabase
                                                                                                                                                                                                        • haveBlogInDatabase
                                                                                                                                                                                                        • haveCommentInDatabase
                                                                                                                                                                                                        • haveCommentMetaInDatabase
                                                                                                                                                                                                        • haveLinkInDatabase
                                                                                                                                                                                                        • haveManyBlogsInDatabase
                                                                                                                                                                                                        • haveManyCommentsInDatabase
                                                                                                                                                                                                        • haveManyLinksInDatabase
                                                                                                                                                                                                        • haveManyPostsInDatabase
                                                                                                                                                                                                        • haveManyTermsInDatabase
                                                                                                                                                                                                        • haveManyUsersInDatabase
                                                                                                                                                                                                        • haveMenuInDatabase
                                                                                                                                                                                                        • haveMenuItemInDatabase
                                                                                                                                                                                                        • haveOptionInDatabase
                                                                                                                                                                                                        • havePageInDatabase
                                                                                                                                                                                                        • havePostInDatabase
                                                                                                                                                                                                        • havePostThumbnailInDatabase
                                                                                                                                                                                                        • havePostmetaInDatabase
                                                                                                                                                                                                        • haveSiteOptionInDatabase
                                                                                                                                                                                                        • haveSiteTransientInDatabase
                                                                                                                                                                                                        • haveTermInDatabase
                                                                                                                                                                                                        • haveTermMetaInDatabase
                                                                                                                                                                                                        • haveTermRelationshipInDatabase
                                                                                                                                                                                                        • haveTransientInDatabase
                                                                                                                                                                                                        • haveUserCapabilitiesInDatabase
                                                                                                                                                                                                        • haveUserInDatabase
                                                                                                                                                                                                        • haveUserLevelsInDatabase
                                                                                                                                                                                                        • haveUserMetaInDatabase
                                                                                                                                                                                                        • importSql
                                                                                                                                                                                                        • importSqlDumpFile
                                                                                                                                                                                                        • seeAttachmentInDatabase
                                                                                                                                                                                                        • seeBlogInDatabase
                                                                                                                                                                                                        • seeCommentInDatabase
                                                                                                                                                                                                        • seeCommentMetaInDatabase
                                                                                                                                                                                                        • seeLinkInDatabase
                                                                                                                                                                                                        • seeOptionInDatabase
                                                                                                                                                                                                        • seePageInDatabase
                                                                                                                                                                                                        • seePostInDatabase
                                                                                                                                                                                                        • seePostMetaInDatabase
                                                                                                                                                                                                        • seePostWithTermInDatabase
                                                                                                                                                                                                        • seeSiteOptionInDatabase
                                                                                                                                                                                                        • seeSiteSiteTransientInDatabase
                                                                                                                                                                                                        • seeTableInDatabase
                                                                                                                                                                                                        • seeTermInDatabase
                                                                                                                                                                                                        • seeTermMetaInDatabase
                                                                                                                                                                                                        • seeTermRelationshipInDatabase
                                                                                                                                                                                                        • seeTermTaxonomyInDatabase
                                                                                                                                                                                                        • seeUserInDatabase
                                                                                                                                                                                                        • seeUserMetaInDatabase
                                                                                                                                                                                                        • useBlog
                                                                                                                                                                                                        • useMainBlog
                                                                                                                                                                                                        • useTheme
                                                                                                                                                                                                        countRowsInDatabase

                                                                                                                                                                                                        Returns the number of table rows matching a criteria.

                                                                                                                                                                                                        $I->haveManyPostsInDatabase(3, ['post_status' => 'draft' ]);\n  $I->haveManyPostsInDatabase(3, ['post_status' => 'private' ]);\n  // Make sure there are now the expected number of draft posts.\n  $postsTable = $I->grabPostsTableName();\n  $draftsCount = $I->countRowsInDatabase($postsTable, ['post_status' => 'draft']);\n
                                                                                                                                                                                                        Parameters
                                                                                                                                                                                                        • string $table - The table to count the rows in.
                                                                                                                                                                                                        • array/\\Codeception\\Module\\array/array $criteria - Search criteria, if empty all table rows will be counted. dontHaveAttachmentFilesInDatabase

                                                                                                                                                                                                          Removes all the files attached with an attachment post, it will not remove the database entries. Requires the WPFilesystem module to be loaded in the suite.

                                                                                                                                                                                                          $posts = $I->grabPostsTableName();\n  $attachmentIds = $I->grabColumnFromDatabase($posts, 'ID', ['post_type' => 'attachment']);\n  // This will only remove the files, not the database entries.\n  $I->dontHaveAttachmentFilesInDatabase($attachmentIds);\n
                                                                                                                                                                                                          Parameters
                                                                                                                                                                                                          • \\Codeception\\Module\\array/int $attachmentIds - An attachment post ID or an array of attachment post IDs. dontHaveAttachmentInDatabase

                                                                                                                                                                                                            Removes an attachment from the posts table. table. the suite.

                                                                                                                                                                                                            $postmeta = $I->grabpostmetatablename();\n  $thumbnailId = $I->grabFromDatabase($postmeta, 'meta_value', [\n  'post_id' => $id,\n  'meta_key'=>'thumbnail_id'\n  ]);\n  // Remove only the database entry (including postmeta) but not the files.\n  $I->dontHaveAttachmentInDatabase($thumbnailId);\n  // Remove the database entry (including postmeta) and the files.\n  $I->dontHaveAttachmentInDatabase($thumbnailId, true, true);\n
                                                                                                                                                                                                            Parameters
                                                                                                                                                                                                            • \\Codeception\\Module\\array/array $criteria - An array of search criteria to find the attachment post in the posts
                                                                                                                                                                                                            • bool $purgeMeta - If set to true then the meta for the attachment will be purged too.
                                                                                                                                                                                                            • bool $removeFiles - Remove all files too, requires the WPFilesystem module to be loaded in
                                                                                                                                                                                                            • dontHaveBlogInDatabase

                                                                                                                                                                                                              Removes one ore more blogs from the database.

                                                                                                                                                                                                              // Remove the blog, all its tables and files.\n  $I->dontHaveBlogInDatabase(['path' => 'test/one']);\n  // Remove the blog entry, not the tables though.\n  $I->dontHaveBlogInDatabase(['blog_id' => $blogId]);\n  // Remove multiple blogs.\n  $I->dontHaveBlogInDatabase(['domain' => 'test']);\n
                                                                                                                                                                                                              Parameters
                                                                                                                                                                                                              • \\Codeception\\Module\\array/array $criteria - An array of search criteria to find the blog rows in the blogs table.
                                                                                                                                                                                                              • bool $removeTables - Remove the blog tables.
                                                                                                                                                                                                              • bool $removeUploads - Remove the blog uploads; requires the WPFilesystem module.
                                                                                                                                                                                                              • dontHaveCommentInDatabase

                                                                                                                                                                                                                Removes an entry from the comments table.

                                                                                                                                                                                                                $I->dontHaveCommentInDatabase(['comment_post_ID' => 23, 'comment_url' => 'http://example.copm']);\n
                                                                                                                                                                                                                Parameters
                                                                                                                                                                                                                • \\Codeception\\Module\\array/array $criteria - An array of search criteria.
                                                                                                                                                                                                                • bool $purgeMeta - If set to true then the meta for the comment will be purged too.
                                                                                                                                                                                                                • dontHaveCommentMetaInDatabase

                                                                                                                                                                                                                  Removes a post comment meta from the database

                                                                                                                                                                                                                  // Remove all meta for the comment with an ID of 23.\n  $I->dontHaveCommentMetaInDatabase(['comment_id' => 23]);\n  // Remove the `count` comment meta for the comment with an ID of 23.\n  $I->dontHaveCommentMetaInDatabase(['comment_id' => 23, 'meta_key' => 'count']);\n
                                                                                                                                                                                                                  Parameters
                                                                                                                                                                                                                  • \\Codeception\\Module\\array/array $criteria - An array of search criteria. dontHaveInDatabase

                                                                                                                                                                                                                    Deletes a database entry. criteria.

                                                                                                                                                                                                                    $I->dontHaveInDatabase('custom_table', ['book_ID' => 23, 'book_genre' => 'fiction']);\n
                                                                                                                                                                                                                    Parameters
                                                                                                                                                                                                                    • string $table - The table name.
                                                                                                                                                                                                                    • \\Codeception\\Module\\array/array $criteria - An associative array of the column names and values to use as deletion dontHaveLinkInDatabase

                                                                                                                                                                                                                      Removes a link from the database.

                                                                                                                                                                                                                      $I->dontHaveLinkInDatabase(['link_url' => 'http://example.com']);\n
                                                                                                                                                                                                                      Parameters
                                                                                                                                                                                                                      • \\Codeception\\Module\\array/array $criteria - An array of search criteria. dontHaveOptionInDatabase

                                                                                                                                                                                                                        Removes an entry from the options table.

                                                                                                                                                                                                                        // Remove the `foo` option.\n  $I->dontHaveOptionInDatabase('foo');\n  // Remove the 'bar' option only if it has the `baz` value.\n  $I->dontHaveOptionInDatabase('bar', 'baz');\n
                                                                                                                                                                                                                        Parameters
                                                                                                                                                                                                                        • string $key - The option name.
                                                                                                                                                                                                                        • mixed/null $value - If set the option will only be removed if its value matches the passed one.
                                                                                                                                                                                                                        dontHavePostInDatabase

                                                                                                                                                                                                                        Removes an entry from the posts table.

                                                                                                                                                                                                                        $posts = $I->haveManyPostsInDatabase(3, ['post_title' => 'Test {{n}}']);\n  $I->dontHavePostInDatabase(['post_title' => 'Test 2']);\n
                                                                                                                                                                                                                        Parameters
                                                                                                                                                                                                                        • \\Codeception\\Module\\array/array $criteria - An array of search criteria.
                                                                                                                                                                                                                        • bool $purgeMeta - If set to true then the meta for the post will be purged too.
                                                                                                                                                                                                                        • dontHavePostMetaInDatabase

                                                                                                                                                                                                                          Removes an entry from the postmeta table.

                                                                                                                                                                                                                          $postId = $I->havePostInDatabase(['meta_input' => ['rating' => 23]]);\n  $I->dontHavePostMetaInDatabase(['post_id' => $postId, 'meta_key' => 'rating']);\n
                                                                                                                                                                                                                          Parameters
                                                                                                                                                                                                                          • \\Codeception\\Module\\array/array $criteria - An array of search criteria. dontHavePostThumbnailInDatabase

                                                                                                                                                                                                                            Remove the thumbnail (featured image) from a post, if any. Please note: the method will NOT remove the attachment post, post meta and file.

                                                                                                                                                                                                                            $attachmentId = $I->haveAttachmentInDatabase(codecept_data_dir('some-image.png'));\n  $postId = $I->havePostInDatabase();\n  // Attach the thumbnail to the post.\n  $I->havePostThumbnailInDatabase($postId, $attachmentId);\n  // Remove the thumbnail from the post.\n  $I->dontHavePostThumbnailInDatabase($postId);\n
                                                                                                                                                                                                                            Parameters
                                                                                                                                                                                                                            • int $postId - The post ID to remove the thumbnail (featured image) from.
                                                                                                                                                                                                                            dontHaveSiteOptionInDatabase

                                                                                                                                                                                                                            Removes a site option from the database.

                                                                                                                                                                                                                            // Remove the `foo_count` option.\n  $I->dontHaveSiteOptionInDatabase('foo_count');\n  // Remove the `foo_count` option only if its value is `23`.\n  $I->dontHaveSiteOptionInDatabase('foo_count', 23);\n
                                                                                                                                                                                                                            Parameters
                                                                                                                                                                                                                            • string $key - The option name.
                                                                                                                                                                                                                            • mixed/null $value - If set the option will only be removed it its value matches the specified one.
                                                                                                                                                                                                                            dontHaveSiteTransientInDatabase

                                                                                                                                                                                                                            Removes a site transient from the database.

                                                                                                                                                                                                                            $I->dontHaveSiteTransientInDatabase(['my_plugin_site_buffer']);\n
                                                                                                                                                                                                                            Parameters
                                                                                                                                                                                                                            • string $key - The name of the transient to delete.
                                                                                                                                                                                                                            dontHaveTableInDatabase

                                                                                                                                                                                                                            Removes a table from the database. The case where a table does not exist is handled without raising an error.

                                                                                                                                                                                                                            $ordersTable = $I->grabPrefixedTableNameFor('orders');\n  $I->dontHaveTableInDatabase($ordersTable);\n
                                                                                                                                                                                                                            Parameters
                                                                                                                                                                                                                            • string $fullTableName - The full table name, including the table prefix.
                                                                                                                                                                                                                            dontHaveTermInDatabase

                                                                                                                                                                                                                            Removes a term from the database.

                                                                                                                                                                                                                            $I->dontHaveTermInDatabase(['name' => 'romance']);\n  $I->dontHaveTermInDatabase(['slug' => 'genre--romance']);\n
                                                                                                                                                                                                                            Parameters
                                                                                                                                                                                                                            • \\Codeception\\Module\\array/array $criteria - An array of search criteria.
                                                                                                                                                                                                                            • bool $purgeMeta - Whether the terms meta should be purged along side with the meta or not.
                                                                                                                                                                                                                            • dontHaveTermMetaInDatabase

                                                                                                                                                                                                                              Removes a term meta from the database.

                                                                                                                                                                                                                              // Remove the \"karma\" key.\n  $I->dontHaveTermMetaInDatabase(['term_id' => $termId, 'meta_key' => 'karma']);\n  // Remove all meta for the term.\n  $I->dontHaveTermMetaInDatabase(['term_id' => $termId]);\n
                                                                                                                                                                                                                              Parameters
                                                                                                                                                                                                                              • \\Codeception\\Module\\array/array $criteria - An array of search criteria. dontHaveTermRelationshipInDatabase

                                                                                                                                                                                                                                Removes an entry from the term_relationships table.

                                                                                                                                                                                                                                // Remove the relation between a post and a category.\n  $I->dontHaveTermRelationshipInDatabase(['object_id' => $postId, 'term_taxonomy_id' => $ttaxId]);\n  // Remove all terms for a post.\n  $I->dontHaveTermMetaInDatabase(['object_id' => $postId]);\n
                                                                                                                                                                                                                                Parameters
                                                                                                                                                                                                                                • \\Codeception\\Module\\array/array $criteria - An array of search criteria. dontHaveTermTaxonomyInDatabase

                                                                                                                                                                                                                                  Removes an entry from the term_taxonomy table.

                                                                                                                                                                                                                                  // Remove a specific term from the genre taxonomy.\n  $I->dontHaveTermTaxonomyInDatabase(['term_id' => $postId, 'taxonomy' => 'genre']);\n  // Remove all terms for a taxonomy.\n  $I->dontHaveTermTaxonomyInDatabase(['taxonomy' => 'genre']);\n
                                                                                                                                                                                                                                  Parameters
                                                                                                                                                                                                                                  • \\Codeception\\Module\\array/array $criteria - An array of search criteria. dontHaveTransientInDatabase

                                                                                                                                                                                                                                    Removes a transient from the database.

                                                                                                                                                                                                                                    // Removes the `tweets` transient from the database, if set.\n  $I->dontHaveTransientInDatabase('tweets');\n
                                                                                                                                                                                                                                    Parameters
                                                                                                                                                                                                                                    • string $transient - The name of the transient to delete.
                                                                                                                                                                                                                                    dontHaveUserInDatabase

                                                                                                                                                                                                                                    Removes a user from the database.

                                                                                                                                                                                                                                    $bob = $I->haveUserInDatabase('bob');\n  $alice = $I->haveUserInDatabase('alice');\n  // Remove Bob's user and meta.\n  $I->dontHaveUserInDatabase('bob');\n  // Remove Alice's user but not meta.\n  $I->dontHaveUserInDatabase($alice);\n
                                                                                                                                                                                                                                    Parameters
                                                                                                                                                                                                                                    • int/string $userIdOrLogin - The user ID or login name.
                                                                                                                                                                                                                                    • bool $purgeMeta - Whether the user meta should be purged alongside the user or not.
                                                                                                                                                                                                                                    dontHaveUserInDatabaseWithEmail

                                                                                                                                                                                                                                    Removes a user(s) from the database using the user email address.

                                                                                                                                                                                                                                    $luca = $I->haveUserInDatabase('luca', 'editor', ['user_email' => 'luca@example.org']);\n
                                                                                                                                                                                                                                    Parameters
                                                                                                                                                                                                                                    • string $userEmail - The email of the user to remove.
                                                                                                                                                                                                                                    • bool $purgeMeta - Whether the user meta should be purged alongside the user or not.
                                                                                                                                                                                                                                    dontHaveUserMetaInDatabase

                                                                                                                                                                                                                                    Removes an entry from the usermeta table.

                                                                                                                                                                                                                                    // Remove the `karma` user meta for a user.\n  $I->dontHaveUserMetaInDatabase(['user_id' => 23, 'meta_key' => 'karma']);\n  // Remove all the user meta for a user.\n  $I->dontHaveUserMetaInDatabase(['user_id' => 23]);\n
                                                                                                                                                                                                                                    Parameters
                                                                                                                                                                                                                                    • \\Codeception\\Module\\array/array $criteria - An array of search criteria. dontSeeAttachmentInDatabase

                                                                                                                                                                                                                                      Checks that an attachment is not in the database.

                                                                                                                                                                                                                                      $url = 'https://example.org/images/foo.png';\n  $I->dontSeeAttachmentInDatabase(['guid' => $url]);\n
                                                                                                                                                                                                                                      Parameters
                                                                                                                                                                                                                                      • \\Codeception\\Module\\array/array $criteria - An array of search criteria. dontSeeBlogInDatabase

                                                                                                                                                                                                                                        Checks that a row is not present in the blogs table.

                                                                                                                                                                                                                                        $I->haveManyBlogsInDatabase(2, ['path' => 'test-{{n}}'], false)\n  $I->dontSeeBlogInDatabase(['path' => '/test-3/'])\n
                                                                                                                                                                                                                                        Parameters
                                                                                                                                                                                                                                        • \\Codeception\\Module\\array/array $criteria - An array of search criteria. dontSeeCommentInDatabase

                                                                                                                                                                                                                                          Checks that a comment is not in the database. Will look up the \"comments\" table.

                                                                                                                                                                                                                                          // Checks for one comment.\n  $I->dontSeeCommentInDatabase(['comment_ID' => 23]);\n  // Checks for comments from a user.\n  $I->dontSeeCommentInDatabase(['user_id' => 89]);\n
                                                                                                                                                                                                                                          Parameters
                                                                                                                                                                                                                                          • \\Codeception\\Module\\array/array $criteria - The search criteria. dontSeeCommentMetaInDatabase

                                                                                                                                                                                                                                            Checks that a comment meta value is not in the database. Will look up the \"commentmeta\" table.

                                                                                                                                                                                                                                            // Delete a comment `karma` meta.\n  $I->dontSeeCommentMetaInDatabase(['comment_id' => 23, 'meta_key' => 'karma']);\n  // Delete all meta for a comment.\n  $I->dontSeeCommentMetaInDatabase(['comment_id' => 23]);\n
                                                                                                                                                                                                                                            Parameters
                                                                                                                                                                                                                                            • \\Codeception\\Module\\array/array $criteria - An array of search criteria. dontSeeLinkInDatabase

                                                                                                                                                                                                                                              Checks that a link is not in the links database table.

                                                                                                                                                                                                                                              $I->dontSeeLinkInDatabase(['link_url' => 'http://example.com']);\n  $I->dontSeeLinkInDatabase(['link_url' => 'http://example.com', 'link_name' => 'example']);\n
                                                                                                                                                                                                                                              Parameters
                                                                                                                                                                                                                                              • \\Codeception\\Module\\array/array $criteria - An array of search criteria. dontSeeOptionInDatabase

                                                                                                                                                                                                                                                Checks that an option is not in the database for the current blog. If the value is an object or an array then the serialized option will be checked.

                                                                                                                                                                                                                                                $I->dontHaveOptionInDatabase('posts_per_page');\n  $I->dontSeeOptionInDatabase('posts_per_page');\n  $I->dontSeeOptionInDatabase('posts_per_page', 23);\n  $I->dontSeeOptionInDatabase(['option_name' => 'posts_per_page']);\n  $I->dontSeeOptionInDatabase(['option_name' => 'posts_per_page', 'option_value' => 23]);\n
                                                                                                                                                                                                                                                Parameters
                                                                                                                                                                                                                                                • \\Codeception\\Module\\array/string $criteriaOrName - An array of search criteria or the option name.
                                                                                                                                                                                                                                                • mixed/null $value - The optional value to try and match, only used if the option name is provided.
                                                                                                                                                                                                                                                • dontSeePageInDatabase

                                                                                                                                                                                                                                                  Checks that a page is not in the database.

                                                                                                                                                                                                                                                  // Assert a page with an ID does not exist.\n  $I->dontSeePageInDatabase(['ID' => 23]);\n  // Assert a page with a slug and ID.\n  $I->dontSeePageInDatabase(['post_name' => 'test', 'ID' => 23]);\n
                                                                                                                                                                                                                                                  Parameters
                                                                                                                                                                                                                                                  • \\Codeception\\Module\\array/array $criteria - An array of search criteria. dontSeePostInDatabase

                                                                                                                                                                                                                                                    Checks that a post is not in the database.

                                                                                                                                                                                                                                                    // Asserts a post with title 'Test' is not in the database.\n  $I->dontSeePostInDatabase(['post_title' => 'Test']);\n  // Asserts a post with title 'Test' and content 'Test content' is not in the database.\n  $I->dontSeePostInDatabase(['post_title' => 'Test', 'post_content' => 'Test content']);\n
                                                                                                                                                                                                                                                    Parameters
                                                                                                                                                                                                                                                    • \\Codeception\\Module\\array/array $criteria - An array of search criteria. dontSeePostMetaInDatabase

                                                                                                                                                                                                                                                      Checks that a post meta value does not exist. If the meta value is an object or an array then the check will be made on its serialized version.

                                                                                                                                                                                                                                                      $postId = $I->havePostInDatabase(['meta_input' => ['foo' => 'bar']]);\n  $I->dontSeePostMetaInDatabase(['post_id' => $postId, 'meta_key' => 'woot']);\n
                                                                                                                                                                                                                                                      Parameters
                                                                                                                                                                                                                                                      • \\Codeception\\Module\\array/array $criteria - An array of search criteria. dontSeePostWithTermInDatabase

                                                                                                                                                                                                                                                        Checks that a post to term relation does not exist in the database. The method will check the \"term_relationships\" table.

                                                                                                                                                                                                                                                        $fiction = $I->haveTermInDatabase('fiction', 'genre');\n  $nonFiction = $I->haveTermInDatabase('non-fiction', 'genre');\n  $postId = $I->havePostInDatabase(['tax_input' => ['genre' => ['fiction']]]);\n  $I->dontSeePostWithTermInDatabase($postId, $nonFiction['term_taxonomy_id], );\n  passed this parameter will be interpreted as a `term_id`, else as a\n  the\n  term order.\n  to build a `taxonomy_term_id` from the `term_id`.\n
                                                                                                                                                                                                                                                        Parameters
                                                                                                                                                                                                                                                        • int $post_id - The post ID.
                                                                                                                                                                                                                                                        • int $term_taxonomy_id - The term term_id or term_taxonomy_id; if the $taxonomy argument is
                                                                                                                                                                                                                                                        • int/null $term_order - The order the term applies to the post, defaults to null to not use
                                                                                                                                                                                                                                                        • string/null $taxonomy - The taxonomy the term_id is for; if passed this parameter will be used
                                                                                                                                                                                                                                                        dontSeeSiteOptionInDatabase

                                                                                                                                                                                                                                                        Checks that a site option is not in the database.

                                                                                                                                                                                                                                                        // Check that the option is not set in the database.\n  $I->dontSeeSiteOptionInDatabase('foo_count');\n  // Check that the option is not set with a specific value.\n  $I->dontSeeSiteOptionInDatabase('foo_count', 23);\n  $I->dontSeeSiteOptionInDatabase(['option_name => 'foo_count', 'option_value' => 23]);\n
                                                                                                                                                                                                                                                        Parameters
                                                                                                                                                                                                                                                        • \\Codeception\\Module\\array/string $criteriaOrName - An array of search criteria or the option name.
                                                                                                                                                                                                                                                        • mixed/null $value - The optional value to try and match, only used if the option name is provided.
                                                                                                                                                                                                                                                        • dontSeeTableInDatabase

                                                                                                                                                                                                                                                          Checks that a table is not in the database.

                                                                                                                                                                                                                                                          $options = $I->grabPrefixedTableNameFor('options');\n  $I->dontHaveTableInDatabase($options)\n  $I->dontSeeTableInDatabase($options);\n
                                                                                                                                                                                                                                                          Parameters
                                                                                                                                                                                                                                                          • string $table - The full table name, including the table prefix.
                                                                                                                                                                                                                                                          dontSeeTermInDatabase

                                                                                                                                                                                                                                                          Makes sure a term is not in the database. Looks up both the terms table and the term_taxonomy tables. and the term_taxonomy tables.

                                                                                                                                                                                                                                                          // Asserts a 'fiction' term is not in the database.\n  $I->dontSeeTermInDatabase(['name' => 'fiction']);\n  // Asserts a 'fiction' term with slug 'genre--fiction' is not in the database.\n  $I->dontSeeTermInDatabase(['name' => 'fiction', 'slug' => 'genre--fiction']);\n
                                                                                                                                                                                                                                                          Parameters
                                                                                                                                                                                                                                                          • \\Codeception\\Module\\array/array $criteria - An array of criteria to search for the term, can be columns from the terms dontSeeTermMetaInDatabase

                                                                                                                                                                                                                                                            Checks that a term meta is not in the database.

                                                                                                                                                                                                                                                            list($termId, $termTaxonomyId) = $I->haveTermInDatabase('fiction', 'genre');\n  $I->haveTermMetaInDatabase($termId, 'rating', 4);\n  $I->dontSeeTermMetaInDatabase(['term_id' => $termId,'meta_key' => 'average_review']);\n
                                                                                                                                                                                                                                                            Parameters
                                                                                                                                                                                                                                                            • \\Codeception\\Module\\array/array $criteria - An array of search criteria. dontSeeTermTaxonomyInDatabase

                                                                                                                                                                                                                                                              Checks that a term taxonomy is not in the database.

                                                                                                                                                                                                                                                              list($termId, $termTaxonomyId) = $I->haveTermInDatabase('fiction', 'genre');\n  $I->dontSeeTermTaxonomyInDatabase(['term_id' => $termId, 'taxonomy' => 'country']);\n
                                                                                                                                                                                                                                                              Parameters
                                                                                                                                                                                                                                                              • \\Codeception\\Module\\array/array $criteria - An array of search criteria. dontSeeUserInDatabase

                                                                                                                                                                                                                                                                Checks that a user is not in the database.

                                                                                                                                                                                                                                                                // Asserts a user does not exist in the database.\n  $I->dontSeeUserInDatabase(['user_login' => 'luca']);\n  // Asserts a user with email and login is not in the database.\n  $I->dontSeeUserInDatabase(['user_login' => 'luca', 'user_email' => 'luca@theaveragedev.com']);\n
                                                                                                                                                                                                                                                                Parameters
                                                                                                                                                                                                                                                                • \\Codeception\\Module\\array/array $criteria - An array of search criteria. dontSeeUserMetaInDatabase

                                                                                                                                                                                                                                                                  Check that a user meta value is not in the database.

                                                                                                                                                                                                                                                                  // Asserts a user does not have a 'karma' meta assigned.\n  $I->dontSeeUserMetaInDatabase(['user_id' => 23, 'meta_key' => 'karma']);\n  // Asserts no user has any 'karma' meta assigned.\n  $I->dontSeeUserMetaInDatabase(['meta_key' => 'karma']);\n
                                                                                                                                                                                                                                                                  Parameters
                                                                                                                                                                                                                                                                  • \\Codeception\\Module\\array/array $criteria - An array of search criteria. getSiteDomain

                                                                                                                                                                                                                                                                    Returns the site domain inferred from the url set in the config.

                                                                                                                                                                                                                                                                    $domain = $I->getSiteDomain();\n  // We should be redirected to the HTTPS version when visiting the HTTP version.\n  $I->amOnPage('http://' . $domain);\n  $I->seeCurrentUrlEquals('https://' . $domain);\n
                                                                                                                                                                                                                                                                    getUsersTableName

                                                                                                                                                                                                                                                                    Returns the prefixed users table name.

                                                                                                                                                                                                                                                                    // Given a `wp_` table prefix returns `wp_users`.\n  $usersTable = $I->getUsersTableName();\n  // Given a `wp_` table prefix returns `wp_users`.\n  $I->useBlog(23);\n  $usersTable = $I->getUsersTableName();\n
                                                                                                                                                                                                                                                                    grabAllFromDatabase

                                                                                                                                                                                                                                                                    Returns all entries matching a criteria from the database.

                                                                                                                                                                                                                                                                    $books = $I->grabPrefixedTableNameFor('books');\n  $I->grabAllFromDatabase($books, 'title', ['genre' => 'fiction']);\n
                                                                                                                                                                                                                                                                    Parameters
                                                                                                                                                                                                                                                                    • string $table - The table to grab the values from.
                                                                                                                                                                                                                                                                    • string $column - The column to fetch.
                                                                                                                                                                                                                                                                    • \\Codeception\\Module\\array $criteria - The search criteria. grabAttachmentAttachedFile

                                                                                                                                                                                                                                                                      Returns the path, as stored in the database, of an attachment _wp_attached_file meta. The attached file is, usually, an attachment origal file.

                                                                                                                                                                                                                                                                      $file = $I->grabAttachmentAttachedFile($attachmentId);\n  $fileInfo = new SplFileInfo($file);\n  $I->assertEquals('jpg', $fileInfo->getExtension());\n
                                                                                                                                                                                                                                                                      Parameters
                                                                                                                                                                                                                                                                      • int $attachmentPostId - The attachment post ID.
                                                                                                                                                                                                                                                                      grabAttachmentMetadata

                                                                                                                                                                                                                                                                      Returns the metadata array for an attachment post. This is the value of the _wp_attachment_metadata meta.

                                                                                                                                                                                                                                                                      $metadata = $I->grabAttachmentMetadata($attachmentId);\n  $I->assertEquals(['thumbnail', 'medium', 'medium_large'], array_keys($metadata['sizes']);\n
                                                                                                                                                                                                                                                                      Parameters
                                                                                                                                                                                                                                                                      • int $attachmentPostId - The attachment post ID.
                                                                                                                                                                                                                                                                      grabBlogDomain

                                                                                                                                                                                                                                                                      Returns a blog domain given its ID.

                                                                                                                                                                                                                                                                      $blogIds = $I->haveManyBlogsInDatabase(3);\n  $domains = array_map(function($blogId){\n  return $I->grabBlogDomain($blogId);\n  }, $blogIds);\n
                                                                                                                                                                                                                                                                      Parameters
                                                                                                                                                                                                                                                                      • int $blogId - The blog ID.
                                                                                                                                                                                                                                                                      grabBlogPath

                                                                                                                                                                                                                                                                      Grabs a blog domain from the blogs table.

                                                                                                                                                                                                                                                                      $blogId = $I->haveBlogInDatabase('test');\n  $path = $I->grabBlogDomain($blogId);\n  $I->amOnSubdomain($path);\n  $I->amOnPage('/');\n
                                                                                                                                                                                                                                                                      Parameters
                                                                                                                                                                                                                                                                      • int $blogId - The blog ID.
                                                                                                                                                                                                                                                                      grabBlogTableName

                                                                                                                                                                                                                                                                      Returns the full name of a table for a blog from a multisite installation database.

                                                                                                                                                                                                                                                                      $blogOptionTable = $I->grabBlogTableName($blogId, 'option');\n
                                                                                                                                                                                                                                                                      Parameters
                                                                                                                                                                                                                                                                      • int $blogId - The blog ID.
                                                                                                                                                                                                                                                                      • string $table - The table name, without table prefix.
                                                                                                                                                                                                                                                                      grabBlogTableNames

                                                                                                                                                                                                                                                                      Returns a list of tables for a blog ID.

                                                                                                                                                                                                                                                                      $blogId = $I->haveBlogInDatabase('test');\n  $tables = $I->grabBlogTableNames($blogId);\n  $options = array_filter($tables, function($tableName){\n  return str_pos($tableName, 'options') !== false;\n  });\n
                                                                                                                                                                                                                                                                      Parameters
                                                                                                                                                                                                                                                                      • int $blogId - The ID of the blog to fetch the tables for.
                                                                                                                                                                                                                                                                      grabBlogTablePrefix

                                                                                                                                                                                                                                                                      Returns the table prefix for a blog.

                                                                                                                                                                                                                                                                      $blogId = $I->haveBlogInDatabase('test');\n  $blogTablePrefix = $I->getBlogTablePrefix($blogId);\n  $blogOrders = $I->blogTablePrefix . 'orders';\n
                                                                                                                                                                                                                                                                      Parameters
                                                                                                                                                                                                                                                                      • int $blogId - The blog ID.
                                                                                                                                                                                                                                                                      grabBlogVersionsTableName

                                                                                                                                                                                                                                                                      Gets the prefixed blog_versions table name.

                                                                                                                                                                                                                                                                      // Assuming a `wp_` table prefix it will return `wp_blog_versions`.\n  $blogVersionsTable = $I->grabBlogVersionsTableName();\n  $I->useBlog(23);\n  // Assuming a `wp_` table prefix it will return `wp_blog_versions`.\n  $blogVersionsTable = $I->grabBlogVersionsTableName();\n
                                                                                                                                                                                                                                                                      grabBlogsTableName

                                                                                                                                                                                                                                                                      Gets the prefixed blogs table name.

                                                                                                                                                                                                                                                                      // Assuming a `wp_` table prefix it will return `wp_blogs`.\n  $blogVersionsTable = $I->grabBlogsTableName();\n  $I->useBlog(23);\n  // Assuming a `wp_` table prefix it will return `wp_blogs`.\n  $blogVersionsTable = $I->grabBlogsTableName();\n
                                                                                                                                                                                                                                                                      grabCommentmetaTableName

                                                                                                                                                                                                                                                                      Returns the prefixed comment meta table name.

                                                                                                                                                                                                                                                                      // Get all the values of 'karma' for all comments.\n  $commentMeta = $I->grabCommentmetaTableName();\n  $I->grabAllFromDatabase($commentMeta, 'meta_value', ['meta_key' => 'karma']);\n
                                                                                                                                                                                                                                                                      grabCommentsTableName

                                                                                                                                                                                                                                                                      Gets the comments table name.

                                                                                                                                                                                                                                                                      // Will be `wp_comments`.\n  $comments = $I->grabCommentsTableName();\n  // Will be `wp_23_comments`.\n  $I->useBlog(23);\n  $comments = $I->grabCommentsTableName();\n
                                                                                                                                                                                                                                                                      grabLatestEntryByFromDatabase

                                                                                                                                                                                                                                                                      Returns the id value of the last table entry.

                                                                                                                                                                                                                                                                      $I->haveManyPostsInDatabase();\n  $postsTable = $I->grabPostsTableName();\n  $last = $I->grabLatestEntryByFromDatabase($postsTable, 'ID');\n  items.\n
                                                                                                                                                                                                                                                                      Parameters
                                                                                                                                                                                                                                                                      • string $tableName - The table to fetch the last insertion for.
                                                                                                                                                                                                                                                                      • string $idColumn - The column that is used, in the table, to uniquely identify
                                                                                                                                                                                                                                                                      grabLinksTableName

                                                                                                                                                                                                                                                                      Returns the prefixed links table name.

                                                                                                                                                                                                                                                                      // Given a `wp_` table prefix returns `wp_links`.\n  $linksTable = $I->grabLinksTableName();\n  // Given a `wp_` table prefix returns `wp_23_links`.\n  $I->useBlog(23);\n  $linksTable = $I->grabLinksTableName();\n
                                                                                                                                                                                                                                                                      grabOptionFromDatabase

                                                                                                                                                                                                                                                                      Gets an option value from the database.

                                                                                                                                                                                                                                                                      $count = $I->grabOptionFromDatabase('foo_count');\n
                                                                                                                                                                                                                                                                      Parameters
                                                                                                                                                                                                                                                                      • string $option_name - The name of the option to grab from the database.
                                                                                                                                                                                                                                                                      grabPostMetaFromDatabase

                                                                                                                                                                                                                                                                      Gets the value of one or more post meta values from the database.

                                                                                                                                                                                                                                                                      $thumbnail_id = $I->grabPostMetaFromDatabase($postId, '_thumbnail_id', true);\n
                                                                                                                                                                                                                                                                      Parameters
                                                                                                                                                                                                                                                                      • int $postId - The post ID.
                                                                                                                                                                                                                                                                      • string $metaKey - The key of the meta to retrieve.
                                                                                                                                                                                                                                                                      • bool $single - Whether to return a single meta value or an array of all available meta values.
                                                                                                                                                                                                                                                                      grabPostmetaTableName

                                                                                                                                                                                                                                                                      Returns the prefixed post meta table name.

                                                                                                                                                                                                                                                                      // Returns 'wp_postmeta'.\n  $I->grabPostmetaTableName();\n  // Returns 'wp_23_postmeta'.\n  $I->useBlog(23);\n  $I->grabPostmetaTableName();\n
                                                                                                                                                                                                                                                                      grabPostsTableName

                                                                                                                                                                                                                                                                      Gets the posts prefixed table name.

                                                                                                                                                                                                                                                                      // Given a `wp_` table prefix returns `wp_posts`.\n  $postsTable = $I->grabPostsTableName();\n  // Given a `wp_` table prefix returns `wp_23_posts`.\n  $I->useBlog(23);\n  $postsTable = $I->grabPostsTableName();\n
                                                                                                                                                                                                                                                                      grabPrefixedTableNameFor

                                                                                                                                                                                                                                                                      Returns a prefixed table name for the current blog. If the table is not one to be prefixed (e.g. users) then the proper table name will be returned.

                                                                                                                                                                                                                                                                      // Will return wp_users.\n  $usersTable = $I->grabPrefixedTableNameFor('users');\n  // Will return wp_options.\n  $optionsTable = $I->grabPrefixedTableNameFor('options');\n  // Use a different blog and get its options table.\n  $I->useBlog(2);\n  $blogOptionsTable = $I->grabPrefixedTableNameFor('options');\n
                                                                                                                                                                                                                                                                      Parameters
                                                                                                                                                                                                                                                                      • string $tableName - The table name, e.g. options.
                                                                                                                                                                                                                                                                      grabRegistrationLogTableName

                                                                                                                                                                                                                                                                      Gets the prefixed registration_log table name.

                                                                                                                                                                                                                                                                      // Assuming a `wp_` table prefix it will return `wp_registration_log`.\n  $blogVersionsTable = $I->grabRegistrationLogTableName();\n  $I->useBlog(23);\n  // Assuming a `wp_` table prefix it will return `wp_registration_log`.\n  $blogVersionsTable = $I->grabRegistrationLogTableName();\n
                                                                                                                                                                                                                                                                      grabSignupsTableName

                                                                                                                                                                                                                                                                      Gets the prefixed signups table name.

                                                                                                                                                                                                                                                                      // Assuming a `wp_` table prefix it will return `wp_signups`.\n  $blogVersionsTable = $I->grabSignupsTableName();\n  $I->useBlog(23);\n  // Assuming a `wp_` table prefix it will return `wp_signups`.\n  $blogVersionsTable = $I->grabSignupsTableName();\n
                                                                                                                                                                                                                                                                      grabSiteMetaTableName

                                                                                                                                                                                                                                                                      Gets the prefixed sitemeta table name.

                                                                                                                                                                                                                                                                      // Assuming a `wp_` table prefix it will return `wp_sitemeta`.\n  $blogVersionsTable = $I->grabSiteMetaTableName();\n  $I->useBlog(23);\n  // Assuming a `wp_` table prefix it will return `wp_sitemeta`.\n  $blogVersionsTable = $I->grabSiteMetaTableName();\n
                                                                                                                                                                                                                                                                      grabSiteOptionFromDatabase

                                                                                                                                                                                                                                                                      Gets a site option from the database.

                                                                                                                                                                                                                                                                      $fooCountOptionId = $I->haveSiteOptionInDatabase('foo_count','23');\n
                                                                                                                                                                                                                                                                      Parameters
                                                                                                                                                                                                                                                                      • string $key - The name of the option to read from the database.
                                                                                                                                                                                                                                                                      grabSiteTableName

                                                                                                                                                                                                                                                                      Gets the prefixed site table name.

                                                                                                                                                                                                                                                                      // Assuming a `wp_` table prefix it will return `wp_site`.\n  $blogVersionsTable = $I->grabSiteTableName();\n  $I->useBlog(23);\n  // Assuming a `wp_` table prefix it will return `wp_site`.\n  $blogVersionsTable = $I->grabSiteTableName();\n
                                                                                                                                                                                                                                                                      grabSiteTransientFromDatabase

                                                                                                                                                                                                                                                                      Gets a site transient from the database.

                                                                                                                                                                                                                                                                      $I->grabSiteTransientFromDatabase('total_comments');\n  $I->grabSiteTransientFromDatabase('api_data');\n
                                                                                                                                                                                                                                                                      Parameters
                                                                                                                                                                                                                                                                      • string $key - The site transient to fetch the value for, w/o the _site_transient_ prefix.
                                                                                                                                                                                                                                                                      grabSiteUrl

                                                                                                                                                                                                                                                                      Returns the current site URL as specified in the module configuration.

                                                                                                                                                                                                                                                                      $shopPath = $I->grabSiteUrl('/shop');\n
                                                                                                                                                                                                                                                                      Parameters
                                                                                                                                                                                                                                                                      • string $path - A path that should be appended to the site URL.
                                                                                                                                                                                                                                                                      grabTablePrefix

                                                                                                                                                                                                                                                                      Returns the table prefix, namespaced for secondary blogs if selected.

                                                                                                                                                                                                                                                                      // Assuming a table prefix of `wp_` it will return `wp_`;\n  $tablePrefix = $I->grabTablePrefix();\n  $I->useBlog(23);\n  // Assuming a table prefix of `wp_` it will return `wp_23_`;\n  $tablePrefix = $I->grabTablePrefix();\n
                                                                                                                                                                                                                                                                      grabTermIdFromDatabase

                                                                                                                                                                                                                                                                      Gets a term ID from the database. Looks up the prefixed terms table, e.g. wp_terms.

                                                                                                                                                                                                                                                                      // Return the 'fiction' term 'term_id'.\n  $termId = $I->grabTermIdFromDatabase(['name' => 'fiction']);\n  // Get a term ID by more stringent criteria.\n  $termId = $I->grabTermIdFromDatabase(['name' => 'fiction', 'slug' => 'genre--fiction']);\n  // Return the 'term_id' of the first term for a group.\n  $termId = $I->grabTermIdFromDatabase(['term_group' => 23]);\n
                                                                                                                                                                                                                                                                      Parameters
                                                                                                                                                                                                                                                                      • \\Codeception\\Module\\array/array $criteria - An array of search criteria. grabTermMetaTableName

                                                                                                                                                                                                                                                                        Gets the terms meta table prefixed name.

                                                                                                                                                                                                                                                                        // Returns 'wp_termmeta'.\n  $I->grabTermMetaTableName();\n  // Returns 'wp_23_termmeta'.\n  $I->useBlog(23);\n  $I->grabTermMetaTableName();\n
                                                                                                                                                                                                                                                                        grabTermRelationshipsTableName

                                                                                                                                                                                                                                                                        Gets the prefixed term relationships table name, e.g. wp_term_relationships.

                                                                                                                                                                                                                                                                        $I->grabTermRelationshipsTableName();\n
                                                                                                                                                                                                                                                                        grabTermTaxonomyIdFromDatabase

                                                                                                                                                                                                                                                                        Gets a term_taxonomy_id from the database. Looks up the prefixed terms_relationships table, e.g. wp_term_relationships.

                                                                                                                                                                                                                                                                        // Get the `term_taxonomy_id` for a term and a taxonomy.\n  $I->grabTermTaxonomyIdFromDatabase(['term_id' => $fictionId, 'taxonomy' => 'genre']);\n  // Get the `term_taxonomy_id` for the first term with a count of 23.\n  $I->grabTermTaxonomyIdFromDatabase(['count' => 23]);\n
                                                                                                                                                                                                                                                                        Parameters
                                                                                                                                                                                                                                                                        • \\Codeception\\Module\\array/array $criteria - An array of search criteria. grabTermTaxonomyTableName

                                                                                                                                                                                                                                                                          Gets the prefixed term and taxonomy table name, e.g. wp_term_taxonomy.

                                                                                                                                                                                                                                                                          // Returns 'wp_term_taxonomy'.\n  $I->grabTermTaxonomyTableName();\n  // Returns 'wp_23_term_taxonomy'.\n  $I->useBlog(23);\n  $I->grabTermTaxonomyTableName();\n
                                                                                                                                                                                                                                                                          grabTermsTableName

                                                                                                                                                                                                                                                                          Gets the prefixed terms table name, e.g. wp_terms.

                                                                                                                                                                                                                                                                          // Returns 'wp_terms'.\n  $I->grabTermsTableName();\n  // Returns 'wp_23_terms'.\n  $I->useBlog(23);\n  $I->grabTermsTableName();\n
                                                                                                                                                                                                                                                                          grabUserIdFromDatabase

                                                                                                                                                                                                                                                                          Gets the a user ID from the database using the user login.

                                                                                                                                                                                                                                                                          $userId = $I->grabUserIdFromDatabase('luca');\n
                                                                                                                                                                                                                                                                          Parameters
                                                                                                                                                                                                                                                                          • string $userLogin - The user login name.
                                                                                                                                                                                                                                                                          grabUserMetaFromDatabase

                                                                                                                                                                                                                                                                          Gets a user meta from the database.

                                                                                                                                                                                                                                                                          // Returns a user 'karma' value.\n  $I->grabUserMetaFromDatabase($userId, 'karma');\n  // Returns an array, the unserialized version of the value stored in the database.\n  $I->grabUserMetaFromDatabase($userId, 'api_data');\n
                                                                                                                                                                                                                                                                          Parameters
                                                                                                                                                                                                                                                                          • int $userId - The ID of th user to get the meta for.
                                                                                                                                                                                                                                                                          • string $meta_key - The meta key to fetch the value for.
                                                                                                                                                                                                                                                                          grabUsermetaTableName

                                                                                                                                                                                                                                                                          Returns the prefixed users meta table name.

                                                                                                                                                                                                                                                                          // Given a `wp_` table prefix returns `wp_usermeta`.\n  $usermetaTable = $I->grabUsermetaTableName();\n  // Given a `wp_` table prefix returns `wp_usermeta`.\n  $I->useBlog(23);\n  $usermetaTable = $I->grabUsermetaTableName();\n
                                                                                                                                                                                                                                                                          grabUsersTableName

                                                                                                                                                                                                                                                                          Returns the prefixed users table name.

                                                                                                                                                                                                                                                                          // Given a `wp_` table prefix returns `wp_users`.\n  $usersTable = $I->grabUsersTableName();\n  // Given a `wp_` table prefix returns `wp_users`.\n  $I->useBlog(23);\n  $usersTable = $I->grabUsersTableName();\n
                                                                                                                                                                                                                                                                          haveAttachmentInDatabase

                                                                                                                                                                                                                                                                          Creates the database entries representing an attachment and moves the attachment file to the right location. timestamp that should be used to build the \"year/time\" uploads sub-folder structure. override the image sizes created by default.

                                                                                                                                                                                                                                                                          $file = codecept_data_dir('images/test.png');\n  $attachmentId = $I->haveAttachmentInDatabase($file);\n  $image = codecept_data_dir('images/test-2.png');\n  $lastWeekAttachment = $I->haveAttachmentInDatabase($image, '-1 week');\n  Requires the WPFilesystem module.\n
                                                                                                                                                                                                                                                                          Parameters
                                                                                                                                                                                                                                                                          • string $file - The absolute path to the attachment file.
                                                                                                                                                                                                                                                                          • string/string/int $date - Either a string supported by the strtotime function or a UNIX
                                                                                                                                                                                                                                                                          • array/\\Codeception\\Module\\array/array $overrides - An associative array of values overriding the default ones.
                                                                                                                                                                                                                                                                          • \\Codeception\\Module\\array> $imageSizes - An associative array in the format [ => [,]] to haveBlogInDatabase

                                                                                                                                                                                                                                                                            Inserts a blog in the blogs table.

                                                                                                                                                                                                                                                                            // Create the `test` subdomain blog.\n  $blogId = $I->haveBlogInDatabase('test', ['administrator' => $userId]);\n  // Create the `/test` subfolder blog.\n  $blogId = $I->haveBlogInDatabase('test', ['administrator' => $userId], false);\n  or subfolder (`true`)\n
                                                                                                                                                                                                                                                                            Parameters
                                                                                                                                                                                                                                                                            • string $domainOrPath - The subdomain or the path to the be used for the blog.
                                                                                                                                                                                                                                                                            • array/\\Codeception\\Module\\array/array $overrides - An array of values to override the defaults.
                                                                                                                                                                                                                                                                            • bool $subdomain - Whether the new blog should be created as a subdomain (true)
                                                                                                                                                                                                                                                                            • haveCommentInDatabase

                                                                                                                                                                                                                                                                              Inserts a comment in the database.

                                                                                                                                                                                                                                                                              $I->haveCommentInDatabase($postId, ['comment_content' => 'Test Comment', 'comment_karma' => 23]);\n
                                                                                                                                                                                                                                                                              Parameters
                                                                                                                                                                                                                                                                              • int $comment_post_ID - The id of the post the comment refers to.
                                                                                                                                                                                                                                                                              • array/\\Codeception\\Module\\array/array $data - The comment data overriding default and random generated values. haveCommentMetaInDatabase

                                                                                                                                                                                                                                                                                Inserts a comment meta field in the database. Array and object meta values will be serialized.

                                                                                                                                                                                                                                                                                $I->haveCommentMetaInDatabase($commentId, 'api_ID', 23);\n  // The value will be serialized.\n  $apiData = ['ID' => 23, 'user' => 89, 'origin' => 'twitter'];\n  $I->haveCommentMetaInDatabase($commentId, 'api_data', $apiData);\n
                                                                                                                                                                                                                                                                                Parameters
                                                                                                                                                                                                                                                                                • int $comment_id - The ID of the comment to insert the meta for.
                                                                                                                                                                                                                                                                                • string $meta_key - The key of the comment meta to insert.
                                                                                                                                                                                                                                                                                • mixed $meta_value - The value of the meta to insert, if serializable it will be serialized.
                                                                                                                                                                                                                                                                                haveLinkInDatabase

                                                                                                                                                                                                                                                                                Inserts a link in the database.

                                                                                                                                                                                                                                                                                $linkId = $I->haveLinkInDatabase(['link_url' => 'http://example.org']);\n
                                                                                                                                                                                                                                                                                Parameters
                                                                                                                                                                                                                                                                                • array/\\Codeception\\Module\\array/array $overrides - The data to insert. haveManyBlogsInDatabase

                                                                                                                                                                                                                                                                                  Inserts many blogs in the database. by the count.

                                                                                                                                                                                                                                                                                  $blogIds = $I->haveManyBlogsInDatabase(3, ['domain' =>'test-{{n}}']);\n  foreach($blogIds as $blogId){\n  $I->useBlog($blogId);\n  $I->haveManuPostsInDatabase(3);\n  }\n
                                                                                                                                                                                                                                                                                  Parameters
                                                                                                                                                                                                                                                                                  • int $count - The number of blogs to create.
                                                                                                                                                                                                                                                                                  • array/\\Codeception\\Module\\array/array $overrides - An array of values to override the default ones; {{n}} will be replaced
                                                                                                                                                                                                                                                                                  • bool $subdomain - Whether the new blogs should be created as a subdomain or subfolder.
                                                                                                                                                                                                                                                                                  • haveManyCommentsInDatabase

                                                                                                                                                                                                                                                                                    Inserts many comments in the database.

                                                                                                                                                                                                                                                                                    // Insert 3 random comments for a post.\n  $I->haveManyCommentsInDatabase(3, $postId);\n  // Insert 3 random comments for a post.\n  $I->haveManyCommentsInDatabase(3, $postId, ['comment_content' => 'Comment {{n}}']);\n
                                                                                                                                                                                                                                                                                    Parameters
                                                                                                                                                                                                                                                                                    • int $count - The number of comments to insert.
                                                                                                                                                                                                                                                                                    • int $comment_post_ID - The comment parent post ID.
                                                                                                                                                                                                                                                                                    • array/\\Codeception\\Module\\array/array $overrides - An associative array to override the defaults. haveManyLinksInDatabase

                                                                                                                                                                                                                                                                                      Inserts many links in the database links table.

                                                                                                                                                                                                                                                                                      // Insert 3 randomly generated links in the database.\n  $linkIds = $I->haveManyLinksInDatabase(3);\n  // Inserts links in the database replacing the `n` placeholder.\n  $linkIds = $I->haveManyLinksInDatabase(3, ['link_url' => 'http://example.org/test-{{n}}']);\n
                                                                                                                                                                                                                                                                                      Parameters
                                                                                                                                                                                                                                                                                      • int $count - The number of links to insert.
                                                                                                                                                                                                                                                                                      • array/\\Codeception\\Module\\array/array $overrides - Overrides for the default arguments. haveManyPostsInDatabase

                                                                                                                                                                                                                                                                                        Inserts many posts in the database returning their IDs. An array of values to override the defaults. The {{n}} placeholder can be used to have the post count inserted in its place; e.g. Post Title - {{n}} will be set to Post Title - 0 for the first post, Post Title - 1 for the second one and so on. The same applies to meta values as well.

                                                                                                                                                                                                                                                                                        // Insert 3 random posts.\n  $I->haveManyPostsInDatabase(3);\n  // Insert 3 posts with generated titles.\n  $I->haveManyPostsInDatabase(3, ['post_title' => 'Test post {{n}}']);\n
                                                                                                                                                                                                                                                                                        Parameters
                                                                                                                                                                                                                                                                                        • int $count - The number of posts to insert.
                                                                                                                                                                                                                                                                                        • array/\\Codeception\\Module\\array/array $overrides haveManyTermsInDatabase

                                                                                                                                                                                                                                                                                          Inserts many terms in the database.

                                                                                                                                                                                                                                                                                          $terms = $I->haveManyTermsInDatabase(3, 'genre-{{n}}', 'genre');\n  $termIds = array_column($terms, 0);\n  $termTaxonomyIds = array_column($terms, 1);\n
                                                                                                                                                                                                                                                                                          Parameters
                                                                                                                                                                                                                                                                                          • int $count - The number of terms to insert.
                                                                                                                                                                                                                                                                                          • string $name - The term name template, can include the {{n}} placeholder.
                                                                                                                                                                                                                                                                                          • string $taxonomy - The taxonomy to insert the terms for.
                                                                                                                                                                                                                                                                                          • array/\\Codeception\\Module\\array/array $overrides - An associative array of default overrides. haveManyUsersInDatabase

                                                                                                                                                                                                                                                                                            Inserts many users in the database.

                                                                                                                                                                                                                                                                                            $subscribers = $I->haveManyUsersInDatabase(5, 'user-{{n}}');\n  $editors = $I->haveManyUsersInDatabase(\n  5,\n  'user-{{n}}',\n  'editor',\n  ['user_email' => 'user-{{n}}@example.org']\n  );\n
                                                                                                                                                                                                                                                                                            Parameters
                                                                                                                                                                                                                                                                                            • int $count - The number of users to insert.
                                                                                                                                                                                                                                                                                            • string $user_login - The user login name.
                                                                                                                                                                                                                                                                                            • string $role - The user role.
                                                                                                                                                                                                                                                                                            • array/\\Codeception\\Module\\array/array $overrides - An array of values to override the default ones. haveMenuInDatabase

                                                                                                                                                                                                                                                                                              Creates and adds a menu to a theme location in the database.

                                                                                                                                                                                                                                                                                              list($termId, $termTaxId) = $I->haveMenuInDatabase('test', 'sidebar');\n
                                                                                                                                                                                                                                                                                              Parameters
                                                                                                                                                                                                                                                                                              • string $slug - The menu slug.
                                                                                                                                                                                                                                                                                              • string $location - The theme menu location the menu will be assigned to.
                                                                                                                                                                                                                                                                                              • array/\\Codeception\\Module\\array/array $overrides - An array of values to override the defaults. haveMenuItemInDatabase

                                                                                                                                                                                                                                                                                                Adds a menu element to a menu for the current theme. post meta.

                                                                                                                                                                                                                                                                                                $I->haveMenuInDatabase('test', 'sidebar');\n  $I->haveMenuItemInDatabase('test', 'Test one', 0);\n  $I->haveMenuItemInDatabase('test', 'Test two', 1);\n
                                                                                                                                                                                                                                                                                                Parameters
                                                                                                                                                                                                                                                                                                • string $menuSlug - The menu slug the item should be added to.
                                                                                                                                                                                                                                                                                                • string $title - The menu item title.
                                                                                                                                                                                                                                                                                                • int/null $menuOrder - An optional menu order, 1 based.
                                                                                                                                                                                                                                                                                                • array/\\Codeception\\Module\\array/array $meta - An associative array that will be prefixed with _menu_item_ for the item haveOptionInDatabase

                                                                                                                                                                                                                                                                                                  Inserts an option in the database.

                                                                                                                                                                                                                                                                                                  $I->haveOptionInDatabase('posts_per_page', 23);\n  $I->haveOptionInDatabase('my_plugin_options', ['key_one' => 'value_one', 'key_two' => 89]);\n  If the option value is an object or an array then the value will be serialized.\n
                                                                                                                                                                                                                                                                                                  Parameters
                                                                                                                                                                                                                                                                                                  • string $option_name - The option name.
                                                                                                                                                                                                                                                                                                  • mixed $option_value - The option value; if an array or object it will be serialized.
                                                                                                                                                                                                                                                                                                  • string $autoload - Weather the option should be autoloaded by WordPress or not.
                                                                                                                                                                                                                                                                                                  havePageInDatabase

                                                                                                                                                                                                                                                                                                  Inserts a page in the database.

                                                                                                                                                                                                                                                                                                  // Creates a test page in the database with random values.\n  $randomPageId = $I->havePageInDatabase();\n  // Creates a test page in the database defining its title.\n  $testPageId = $I->havePageInDatabase(['post_title' => 'Test page']);\n
                                                                                                                                                                                                                                                                                                  Parameters
                                                                                                                                                                                                                                                                                                  • array/\\Codeception\\Module\\array/array $overrides - An array of values to override the default ones. havePostInDatabase

                                                                                                                                                                                                                                                                                                    Inserts a post in the database. values.

                                                                                                                                                                                                                                                                                                    // Insert a post with random values in the database.\n  $randomPostId = $I->havePostInDatabase();\n  // Insert a post with specific values in the database.\n  $I->havePostInDatabase([\n  'post_type' => 'book',\n  'post_title' => 'Alice in Wonderland',\n  'meta_input' => [\n  'readers_count' => 23\n  ],\n  'tax_input' => [\n  ['genre' => 'fiction']\n  ]\n  ]);\n
                                                                                                                                                                                                                                                                                                    Parameters
                                                                                                                                                                                                                                                                                                    • array/\\Codeception\\Module\\array/array $data - An associative array of post data to override default and random generated havePostThumbnailInDatabase

                                                                                                                                                                                                                                                                                                      Assigns the specified attachment ID as thumbnail (featured image) to a post.

                                                                                                                                                                                                                                                                                                      $attachmentId = $I->haveAttachmentInDatabase(codecept_data_dir('some-image.png'));\n  $postId = $I->havePostInDatabase();\n  $I->havePostThumbnailInDatabase($postId, $attachmentId);\n
                                                                                                                                                                                                                                                                                                      Parameters
                                                                                                                                                                                                                                                                                                      • int $postId - The post ID to assign the thumbnail (featured image) to.
                                                                                                                                                                                                                                                                                                      • int $thumbnailId - The post ID of the attachment.
                                                                                                                                                                                                                                                                                                      havePostmetaInDatabase

                                                                                                                                                                                                                                                                                                      Adds one or more meta key and value couples in the database for a post.

                                                                                                                                                                                                                                                                                                      // Set the post-meta for a post.\n  $I->havePostmetaInDatabase($postId, 'karma', 23);\n  // Set an array post-meta for a post, it will be serialized in the db.\n  $I->havePostmetaInDatabase($postId, 'data', ['one', 'two']);\n  // Use a loop to insert one meta per row.\n  foreach( ['one', 'two'] as $value){\n  $I->havePostmetaInDatabase($postId, 'data', $value);\n  }\n
                                                                                                                                                                                                                                                                                                      Parameters
                                                                                                                                                                                                                                                                                                      • int $postId - The post ID.
                                                                                                                                                                                                                                                                                                      • string $meta_key - The meta key.
                                                                                                                                                                                                                                                                                                      • mixed $meta_value - The value to insert in the database, objects and arrays will be serialized.
                                                                                                                                                                                                                                                                                                      haveSiteOptionInDatabase

                                                                                                                                                                                                                                                                                                      Inserts a site option in the database. If the value is an array or an object then the value will be serialized.

                                                                                                                                                                                                                                                                                                      $fooCountOptionId = $I->haveSiteOptionInDatabase('foo_count','23');\n
                                                                                                                                                                                                                                                                                                      Parameters
                                                                                                                                                                                                                                                                                                      • string $key - The name of the option to insert.
                                                                                                                                                                                                                                                                                                      • mixed $value - The value to insert for the option.
                                                                                                                                                                                                                                                                                                      haveSiteTransientInDatabase

                                                                                                                                                                                                                                                                                                      Inserts a site transient in the database. If the value is an array or an object then the value will be serialized.

                                                                                                                                                                                                                                                                                                      $I->haveSiteTransientInDatabase('total_comments_count', 23);\n  // This value will be serialized.\n  $I->haveSiteTransientInDatabase('api_data', ['user' => 'luca', 'token' => '11ae3ijns-j83']);\n
                                                                                                                                                                                                                                                                                                      Parameters
                                                                                                                                                                                                                                                                                                      • string $key - The key of the site transient to insert, w/o the _site_transient_ prefix.
                                                                                                                                                                                                                                                                                                      • mixed $value - The value to insert; if serializable the value will be serialized.
                                                                                                                                                                                                                                                                                                      haveTermInDatabase

                                                                                                                                                                                                                                                                                                      Inserts a term in the database.

                                                                                                                                                                                                                                                                                                      // Insert a random 'genre' term in the database.\n  $I->haveTermInDatabase('non-fiction', 'genre');\n  // Insert a term in the database with term meta.\n  $I->haveTermInDatabase('fiction', 'genre', [\n  'slug' => 'genre--fiction',\n  'meta' => [\n  'readers_count' => 23\n  ]\n  ]);\n
                                                                                                                                                                                                                                                                                                      Parameters
                                                                                                                                                                                                                                                                                                      • string $name - The term name, e.g. \"Fuzzy\".
                                                                                                                                                                                                                                                                                                      • string $taxonomy - The term taxonomy
                                                                                                                                                                                                                                                                                                      • array/\\Codeception\\Module\\array/array $overrides - An array of values to override the default ones. haveTermMetaInDatabase

                                                                                                                                                                                                                                                                                                        Inserts a term meta row in the database. Objects and array meta values will be serialized.

                                                                                                                                                                                                                                                                                                        $I->haveTermMetaInDatabase($fictionId, 'readers_count', 23);\n  // Insert some meta that will be serialized.\n  $I->haveTermMetaInDatabase($fictionId, 'flags', [3, 4, 89]);\n  // Use a loop to insert one meta per row.\n  foreach([3, 4, 89] as $value) {\n  $I->haveTermMetaInDatabase($fictionId, 'flag', $value);\n  }\n
                                                                                                                                                                                                                                                                                                        Parameters
                                                                                                                                                                                                                                                                                                        • int $term_id - The ID of the term to insert the meta for.
                                                                                                                                                                                                                                                                                                        • string $meta_key - The key of the meta to insert.
                                                                                                                                                                                                                                                                                                        • mixed $meta_value - The value of the meta to insert, if serializable it will be serialized.
                                                                                                                                                                                                                                                                                                        haveTermRelationshipInDatabase

                                                                                                                                                                                                                                                                                                        Creates a term relationship in the database. No check about the consistency of the insertion is made. E.g. a post could be assigned a term from a taxonomy that's not registered for that post type.

                                                                                                                                                                                                                                                                                                        // Assign the `fiction` term to a book.\n  $I->haveTermRelationshipInDatabase($bookId, $fictionId);\n
                                                                                                                                                                                                                                                                                                        Parameters
                                                                                                                                                                                                                                                                                                        • int $object_id - A post ID, a user ID or anything that can be assigned a taxonomy term.
                                                                                                                                                                                                                                                                                                        • int $term_taxonomy_id - The term_taxonomy_id of the term and taxonomy to create a relation with.
                                                                                                                                                                                                                                                                                                        • int $term_order - Defaults to 0.
                                                                                                                                                                                                                                                                                                        haveTransientInDatabase

                                                                                                                                                                                                                                                                                                        Inserts a transient in the database. If the value is an array or an object then the value will be serialized. Since the transients are set in the context of tests it's not possible to set an expiration directly.

                                                                                                                                                                                                                                                                                                        // Store an array in the `tweets` transient.\n  $I->haveTransientInDatabase('tweets', $tweets);\n
                                                                                                                                                                                                                                                                                                        Parameters
                                                                                                                                                                                                                                                                                                        • string $transient - The transient name.
                                                                                                                                                                                                                                                                                                        • mixed $value - The transient value.
                                                                                                                                                                                                                                                                                                        haveUserCapabilitiesInDatabase

                                                                                                                                                                                                                                                                                                        Sets a user capabilities in the database.

                                                                                                                                                                                                                                                                                                        // Assign one user a role in a blog.\n  $blogId = $I->haveBlogInDatabase('test');\n  $editor = $I->haveUserInDatabase('luca', 'editor');\n  $capsIds = $I->haveUserCapabilitiesInDatabase($editor, [$blogId => 'editor']);\n  // Assign a user two roles in blog 1.\n  $capsIds = $I->haveUserCapabilitiesInDatabase($userId, ['editor', 'subscriber']);\n  // Assign one user different roles in different blogs.\n  $capsIds = $I->haveUserCapabilitiesInDatabase($userId, [$blogId1 => 'editor', $blogId2 => 'author']);\n  // Assign a user a role and an additional capability in blog 1.\n  $I->haveUserCapabilitiesInDatabase($userId, ['editor' => true, 'edit_themes' => true]);\n  // Assign a user a mix of roles and capabilities in different blogs.\n  $capsIds = $I->haveUserCapabilitiesInDatabase(\n  $userId,\n  [\n  $blogId1 => ['editor' => true, 'edit_themes' => true],\n  $blogId2 => ['administrator' => true, 'edit_themes' => false]\n  ]\n  );\n  associative array of blog IDs/roles for a multisite\n  installation (e.g. `[1 => 'administrator`, 2 =>\n  'subscriber']`).\n
                                                                                                                                                                                                                                                                                                        Parameters
                                                                                                                                                                                                                                                                                                        • int $userId - The ID of the user to set the capabilities of.
                                                                                                                                                                                                                                                                                                        • string/\\Codeception\\Module\\array/\\Codeception\\Module\\array $role - Either a role string (e.g. administrator),an haveUserInDatabase

                                                                                                                                                                                                                                                                                                          Inserts a user and its meta in the database. defaults to subscriber. If more than one role is specified, then the first role in the list will be the user primary role and the wp_user_level will be set to that role. in the users and usermeta table.

                                                                                                                                                                                                                                                                                                          // Create an editor user in blog 1 w/ specific email.\n  $userId = $I->haveUserInDatabase('luca', 'editor', ['user_email' => 'luca@example.org']);\n  // Create a subscriber user in blog 1.\n  $subscriberId = $I->haveUserInDatabase('subscriber');\n  // Create a user editor in blog 1, author in blog 2, administrator in blog 3.\n  $userWithMeta = $I->haveUserInDatabase('luca',\n  [\n  1 => 'editor',\n  2 => 'author',\n  3 => 'administrator'\n  ], [\n  'user_email' => 'luca@example.org'\n  'meta' => ['a meta_key' => 'a_meta_value']\n  ]\n  );\n  // Create editor in blog 1 w/ `edit_themes` cap, author in blog 2, admin in blog 3 w/o `manage_options` cap.\n  $userWithMeta = $I->haveUserInDatabase('luca',\n  [\n  1 => ['editor', 'edit_themes'],\n  2 => 'author',\n  3 => ['administrator' => true, 'manage_options' => false]\n  ]\n  );\n  // Create a user w/o role.\n  $userId = $I->haveUserInDatabase('luca', '');\n
                                                                                                                                                                                                                                                                                                          Parameters
                                                                                                                                                                                                                                                                                                          • string $user_login - The user login name.
                                                                                                                                                                                                                                                                                                          • string/string/\\Codeception\\Module\\array $role - The user role slug(s), e.g. administrator or ['author', 'editor'];
                                                                                                                                                                                                                                                                                                          • array/\\Codeception\\Module\\array/array $overrides - An associative array of column names and values overriding defaults haveUserLevelsInDatabase

                                                                                                                                                                                                                                                                                                            Sets the user access level meta in the database for a user. IDs/roles for a multisite installation (e.g. [1 => 'administrator, 2 => 'subscriber']`).

                                                                                                                                                                                                                                                                                                            $userId = $I->haveUserInDatabase('luca', 'editor');\n  $moreThanAnEditorLessThanAnAdmin = 8;\n  $I->haveUserLevelsInDatabase($userId, $moreThanAnEditorLessThanAnAdmin);\n
                                                                                                                                                                                                                                                                                                            Parameters
                                                                                                                                                                                                                                                                                                            • int $userId - The ID of the user to set the level for.
                                                                                                                                                                                                                                                                                                            • \\Codeception\\Module\\array/string $role - Either a role string (e.g. administrator) or an array of blog haveUserMetaInDatabase

                                                                                                                                                                                                                                                                                                              Sets a user meta in the database.

                                                                                                                                                                                                                                                                                                              $userId = $I->haveUserInDatabase('luca', 'editor');\n  $I->haveUserMetaInDatabase($userId, 'karma', 23);\n  values will trigger the insertion of multiple rows.\n
                                                                                                                                                                                                                                                                                                              Parameters
                                                                                                                                                                                                                                                                                                              • int $userId - The user ID.
                                                                                                                                                                                                                                                                                                              • string $meta_key - The meta key to set the value for.
                                                                                                                                                                                                                                                                                                              • mixed $meta_value - Either a single value or an array of values; objects will be serialized while array of
                                                                                                                                                                                                                                                                                                              importSql

                                                                                                                                                                                                                                                                                                              Loads a set SQL code lines in the current database.

                                                                                                                                                                                                                                                                                                              // Import a SQL string.\n  $I->importSql([$sqlString]);\n  // Import a set of SQL strings.\n  $I->importSql($sqlStrings);\n  // Import a prepared set of SQL strings.\n  $preparedSqlStrings = array_map(function($line){\n  return str_replace('{{date}}', date('Y-m-d H:i:s'), $line);\n  }, $sqlTemplate);\n  $I->importSql($preparedSqlStrings);\n
                                                                                                                                                                                                                                                                                                              Parameters
                                                                                                                                                                                                                                                                                                              • \\Codeception\\Module\\array/array $sql - The SQL strings to load. importSqlDumpFile

                                                                                                                                                                                                                                                                                                                Import the SQL dump file if populate is enabled.

                                                                                                                                                                                                                                                                                                                // Import a dump file passing the absolute path.\n  $I->importSqlDumpFile(codecept_data_dir('dumps/start.sql'));\n  Specifying a dump file that file will be imported.\n
                                                                                                                                                                                                                                                                                                                Parameters
                                                                                                                                                                                                                                                                                                                • string/null $dumpFile - The dump file that should be imported in place of the default one.
                                                                                                                                                                                                                                                                                                                seeAttachmentInDatabase

                                                                                                                                                                                                                                                                                                                Checks for an attachment in the database.

                                                                                                                                                                                                                                                                                                                $url = 'https://example.org/images/foo.png';\n  $I->seeAttachmentInDatabase(['guid' => $url]);\n
                                                                                                                                                                                                                                                                                                                Parameters
                                                                                                                                                                                                                                                                                                                • \\Codeception\\Module\\array/array $criteria - An array of search criteria. seeBlogInDatabase

                                                                                                                                                                                                                                                                                                                  Checks for a blog in the blogs table.

                                                                                                                                                                                                                                                                                                                  // Search for a blog by `blog_id`.\n  $I->seeBlogInDatabase(['blog_id' => 23]);\n  // Search for all blogs on a path.\n  $I->seeBlogInDatabase(['path' => '/sub-path/']);\n
                                                                                                                                                                                                                                                                                                                  Parameters
                                                                                                                                                                                                                                                                                                                  • \\Codeception\\Module\\array/array $criteria - An array of search criteria. seeCommentInDatabase

                                                                                                                                                                                                                                                                                                                    Checks for a comment in the database. Will look up the \"comments\" table.

                                                                                                                                                                                                                                                                                                                    $I->seeCommentInDatabase(['comment_ID' => 23]);\n
                                                                                                                                                                                                                                                                                                                    Parameters
                                                                                                                                                                                                                                                                                                                    • \\Codeception\\Module\\array/array $criteria - An array of search criteria. seeCommentMetaInDatabase

                                                                                                                                                                                                                                                                                                                      Checks that a comment meta value is in the database. Will look up the \"commentmeta\" table.

                                                                                                                                                                                                                                                                                                                      // Assert a specified meta for a comment exists.\n  $I->seeCommentMetaInDatabase(['comment_ID' => $commentId, 'meta_key' => 'karma', 'meta_value' => 23]);\n  // Assert the comment has at least one meta set.\n  $I->seeCommentMetaInDatabase(['comment_ID' => $commentId]);\n
                                                                                                                                                                                                                                                                                                                      Parameters
                                                                                                                                                                                                                                                                                                                      • \\Codeception\\Module\\array/array $criteria - An array of search criteria. seeLinkInDatabase

                                                                                                                                                                                                                                                                                                                        Checks for a link in the links table of the database.

                                                                                                                                                                                                                                                                                                                        // Asserts a link exists by name.\n  $I->seeLinkInDatabase(['link_name' => 'my-link']);\n  // Asserts at least one link exists for the user.\n  $I->seeLinkInDatabase(['link_owner' => $userId]);\n
                                                                                                                                                                                                                                                                                                                        Parameters
                                                                                                                                                                                                                                                                                                                        • \\Codeception\\Module\\array/array $criteria - An array of search criteria. seeOptionInDatabase

                                                                                                                                                                                                                                                                                                                          Checks if an option is in the database for the current blog, either by criteria or by name and value. If checking for an array or an object then the serialized version will be checked for.

                                                                                                                                                                                                                                                                                                                          // Checks an option is in the database.\n  $I->seeOptionInDatabase('tables_version');\n  // Checks an option is in the database and has a specific value.\n  $I->seeOptionInDatabase('tables_version', '1.0');\n  $I->seeOptionInDatabase(['option_name' => 'tables_version', 'option_value' => 1.0']);\n
                                                                                                                                                                                                                                                                                                                          Parameters
                                                                                                                                                                                                                                                                                                                          • \\Codeception\\Module\\array/string $criteriaOrName - An array of search criteria or the option name.
                                                                                                                                                                                                                                                                                                                          • mixed/null $value - The optional value to try and match, only used if the option name is provided.
                                                                                                                                                                                                                                                                                                                          • seePageInDatabase

                                                                                                                                                                                                                                                                                                                            Checks for a page in the database.

                                                                                                                                                                                                                                                                                                                            // Asserts a page with an exists in the database.\n  $I->seePageInDatabase(['ID' => 23]);\n  // Asserts a page with a slug and ID exists in the database.\n  $I->seePageInDatabase(['post_title' => 'Test Page', 'ID' => 23]);\n
                                                                                                                                                                                                                                                                                                                            Parameters
                                                                                                                                                                                                                                                                                                                            • \\Codeception\\Module\\array/array $criteria - An array of search criteria. seePostInDatabase

                                                                                                                                                                                                                                                                                                                              Checks for a post in the database.

                                                                                                                                                                                                                                                                                                                              // Assert a post exists in the database.\n  $I->seePostInDatabase(['ID' => 23]);\n  // Assert a post with a slug and ID exists in the database.\n  $I->seePostInDatabase(['post_content' => 'test content', 'ID' => 23]);\n
                                                                                                                                                                                                                                                                                                                              Parameters
                                                                                                                                                                                                                                                                                                                              • \\Codeception\\Module\\array/array $criteria - An array of search criteria. seePostMetaInDatabase

                                                                                                                                                                                                                                                                                                                                Checks for a post meta value in the database for the current blog. If the meta_value is an object or an array then the check will be made for serialized values.

                                                                                                                                                                                                                                                                                                                                $postId = $I->havePostInDatabase(['meta_input' => ['foo' => 'bar']];\n  $I->seePostMetaInDatabase(['post_id' => '$postId', 'meta_key' => 'foo']);\n
                                                                                                                                                                                                                                                                                                                                Parameters
                                                                                                                                                                                                                                                                                                                                • \\Codeception\\Module\\array/array $criteria - An array of search criteria. seePostWithTermInDatabase

                                                                                                                                                                                                                                                                                                                                  Checks that a post to term relation exists in the database. The method will check the \"term_relationships\" table.

                                                                                                                                                                                                                                                                                                                                  $fiction = $I->haveTermInDatabase('fiction', 'genre');\n  $postId = $I->havePostInDatabase(['tax_input' => ['genre' => ['fiction']]]);\n  $I->seePostWithTermInDatabase($postId, $fiction['term_taxonomy_id']);\n  passed this parameter will be interpreted as a `term_id`, else as a\n  the\n  term order.\n  to build a `taxonomy_term_id` from the `term_id`.\n
                                                                                                                                                                                                                                                                                                                                  Parameters
                                                                                                                                                                                                                                                                                                                                  • int $post_id - The post ID.
                                                                                                                                                                                                                                                                                                                                  • int $term_taxonomy_id - The term term_id or term_taxonomy_id; if the $taxonomy argument is
                                                                                                                                                                                                                                                                                                                                  • int/null $term_order - The order the term applies to the post, defaults to null to not use
                                                                                                                                                                                                                                                                                                                                  • string/null $taxonomy - The taxonomy the term_id is for; if passed this parameter will be used
                                                                                                                                                                                                                                                                                                                                  seeSiteOptionInDatabase

                                                                                                                                                                                                                                                                                                                                  Checks that a site option is in the database.

                                                                                                                                                                                                                                                                                                                                  // Check that the option is set in the database.\n  $I->seeSiteOptionInDatabase('foo_count');\n  // Check that the option is set and has a specific value.\n  $I->seeSiteOptionInDatabase('foo_count', 23);\n
                                                                                                                                                                                                                                                                                                                                  Parameters
                                                                                                                                                                                                                                                                                                                                  • \\Codeception\\Module\\array/string $criteriaOrName - An array of search criteria or the option name.
                                                                                                                                                                                                                                                                                                                                  • mixed/null $value - The optional value to try and match, only used if the option name is provided.
                                                                                                                                                                                                                                                                                                                                  • seeSiteSiteTransientInDatabase

                                                                                                                                                                                                                                                                                                                                    Checks that a site option is in the database.

                                                                                                                                                                                                                                                                                                                                    // Check a transient exists.\n  $I->seeSiteSiteTransientInDatabase('total_counts');\n  // Check a transient exists and has a specific value.\n  $I->seeSiteSiteTransientInDatabase('total_counts', 23);\n
                                                                                                                                                                                                                                                                                                                                    Parameters
                                                                                                                                                                                                                                                                                                                                    • string $key - The name of the transient to check for, w/o the _site_transient_ prefix.
                                                                                                                                                                                                                                                                                                                                    • mixed/null $value - If provided then the assertion will include the value.
                                                                                                                                                                                                                                                                                                                                    seeTableInDatabase

                                                                                                                                                                                                                                                                                                                                    Checks that a table is in the database.

                                                                                                                                                                                                                                                                                                                                    $options = $I->grabPrefixedTableNameFor('options');\n  $I->seeTableInDatabase($options);\n
                                                                                                                                                                                                                                                                                                                                    Parameters
                                                                                                                                                                                                                                                                                                                                    • string $table - The full table name, including the table prefix.
                                                                                                                                                                                                                                                                                                                                    seeTermInDatabase

                                                                                                                                                                                                                                                                                                                                    Checks for a term in the database. Looks up the terms and term_taxonomy prefixed tables. and the term_taxonomy tables.

                                                                                                                                                                                                                                                                                                                                    $I->seeTermInDatabase(['slug' => 'genre--fiction']);\n  $I->seeTermInDatabase(['name' => 'Fiction', 'slug' => 'genre--fiction']);\n
                                                                                                                                                                                                                                                                                                                                    Parameters
                                                                                                                                                                                                                                                                                                                                    • \\Codeception\\Module\\array/array $criteria - An array of criteria to search for the term, can be columns from the terms seeTermMetaInDatabase

                                                                                                                                                                                                                                                                                                                                      Checks for a term meta in the database.

                                                                                                                                                                                                                                                                                                                                      list($termId, $termTaxonomyId) = $I->haveTermInDatabase('fiction', 'genre');\n  $I->haveTermMetaInDatabase($termId, 'rating', 4);\n  $I->seeTermMetaInDatabase(['term_id' => $termId,'meta_key' => 'rating', 'meta_value' => 4]);\n
                                                                                                                                                                                                                                                                                                                                      Parameters
                                                                                                                                                                                                                                                                                                                                      • \\Codeception\\Module\\array/array $criteria - An array of search criteria. seeTermRelationshipInDatabase

                                                                                                                                                                                                                                                                                                                                        Checks for a term relationship in the database.

                                                                                                                                                                                                                                                                                                                                        $postId = $I->havePostInDatabase(['tax_input' => ['category' => 'one']]);\n  $I->seeTermRelationshipInDatabase(['object_id' => $postId, 'term_taxonomy_id' => $oneTermTaxId]);\n
                                                                                                                                                                                                                                                                                                                                        Parameters
                                                                                                                                                                                                                                                                                                                                        • \\Codeception\\Module\\array/array $criteria - An array of search criteria. seeTermTaxonomyInDatabase

                                                                                                                                                                                                                                                                                                                                          Checks for a taxonomy taxonomy in the database.

                                                                                                                                                                                                                                                                                                                                          list($termId, $termTaxonomyId) = $I->haveTermInDatabase('fiction', 'genre');\n  $I->seeTermTaxonomyInDatabase(['term_id' => $termId, 'taxonomy' => 'genre']);\n
                                                                                                                                                                                                                                                                                                                                          Parameters
                                                                                                                                                                                                                                                                                                                                          • \\Codeception\\Module\\array/array $criteria - An array of search criteria. seeUserInDatabase

                                                                                                                                                                                                                                                                                                                                            Checks that a user is in the database. The method will check the \"users\" table.

                                                                                                                                                                                                                                                                                                                                            $I->seeUserInDatabase([\n  \"user_email\" => \"test@example.org\",\n  \"user_login\" => \"login name\"\n  ])\n
                                                                                                                                                                                                                                                                                                                                            Parameters
                                                                                                                                                                                                                                                                                                                                            • \\Codeception\\Module\\array/array $criteria - An array of search criteria. seeUserMetaInDatabase

                                                                                                                                                                                                                                                                                                                                              Checks for a user meta value in the database.

                                                                                                                                                                                                                                                                                                                                              $I->seeUserMetaInDatabase(['user_id' => 23, 'meta_key' => 'karma']);\n
                                                                                                                                                                                                                                                                                                                                              Parameters
                                                                                                                                                                                                                                                                                                                                              • \\Codeception\\Module\\array/array $criteria - An array of search criteria. useBlog

                                                                                                                                                                                                                                                                                                                                                Sets the blog to be used. This has nothing to do with WordPress switch_to_blog function, this code will affect the table prefixes used.

                                                                                                                                                                                                                                                                                                                                                // Switch to the blog with ID 23.\n  $I->useBlog(23);\n  // Switch back to the main blog.\n  $I->useMainBlog();\n
                                                                                                                                                                                                                                                                                                                                                Parameters
                                                                                                                                                                                                                                                                                                                                                • int $blogId - The ID of the blog to use.
                                                                                                                                                                                                                                                                                                                                                useMainBlog

                                                                                                                                                                                                                                                                                                                                                Sets the current blog to the main one (blog_id 1).

                                                                                                                                                                                                                                                                                                                                                // Switch to the blog with ID 23.\n  $I->useBlog(23);\n  // Switch back to the main blog.\n  $I->useMainBlog();\n
                                                                                                                                                                                                                                                                                                                                                useTheme

                                                                                                                                                                                                                                                                                                                                                Sets the current theme options.

                                                                                                                                                                                                                                                                                                                                                $I->useTheme('twentyseventeen');\n  $I->useTheme('child-of-twentyseventeen', 'twentyseventeen');\n  $I->useTheme('acme', 'acme', 'Acme Theme');\n
                                                                                                                                                                                                                                                                                                                                                Parameters
                                                                                                                                                                                                                                                                                                                                                • string $stylesheet - The theme stylesheet slug, e.g. twentysixteen.
                                                                                                                                                                                                                                                                                                                                                • string $template - The theme template slug, e.g. twentysixteen, defaults to $stylesheet.
                                                                                                                                                                                                                                                                                                                                                • string $themeName - The theme name, e.g. Acme, defaults to the \"title\" version of

                                                                                                                                                                                                                                                                                                                                                This class extends \\Codeception\\Module\\Db

                                                                                                                                                                                                                                                                                                                                                This class implements \\Codeception\\Lib\\Interfaces\\Db

                                                                                                                                                                                                                                                                                                                                                "},{"location":"v3/modules/WPFilesystem/","title":"WPFilesystem","text":"

                                                                                                                                                                                                                                                                                                                                                This is the documentation for version 3 of the project. The current version is version 4 and the documentation can be found here.

                                                                                                                                                                                                                                                                                                                                                "},{"location":"v3/modules/WPFilesystem/#wpfilesystem-module","title":"WPFilesystem module","text":"

                                                                                                                                                                                                                                                                                                                                                This module should be used in acceptance and functional tests, see levels of testing for more information. This module extends the Filesystem module adding WordPress-specific configuration parameters and methods. The module provides methods to read, write and update the WordPress filesystem directly, without relying on WordPress methods, using WordPress functions or triggering WordPress filters. This module also provides methods to scaffold plugins and themes on the fly in the context of tests and auto-remove them after each test.

                                                                                                                                                                                                                                                                                                                                                "},{"location":"v3/modules/WPFilesystem/#module-requirements-for-codeception-40","title":"Module requirements for Codeception 4.0+","text":"

                                                                                                                                                                                                                                                                                                                                                This module requires the codeception/module-filesystem Composer package to work when wp-browser is used with Codeception 4.0.

                                                                                                                                                                                                                                                                                                                                                To install the package run:

                                                                                                                                                                                                                                                                                                                                                composer require --dev codeception/module-filesystem:^1.0\n
                                                                                                                                                                                                                                                                                                                                                "},{"location":"v3/modules/WPFilesystem/#configuration","title":"Configuration","text":"
                                                                                                                                                                                                                                                                                                                                                • wpRootFolder required The absolute, or relative to the project root folder, path to the root WordPress installation folder. The WordPress installation root folder is the one that contains the wp-load.php file.
                                                                                                                                                                                                                                                                                                                                                • themes - defaults to /wp-content/themes; the path, relative to the the WordPress installation root folder, to the themes folder.
                                                                                                                                                                                                                                                                                                                                                • plugins - defaults to /wp-content/plugins; the path, relative to the WordPress installation root folder, to the plugins folder.
                                                                                                                                                                                                                                                                                                                                                • mu-plugins - defaults to wp-content/mu-plugins; the path, relative to the WordPress installation root folder, to the must-use plugins folder.
                                                                                                                                                                                                                                                                                                                                                • uploads - defaults to /wp-content/uploads; the path, relative to the WordPress installation root folder, to the uploads folder.
                                                                                                                                                                                                                                                                                                                                                "},{"location":"v3/modules/WPFilesystem/#example-configuration","title":"Example configuration","text":"
                                                                                                                                                                                                                                                                                                                                                modules:\nenabled:\n- WPFilesystem\nconfig:\nWPFilesystem:\nwpRootFolder: \"/var/www/wordpress\"\n
                                                                                                                                                                                                                                                                                                                                                "},{"location":"v3/modules/WPFilesystem/#public-api","title":"Public API","text":"
                                                                                                                                                                                                                                                                                                                                                • amInMuPluginPath
                                                                                                                                                                                                                                                                                                                                                • amInPluginPath
                                                                                                                                                                                                                                                                                                                                                • amInThemePath
                                                                                                                                                                                                                                                                                                                                                • amInUploadsPath
                                                                                                                                                                                                                                                                                                                                                • cleanMuPluginDir
                                                                                                                                                                                                                                                                                                                                                • cleanPluginDir
                                                                                                                                                                                                                                                                                                                                                • cleanThemeDir
                                                                                                                                                                                                                                                                                                                                                • cleanUploadsDir
                                                                                                                                                                                                                                                                                                                                                • copyDirToMuPlugin
                                                                                                                                                                                                                                                                                                                                                • copyDirToPlugin
                                                                                                                                                                                                                                                                                                                                                • copyDirToTheme
                                                                                                                                                                                                                                                                                                                                                • copyDirToUploads
                                                                                                                                                                                                                                                                                                                                                • deleteMuPluginFile
                                                                                                                                                                                                                                                                                                                                                • deletePluginFile
                                                                                                                                                                                                                                                                                                                                                • deleteThemeFile
                                                                                                                                                                                                                                                                                                                                                • deleteUploadedDir
                                                                                                                                                                                                                                                                                                                                                • deleteUploadedFile
                                                                                                                                                                                                                                                                                                                                                • dontSeeInMuPluginFile
                                                                                                                                                                                                                                                                                                                                                • dontSeeInPluginFile
                                                                                                                                                                                                                                                                                                                                                • dontSeeInThemeFile
                                                                                                                                                                                                                                                                                                                                                • dontSeeInUploadedFile
                                                                                                                                                                                                                                                                                                                                                • dontSeeMuPluginFileFound
                                                                                                                                                                                                                                                                                                                                                • dontSeePluginFileFound
                                                                                                                                                                                                                                                                                                                                                • dontSeeThemeFileFound
                                                                                                                                                                                                                                                                                                                                                • dontSeeUploadedFileFound
                                                                                                                                                                                                                                                                                                                                                • getBlogUploadsPath
                                                                                                                                                                                                                                                                                                                                                • getUploadsPath
                                                                                                                                                                                                                                                                                                                                                • getWpRootFolder
                                                                                                                                                                                                                                                                                                                                                • haveMuPlugin
                                                                                                                                                                                                                                                                                                                                                • havePlugin
                                                                                                                                                                                                                                                                                                                                                • haveTheme
                                                                                                                                                                                                                                                                                                                                                • makeUploadsDir
                                                                                                                                                                                                                                                                                                                                                • openUploadedFile
                                                                                                                                                                                                                                                                                                                                                • seeInMuPluginFile
                                                                                                                                                                                                                                                                                                                                                • seeInPluginFile
                                                                                                                                                                                                                                                                                                                                                • seeInThemeFile
                                                                                                                                                                                                                                                                                                                                                • seeInUploadedFile
                                                                                                                                                                                                                                                                                                                                                • seeMuPluginFileFound
                                                                                                                                                                                                                                                                                                                                                • seePluginFileFound
                                                                                                                                                                                                                                                                                                                                                • seeThemeFileFound
                                                                                                                                                                                                                                                                                                                                                • seeUploadedFileFound
                                                                                                                                                                                                                                                                                                                                                • writeToMuPluginFile
                                                                                                                                                                                                                                                                                                                                                • writeToPluginFile
                                                                                                                                                                                                                                                                                                                                                • writeToThemeFile
                                                                                                                                                                                                                                                                                                                                                • writeToUploadedFile
                                                                                                                                                                                                                                                                                                                                                amInMuPluginPath

                                                                                                                                                                                                                                                                                                                                                Sets the current working folder to a folder in a mu-plugin.

                                                                                                                                                                                                                                                                                                                                                $I->amInMuPluginPath('mu-plugin');\n
                                                                                                                                                                                                                                                                                                                                                Parameters
                                                                                                                                                                                                                                                                                                                                                • string $path - The path to the folder, relative to the mu-plugins root folder.
                                                                                                                                                                                                                                                                                                                                                amInPluginPath

                                                                                                                                                                                                                                                                                                                                                Sets the current working folder to a folder in a plugin.

                                                                                                                                                                                                                                                                                                                                                $I->amInPluginPath('my-plugin');\n
                                                                                                                                                                                                                                                                                                                                                Parameters
                                                                                                                                                                                                                                                                                                                                                • string $path - The folder path, relative to the root uploads folder, to change to.
                                                                                                                                                                                                                                                                                                                                                amInThemePath

                                                                                                                                                                                                                                                                                                                                                Sets the current working folder to a folder in a theme.

                                                                                                                                                                                                                                                                                                                                                $I->amInThemePath('my-theme');\n
                                                                                                                                                                                                                                                                                                                                                Parameters
                                                                                                                                                                                                                                                                                                                                                • string $path - The path to the theme folder, relative to themes root folder.
                                                                                                                                                                                                                                                                                                                                                amInUploadsPath

                                                                                                                                                                                                                                                                                                                                                Enters, changing directory, to the uploads folder in the local filesystem.

                                                                                                                                                                                                                                                                                                                                                $I->amInUploadsPath('/logs');\n  $I->seeFileFound('shop.log');\n
                                                                                                                                                                                                                                                                                                                                                Parameters
                                                                                                                                                                                                                                                                                                                                                • string $path - The path, relative to the site uploads folder.
                                                                                                                                                                                                                                                                                                                                                cleanMuPluginDir

                                                                                                                                                                                                                                                                                                                                                Cleans, emptying it, a folder in a mu-plugin folder.

                                                                                                                                                                                                                                                                                                                                                $I->cleanMuPluginDir('mu-plugin1/foo');\n
                                                                                                                                                                                                                                                                                                                                                Parameters
                                                                                                                                                                                                                                                                                                                                                • string $dir - The path to the directory, relative to the mu-plugins root folder.
                                                                                                                                                                                                                                                                                                                                                cleanPluginDir

                                                                                                                                                                                                                                                                                                                                                Cleans, emptying it, a folder in a plugin folder.

                                                                                                                                                                                                                                                                                                                                                $I->cleanPluginDir('my-plugin/foo');\n
                                                                                                                                                                                                                                                                                                                                                Parameters
                                                                                                                                                                                                                                                                                                                                                • string $dir - The path to the folder, relative to the plugins root folder.
                                                                                                                                                                                                                                                                                                                                                cleanThemeDir

                                                                                                                                                                                                                                                                                                                                                Clears, emptying it, a folder in a theme folder.

                                                                                                                                                                                                                                                                                                                                                $I->cleanThemeDir('my-theme/foo');\n
                                                                                                                                                                                                                                                                                                                                                Parameters
                                                                                                                                                                                                                                                                                                                                                • string $dir - The path to the folder, relative to the themese root folder.
                                                                                                                                                                                                                                                                                                                                                cleanUploadsDir

                                                                                                                                                                                                                                                                                                                                                Clears a folder in the uploads folder. The date argument can be a string compatible with strtotime or a Unix timestamp that will be used to build the Y/m uploads subfolder path.

                                                                                                                                                                                                                                                                                                                                                $I->cleanUploadsDir('some/folder');\n  $I->cleanUploadsDir('some/folder', 'today');\n
                                                                                                                                                                                                                                                                                                                                                Parameters
                                                                                                                                                                                                                                                                                                                                                • string $dir - The path to the directory to delete, relative to the uploads folder.
                                                                                                                                                                                                                                                                                                                                                • string/int/[\\DateTime](http://php.net/manual/en/class.datetime.php) $date - The date of the uploads to delete, will default to now.
                                                                                                                                                                                                                                                                                                                                                copyDirToMuPlugin

                                                                                                                                                                                                                                                                                                                                                Copies a folder to a folder in a mu-plugin.

                                                                                                                                                                                                                                                                                                                                                $I->copyDirToMuPlugin(codecept_data_dir('foo'), 'mu-plugin/foo');\n
                                                                                                                                                                                                                                                                                                                                                Parameters
                                                                                                                                                                                                                                                                                                                                                • string $src - The path to the source file to copy.
                                                                                                                                                                                                                                                                                                                                                • string $pluginDst - The path to the destination folder, relative to the mu-plugins root folder.
                                                                                                                                                                                                                                                                                                                                                copyDirToPlugin

                                                                                                                                                                                                                                                                                                                                                Copies a folder to a folder in a plugin.

                                                                                                                                                                                                                                                                                                                                                // Copy the 'foo' folder to the 'foo' folder in the plugin.\n  $I->copyDirToPlugin(codecept_data_dir('foo'), 'my-plugin/foo');\n
                                                                                                                                                                                                                                                                                                                                                Parameters
                                                                                                                                                                                                                                                                                                                                                • string $src - The path to the source directory to copy.
                                                                                                                                                                                                                                                                                                                                                • string $pluginDst - The destination path, relative to the plugins root folder.
                                                                                                                                                                                                                                                                                                                                                copyDirToTheme

                                                                                                                                                                                                                                                                                                                                                Copies a folder in a theme folder.

                                                                                                                                                                                                                                                                                                                                                $I->copyDirToTheme(codecept_data_dir('foo'), 'my-theme');\n
                                                                                                                                                                                                                                                                                                                                                Parameters
                                                                                                                                                                                                                                                                                                                                                • string $src - The path to the source file.
                                                                                                                                                                                                                                                                                                                                                • string $themeDst - The path to the destination folder, relative to the themes root folder.
                                                                                                                                                                                                                                                                                                                                                copyDirToUploads

                                                                                                                                                                                                                                                                                                                                                Copies a folder to the uploads folder. The date argument can be a string compatible with strtotime or a Unix timestamp that will be used to build the Y/m uploads subfolder path.

                                                                                                                                                                                                                                                                                                                                                $I->copyDirToUploads(codecept_data_dir('foo'), 'uploadsFoo');\n  $I->copyDirToUploads(codecept_data_dir('foo'), 'uploadsFoo', 'today');\n
                                                                                                                                                                                                                                                                                                                                                Parameters
                                                                                                                                                                                                                                                                                                                                                • string $src - The path to the source file, relative to the current uploads folder.
                                                                                                                                                                                                                                                                                                                                                • string $dst - The path to the destination file, relative to the current uploads folder.
                                                                                                                                                                                                                                                                                                                                                • string/int/[\\DateTime](http://php.net/manual/en/class.datetime.php) $date - The date of the uploads to delete, will default to now.
                                                                                                                                                                                                                                                                                                                                                deleteMuPluginFile

                                                                                                                                                                                                                                                                                                                                                Deletes a file in a mu-plugin folder.

                                                                                                                                                                                                                                                                                                                                                $I->deleteMuPluginFile('mu-plugin1/some-file.txt');\n
                                                                                                                                                                                                                                                                                                                                                Parameters
                                                                                                                                                                                                                                                                                                                                                • string $file - The path to the file, relative to the mu-plugins root folder.
                                                                                                                                                                                                                                                                                                                                                deletePluginFile

                                                                                                                                                                                                                                                                                                                                                Deletes a file in a plugin folder.

                                                                                                                                                                                                                                                                                                                                                $I->deletePluginFile('my-plugin/some-file.txt');\n
                                                                                                                                                                                                                                                                                                                                                Parameters
                                                                                                                                                                                                                                                                                                                                                • string $file - The folder path, relative to the plugins root folder.
                                                                                                                                                                                                                                                                                                                                                deleteThemeFile

                                                                                                                                                                                                                                                                                                                                                Deletes a file in a theme folder.

                                                                                                                                                                                                                                                                                                                                                $I->deleteThemeFile('my-theme/some-file.txt');\n
                                                                                                                                                                                                                                                                                                                                                Parameters
                                                                                                                                                                                                                                                                                                                                                • string $file - The path to the file to delete, relative to the themes root folder.
                                                                                                                                                                                                                                                                                                                                                deleteUploadedDir

                                                                                                                                                                                                                                                                                                                                                Deletes a dir in the uploads folder. The date argument can be a string compatible with strtotime or a Unix timestamp that will be used to build the Y/m uploads subfolder path.

                                                                                                                                                                                                                                                                                                                                                $I->deleteUploadedDir('folder');\n  $I->deleteUploadedDir('folder', 'today');\n
                                                                                                                                                                                                                                                                                                                                                Parameters
                                                                                                                                                                                                                                                                                                                                                • string $dir - The path to the directory to delete, relative to the uploads folder.
                                                                                                                                                                                                                                                                                                                                                • string/int/[\\DateTime](http://php.net/manual/en/class.datetime.php) $date - The date of the uploads to delete, will default to now.
                                                                                                                                                                                                                                                                                                                                                deleteUploadedFile

                                                                                                                                                                                                                                                                                                                                                Deletes a file in the uploads folder. The date argument can be a string compatible with strtotime or a Unix timestamp that will be used to build the Y/m uploads subfolder path.

                                                                                                                                                                                                                                                                                                                                                $I->deleteUploadedFile('some-file.txt');\n  $I->deleteUploadedFile('some-file.txt', 'today');\n
                                                                                                                                                                                                                                                                                                                                                Parameters
                                                                                                                                                                                                                                                                                                                                                • string $file - The file path, relative to the uploads folder or the current folder.
                                                                                                                                                                                                                                                                                                                                                • string/int $date - A string compatible with strtotime or a Unix timestamp.
                                                                                                                                                                                                                                                                                                                                                dontSeeInMuPluginFile

                                                                                                                                                                                                                                                                                                                                                Checks that a file in a mu-plugin folder does not contain a string.

                                                                                                                                                                                                                                                                                                                                                $I->dontSeeInMuPluginFile('mu-plugin1/some-file.txt', 'foo');\n
                                                                                                                                                                                                                                                                                                                                                Parameters
                                                                                                                                                                                                                                                                                                                                                • string $file - The path to the file, relative to the mu-plugins root folder.
                                                                                                                                                                                                                                                                                                                                                • string $contents - The contents to check the file for.
                                                                                                                                                                                                                                                                                                                                                dontSeeInPluginFile

                                                                                                                                                                                                                                                                                                                                                Checks that a file in a plugin folder does not contain a string.

                                                                                                                                                                                                                                                                                                                                                $I->dontSeeInPluginFile('my-plugin/some-file.txt', 'foo');\n
                                                                                                                                                                                                                                                                                                                                                Parameters
                                                                                                                                                                                                                                                                                                                                                • string $file - The path to the file, relative to the plugins root folder.
                                                                                                                                                                                                                                                                                                                                                • string $contents - The contents to check the file for.
                                                                                                                                                                                                                                                                                                                                                dontSeeInThemeFile

                                                                                                                                                                                                                                                                                                                                                Checks that a file in a theme folder does not contain a string.

                                                                                                                                                                                                                                                                                                                                                $I->dontSeeInThemeFile('my-theme/some-file.txt', 'foo');\n
                                                                                                                                                                                                                                                                                                                                                Parameters
                                                                                                                                                                                                                                                                                                                                                • string $file - The path to the file, relative to the themes root folder.
                                                                                                                                                                                                                                                                                                                                                • string $contents - The contents to check the file for.
                                                                                                                                                                                                                                                                                                                                                dontSeeInUploadedFile

                                                                                                                                                                                                                                                                                                                                                Checks that a file in the uploads folder does contain a string. The date argument can be a string compatible with strtotime or a Unix timestamp that will be used to build the Y/m uploads subfolder path.

                                                                                                                                                                                                                                                                                                                                                $I->dontSeeInUploadedFile('some-file.txt', 'foo');\n  $I->dontSeeInUploadedFile('some-file.txt','foo', 'today');\n
                                                                                                                                                                                                                                                                                                                                                Parameters
                                                                                                                                                                                                                                                                                                                                                • string $file - The file path, relative to the uploads folder or the current folder.
                                                                                                                                                                                                                                                                                                                                                • string $contents - The not expected file contents or part of them.
                                                                                                                                                                                                                                                                                                                                                • string/int $date - A string compatible with strtotime or a Unix timestamp.
                                                                                                                                                                                                                                                                                                                                                dontSeeMuPluginFileFound

                                                                                                                                                                                                                                                                                                                                                Checks that a file is not found in a mu-plugin folder.

                                                                                                                                                                                                                                                                                                                                                $I->dontSeeMuPluginFileFound('mu-plugin1/some-file.txt');\n
                                                                                                                                                                                                                                                                                                                                                Parameters
                                                                                                                                                                                                                                                                                                                                                • string $file - The path to the file, relative to the mu-plugins folder.
                                                                                                                                                                                                                                                                                                                                                dontSeePluginFileFound

                                                                                                                                                                                                                                                                                                                                                Checks that a file is not found in a plugin folder.

                                                                                                                                                                                                                                                                                                                                                $I->dontSeePluginFileFound('my-plugin/some-file.txt');\n
                                                                                                                                                                                                                                                                                                                                                Parameters
                                                                                                                                                                                                                                                                                                                                                • string $file - The path to the file, relative to the plugins root folder.
                                                                                                                                                                                                                                                                                                                                                dontSeeThemeFileFound

                                                                                                                                                                                                                                                                                                                                                Checks that a file is not found in a theme folder.

                                                                                                                                                                                                                                                                                                                                                $I->dontSeeThemeFileFound('my-theme/some-file.txt');\n
                                                                                                                                                                                                                                                                                                                                                Parameters
                                                                                                                                                                                                                                                                                                                                                • string $file - The path to the file, relative to the themes root folder.
                                                                                                                                                                                                                                                                                                                                                dontSeeUploadedFileFound

                                                                                                                                                                                                                                                                                                                                                Checks thata a file does not exist in the uploads folder. The date argument can be a string compatible with strtotime or a Unix timestamp that will be used to build the Y/m uploads subfolder path.

                                                                                                                                                                                                                                                                                                                                                $I->dontSeeUploadedFileFound('some-file.txt');\n  $I->dontSeeUploadedFileFound('some-file.txt','today');\n
                                                                                                                                                                                                                                                                                                                                                Parameters
                                                                                                                                                                                                                                                                                                                                                • string $file - The file path, relative to the uploads folder or the current folder.
                                                                                                                                                                                                                                                                                                                                                • string/int $date - A string compatible with strtotime or a Unix timestamp.
                                                                                                                                                                                                                                                                                                                                                getBlogUploadsPath

                                                                                                                                                                                                                                                                                                                                                Returns the absolute path to a blog uploads folder or file.

                                                                                                                                                                                                                                                                                                                                                $blogId = $I->haveBlogInDatabase('test');\n  $testTodayUploads = $I->getBlogUploadsPath($blogId);\n  $testLastMonthLogs = $I->getBlogUploadsPath($blogId, '/logs', '-1 month');\n  file or folder.\n  sub-folders in the year/month format; a UNIX timestamp or\n  a string supported by the `strtotime` function; defaults\n  to `now`.\n
                                                                                                                                                                                                                                                                                                                                                Parameters
                                                                                                                                                                                                                                                                                                                                                • int $blogId - The blog ID to get the path for.
                                                                                                                                                                                                                                                                                                                                                • string $file - The path, relatitve to the blog uploads folder, to the
                                                                                                                                                                                                                                                                                                                                                • null/string/[\\DateTime](http://php.net/manual/en/class.datetime.php)/[\\DateTime](http://php.net/manual/en/class.datetime.php)Immutable $date - The date that should be used to build the uploads
                                                                                                                                                                                                                                                                                                                                                getUploadsPath

                                                                                                                                                                                                                                                                                                                                                Returns the path to the specified uploads file of folder. Not providing a value for $file and $date will return the uploads folder path.

                                                                                                                                                                                                                                                                                                                                                $todaysPath = $I->getUploadsPath();\n  $lastWeek = $I->getUploadsPath('', '-1 week');\n
                                                                                                                                                                                                                                                                                                                                                Parameters
                                                                                                                                                                                                                                                                                                                                                • string $file - The file path, relative to the uploads folder.
                                                                                                                                                                                                                                                                                                                                                • mixed $date - A string compatible with strtotime, a Unix timestamp or a Date object.
                                                                                                                                                                                                                                                                                                                                                getWpRootFolder

                                                                                                                                                                                                                                                                                                                                                Returns the absolute path to WordPress root folder without trailing slash.

                                                                                                                                                                                                                                                                                                                                                $rootFolder = $I->getWpRootFolder();\n  $I->assertFileExists($rootFolder . 'wp-load.php');\n
                                                                                                                                                                                                                                                                                                                                                haveMuPlugin

                                                                                                                                                                                                                                                                                                                                                Creates a mu-plugin file, including plugin header, in the mu-plugins folder. The code can not contain the opening '<?php' tag.

                                                                                                                                                                                                                                                                                                                                                $code = 'echo \"Hello world!\"';\n  $I->haveMuPlugin('foo-mu-plugin.php', $code);\n  // Load the code from a file.\n  $code = file_get_contents(codecept_data_dir('code/mu-plugin.php'));\n  $I->haveMuPlugin('foo-mu-plugin.php', $code);\n
                                                                                                                                                                                                                                                                                                                                                Parameters
                                                                                                                                                                                                                                                                                                                                                • string $filename - The path to the file to create, relative to the plugins root folder.
                                                                                                                                                                                                                                                                                                                                                • string $code - The content of the plugin file with or without the opening PHP tag.
                                                                                                                                                                                                                                                                                                                                                havePlugin

                                                                                                                                                                                                                                                                                                                                                Creates a plugin file, including plugin header, in the plugins folder. The plugin is just created and not activated; the code can not contain the opening '<?php' tag.

                                                                                                                                                                                                                                                                                                                                                $code = 'echo \"Hello world!\"';\n  $I->havePlugin('foo/plugin.php', $code);\n  // Load the code from a file.\n  $code = file_get_contents(codecept_data_dir('code/plugin.php'));\n  $I->havePlugin('foo/plugin.php', $code);\n
                                                                                                                                                                                                                                                                                                                                                Parameters
                                                                                                                                                                                                                                                                                                                                                • string $path - The path to the file to create, relative to the plugins folder.
                                                                                                                                                                                                                                                                                                                                                • string $code - The content of the plugin file with or without the opening PHP tag.
                                                                                                                                                                                                                                                                                                                                                haveTheme

                                                                                                                                                                                                                                                                                                                                                Creates a theme file structure, including theme style file and index, in the themes folder. The theme is just created and not activated; the code can not contain the opening '<?php' tag.

                                                                                                                                                                                                                                                                                                                                                $code = 'sayHi();';\n  $functionsCode  = 'function sayHi(){echo \"Hello world\";};';\n  $I->haveTheme('foo', $indexCode, $functionsCode);\n  // Load the code from a file.\n  $indexCode = file_get_contents(codecept_data_dir('code/index.php'));\n  $functionsCode = file_get_contents(codecept_data_dir('code/functions.php'));\n  $I->haveTheme('foo', $indexCode, $functionsCode);\n
                                                                                                                                                                                                                                                                                                                                                Parameters
                                                                                                                                                                                                                                                                                                                                                • string $folder - The path to the theme to create, relative to the themes root folder.
                                                                                                                                                                                                                                                                                                                                                • string $indexFileCode - The content of the theme index.php file with or without the opening PHP tag.
                                                                                                                                                                                                                                                                                                                                                • string $functionsFileCode - The content of the theme functions.php file with or without the opening PHP tag.
                                                                                                                                                                                                                                                                                                                                                makeUploadsDir

                                                                                                                                                                                                                                                                                                                                                Creates an empty folder in the WordPress installation uploads folder.

                                                                                                                                                                                                                                                                                                                                                $logsDir = $I->makeUploadsDir('logs/acme');\n  to create.\n
                                                                                                                                                                                                                                                                                                                                                Parameters
                                                                                                                                                                                                                                                                                                                                                • string $path - The path, relative to the WordPress installation uploads folder, of the folder
                                                                                                                                                                                                                                                                                                                                                openUploadedFile

                                                                                                                                                                                                                                                                                                                                                Opens a file in the the uploads folder. The date argument can be a string compatible with strtotime or a Unix timestamp that will be used to build the Y/m uploads subfolder path.

                                                                                                                                                                                                                                                                                                                                                $I->openUploadedFile('some-file.txt');\n  $I->openUploadedFile('some-file.txt', 'time');\n
                                                                                                                                                                                                                                                                                                                                                Parameters
                                                                                                                                                                                                                                                                                                                                                • string $filename - The path to the file, relative to the current uploads folder.
                                                                                                                                                                                                                                                                                                                                                • string/int/[\\DateTime](http://php.net/manual/en/class.datetime.php) $date - The date of the uploads to delete, will default to now.
                                                                                                                                                                                                                                                                                                                                                seeInMuPluginFile

                                                                                                                                                                                                                                                                                                                                                Checks that a file in a mu-plugin folder contains a string.

                                                                                                                                                                                                                                                                                                                                                $I->seeInMuPluginFile('mu-plugin1/some-file.txt', 'foo');\n
                                                                                                                                                                                                                                                                                                                                                Parameters
                                                                                                                                                                                                                                                                                                                                                • string $file - The path the file, relative to the mu-plugins root folder.
                                                                                                                                                                                                                                                                                                                                                • string $contents - The contents to check the file for.
                                                                                                                                                                                                                                                                                                                                                seeInPluginFile

                                                                                                                                                                                                                                                                                                                                                Checks that a file in a plugin folder contains a string.

                                                                                                                                                                                                                                                                                                                                                $I->seeInPluginFile('my-plugin/some-file.txt', 'foo');\n
                                                                                                                                                                                                                                                                                                                                                Parameters
                                                                                                                                                                                                                                                                                                                                                • string $file - The path to the file, relative to the plugins root folder.
                                                                                                                                                                                                                                                                                                                                                • string $contents - The contents to check the file for.
                                                                                                                                                                                                                                                                                                                                                seeInThemeFile

                                                                                                                                                                                                                                                                                                                                                Checks that a file in a theme folder contains a string.

                                                                                                                                                                                                                                                                                                                                                <?php\n$I->seeInThemeFile('my-theme/some-file.txt', 'foo');\n?>\n
                                                                                                                                                                                                                                                                                                                                                Parameters
                                                                                                                                                                                                                                                                                                                                                • string $file - The path to the file, relative to the themes root folder.
                                                                                                                                                                                                                                                                                                                                                • string $contents - The contents to check the file for.
                                                                                                                                                                                                                                                                                                                                                seeInUploadedFile

                                                                                                                                                                                                                                                                                                                                                Checks that a file in the uploads folder contains a string. The date argument can be a string compatible with strtotime or a Unix timestamp that will be used to build the Y/m uploads subfolder path.

                                                                                                                                                                                                                                                                                                                                                $I->seeInUploadedFile('some-file.txt', 'foo');\n  $I->seeInUploadedFile('some-file.txt','foo', 'today');\n
                                                                                                                                                                                                                                                                                                                                                Parameters
                                                                                                                                                                                                                                                                                                                                                • string $file - The file path, relative to the uploads folder or the current folder.
                                                                                                                                                                                                                                                                                                                                                • string $contents - The expected file contents or part of them.
                                                                                                                                                                                                                                                                                                                                                • string/int $date - A string compatible with strtotime or a Unix timestamp.
                                                                                                                                                                                                                                                                                                                                                seeMuPluginFileFound

                                                                                                                                                                                                                                                                                                                                                Checks that a file is found in a mu-plugin folder.

                                                                                                                                                                                                                                                                                                                                                $I->seeMuPluginFileFound('mu-plugin1/some-file.txt');\n
                                                                                                                                                                                                                                                                                                                                                Parameters
                                                                                                                                                                                                                                                                                                                                                • string $file - The path to the file, relative to the mu-plugins folder.
                                                                                                                                                                                                                                                                                                                                                seePluginFileFound

                                                                                                                                                                                                                                                                                                                                                Checks that a file is found in a plugin folder.

                                                                                                                                                                                                                                                                                                                                                $I->seePluginFileFound('my-plugin/some-file.txt');\n
                                                                                                                                                                                                                                                                                                                                                Parameters
                                                                                                                                                                                                                                                                                                                                                • string $file - The path to the file, relative to thep plugins root folder.
                                                                                                                                                                                                                                                                                                                                                seeThemeFileFound

                                                                                                                                                                                                                                                                                                                                                Checks that a file is found in a theme folder.

                                                                                                                                                                                                                                                                                                                                                $I->seeThemeFileFound('my-theme/some-file.txt');\n
                                                                                                                                                                                                                                                                                                                                                Parameters
                                                                                                                                                                                                                                                                                                                                                • string $file - The path to the file, relative to the themes root folder.
                                                                                                                                                                                                                                                                                                                                                seeUploadedFileFound

                                                                                                                                                                                                                                                                                                                                                Checks if file exists in the uploads folder. The date argument can be a string compatible with strtotime or a Unix timestamp that will be used to build the Y/m uploads subfolder path.

                                                                                                                                                                                                                                                                                                                                                $I->seeUploadedFileFound('some-file.txt');\n  $I->seeUploadedFileFound('some-file.txt','today');\n  ?>\n
                                                                                                                                                                                                                                                                                                                                                Parameters
                                                                                                                                                                                                                                                                                                                                                • string $filename - The file path, relative to the uploads folder or the current folder.
                                                                                                                                                                                                                                                                                                                                                • string/int $date - A string compatible with strtotime or a Unix timestamp.
                                                                                                                                                                                                                                                                                                                                                writeToMuPluginFile

                                                                                                                                                                                                                                                                                                                                                Writes a file in a mu-plugin folder.

                                                                                                                                                                                                                                                                                                                                                $I->writeToMuPluginFile('mu-plugin1/some-file.txt', 'foo');\n
                                                                                                                                                                                                                                                                                                                                                Parameters
                                                                                                                                                                                                                                                                                                                                                • string $file - The path to the destination file, relative to the mu-plugins root folder.
                                                                                                                                                                                                                                                                                                                                                • string $data - The data to write to the file.
                                                                                                                                                                                                                                                                                                                                                writeToPluginFile

                                                                                                                                                                                                                                                                                                                                                Writes a file in a plugin folder.

                                                                                                                                                                                                                                                                                                                                                $I->writeToPluginFile('my-plugin/some-file.txt', 'foo');\n
                                                                                                                                                                                                                                                                                                                                                Parameters
                                                                                                                                                                                                                                                                                                                                                • string $file - The path to the file, relative to the plugins root folder.
                                                                                                                                                                                                                                                                                                                                                • string $data - The data to write in the file.
                                                                                                                                                                                                                                                                                                                                                writeToThemeFile

                                                                                                                                                                                                                                                                                                                                                Writes a string to a file in a theme folder.

                                                                                                                                                                                                                                                                                                                                                $I->writeToThemeFile('my-theme/some-file.txt', 'foo');\n
                                                                                                                                                                                                                                                                                                                                                Parameters
                                                                                                                                                                                                                                                                                                                                                • string $file - The path to the file, relative to the themese root folder.
                                                                                                                                                                                                                                                                                                                                                • string $data - The data to write to the file.
                                                                                                                                                                                                                                                                                                                                                writeToUploadedFile

                                                                                                                                                                                                                                                                                                                                                Writes a string to a file in the the uploads folder. The date argument can be a string compatible with strtotime or a Unix timestamp that will be used to build the Y/m uploads subfolder path.

                                                                                                                                                                                                                                                                                                                                                $I->writeToUploadedFile('some-file.txt', 'foo bar');\n  $I->writeToUploadedFile('some-file.txt', 'foo bar', 'today');\n
                                                                                                                                                                                                                                                                                                                                                Parameters
                                                                                                                                                                                                                                                                                                                                                • string $filename - The path to the destination file, relative to the current uploads folder.
                                                                                                                                                                                                                                                                                                                                                • string $data - The data to write to the file.
                                                                                                                                                                                                                                                                                                                                                • string/int/[\\DateTime](http://php.net/manual/en/class.datetime.php) $date - The date of the uploads to delete, will default to now.

                                                                                                                                                                                                                                                                                                                                                This class extends \\Codeception\\Module\\Filesystem

                                                                                                                                                                                                                                                                                                                                                "},{"location":"v3/modules/WPLoader/","title":"WPLoader","text":"

                                                                                                                                                                                                                                                                                                                                                This is the documentation for version 3 of the project. The current version is version 4 and the documentation can be found here.

                                                                                                                                                                                                                                                                                                                                                "},{"location":"v3/modules/WPLoader/#wploader-module","title":"WPLoader module","text":"

                                                                                                                                                                                                                                                                                                                                                This module should be used in integration tests, see levels of testing for more information, to bootstrap WordPress code in the context of the tests. Setting the loadOnly parameter to true the module can be additionally used in acceptance and functional tests to access WordPress code in the tests context. This module is a wrapper around the functionalities provided by the WordPress PHPUnit Core test suite, as such it provides the same method and facilities. The parameters provided to the module duplicate the ones used in the WordPress configuration file: the WPLoader module will not bootstrap WordPress using the wp-config.php file, it will define and use its own WordPress configuration built from the module parameters.

                                                                                                                                                                                                                                                                                                                                                "},{"location":"v3/modules/WPLoader/#everything-happens-in-a-transaction","title":"Everything happens in a transaction","text":"

                                                                                                                                                                                                                                                                                                                                                When used to bootstrap and install WordPress (loadOnly: false) exactly as the the WordPress PHPUnit Core test suite it is based on, this module will operate any change to the database in a transaction. This means that, in the context of integration tests, the result of any write or delete operation done during the tests will be rolled back at the end of each test method; this is done for a number of reasons like performance and tests independence. Inspection of the database during tests, e.g. stopping execution using XDebug, will not show any change in the database. Keep this in mind while trying to debug integration tests using the WPLoader module. When configured to only load WordPress (loadOnly: true) then any database operation will be committed and written to the database.

                                                                                                                                                                                                                                                                                                                                                "},{"location":"v3/modules/WPLoader/#configuration","title":"Configuration","text":"
                                                                                                                                                                                                                                                                                                                                                • wpRootFolder required The absolute, or relative to the project root folder, path to the root WordPress installation folder. The WordPress installation root folder is the one that contains the wp-load.php file.
                                                                                                                                                                                                                                                                                                                                                • dbName required - The name of the database used by the WordPress installation, same as the DB_NAME constant.
                                                                                                                                                                                                                                                                                                                                                • dbHost required - The host of the database used by the WordPress installation, same as the DB_HOST constant. If the database is accessible (as is the case on the latest version of [Local by Flywheel][http://localwp.com]) via unix socket, then the string to insert here should look like this localhost:/path/to/the/mysql.sock.
                                                                                                                                                                                                                                                                                                                                                • dbUser required - The user of the database used by the WordPress installation, same as the DB_USER constant.
                                                                                                                                                                                                                                                                                                                                                • dbPassword required - The password of the database used by the WordPress installation, same as DB_PASSWORD constant.
                                                                                                                                                                                                                                                                                                                                                • loadOnly - defaults to false; whether to only load WordPress, without bootstrapping a fresh installation for tests or not. Read more in the \"Using WPLoader in acceptance and functional tests\" section. If this parameter is set to true the following parameters will not apply.
                                                                                                                                                                                                                                                                                                                                                • isolatedInstall - defaults to true, whether to install and bootstrap the WordPress installation in a secondary PHP thread for thread safety or not. Maintained for back-compatibility purposes with wp-browser first versions: to get a replica of the bootstrap process used by WordPress Core PHPUnit tests leave this to true.
                                                                                                                                                                                                                                                                                                                                                • installationTableHandling - defaults to empty; it controls how tables created by WordPress and plugins will be handled during the installation of WordPress during tests. By default tables will be emptied of any content, but some plugins might require tables to be dropped before WordPress is installed and after plugins are activated (this used to be the default behavior). Supported values are drop to drop the tables, empty to just empty the tables and let to do nothing about the tables. If you get errors from database queries while the WPLoader module installs the tests, then try changing this parameter value.
                                                                                                                                                                                                                                                                                                                                                • wpDebug - defaults to true, the value the WP_DEBUG constant will be set to.
                                                                                                                                                                                                                                                                                                                                                • multisite - defaults to false, the value the MULTISITE constant will be set to.
                                                                                                                                                                                                                                                                                                                                                • skipPluggables - defaults to false, if set to true will skip the definition of pluggable functions.
                                                                                                                                                                                                                                                                                                                                                • dbCharset - defaults to utf8, the value the DB_CHARSET constant will be set to.
                                                                                                                                                                                                                                                                                                                                                • dbCollate - defaults to an empty string, the value the DB_COLLATE constant will be set to.
                                                                                                                                                                                                                                                                                                                                                • tablePrefix - defaults to wptests_, the value the $table_prefix variable will be set to.
                                                                                                                                                                                                                                                                                                                                                • domain - defaults to example.org, the domain of the WordPress site to scaffold for the tests.
                                                                                                                                                                                                                                                                                                                                                • adminEmail - defaults to admin@example.org, the email of the WordPress site to scaffold for the tests.
                                                                                                                                                                                                                                                                                                                                                • title - defaults to Test Blog, the title of the WordPress site to scaffolded for the tests.
                                                                                                                                                                                                                                                                                                                                                • phpBinary - defaults to php, the PHP binary the host machine will have to use to bootstrap and load the test WordPress installation.
                                                                                                                                                                                                                                                                                                                                                • language - defaults to an empty string, the language of the WordPress installation to scaffold.
                                                                                                                                                                                                                                                                                                                                                • configFile - defaults to an empty string, an additional configuration file to include before loading WordPress. Any instruction in this fill will run before any WordPress file is included.
                                                                                                                                                                                                                                                                                                                                                • contentFolder - defaults to an empty string; the path, relative to the wpRootFolder or absolute, to the content folder if different from the default one or the one defined by the WP_CONTENT_DIR constant; if the WP_CONTENT_DIR constant is defined in a config file (see the configFile parameter) this will be ignored.
                                                                                                                                                                                                                                                                                                                                                • pluginsFolder - defaults to an empty string; the path, relative to the wpRootFolder or absolute, to the plugins folder from the wpRootFolder if different from the default one or the one defined by the WP_PLUGIN_DIR constant; if the WP_PLUGIN_DIR constant is defined in a config file (see the configFile parameter) this will be ignored.
                                                                                                                                                                                                                                                                                                                                                • plugins - defaults to an empty string; a list of plugins that should be loaded before any test case runs and after mu-plugins have been loaded; these should be defined in the folder/plugin-file.php format.
                                                                                                                                                                                                                                                                                                                                                • activatePlugins - defaults to an empty string, a list of plugins that will be activated before any test case runs and after WordPress is fully loaded and set up; these should be defined in the folder/plugin-file.php format; when the multisite option is set to true the plugins will be network activated during the installation.
                                                                                                                                                                                                                                                                                                                                                • bootstrapActions - defaults to an empty string, a list of actions or static functions that should be called after before any test case runs, after plugins have been loaded and activated; static functions should be defined in the YAML array format:
                                                                                                                                                                                                                                                                                                                                                  bootstrapActions:\n- action_one\n- action_two\n- [MyClass, myStaticMethod]\n
                                                                                                                                                                                                                                                                                                                                                • theme - defaults to an empty string, the theme that should be activated for the tests; if a string is passed then both template and stylesheet options will be set to the passed value; if an array is passed then the template and stylesheet will be set in that order:

                                                                                                                                                                                                                                                                                                                                                  theme: my-theme\n

                                                                                                                                                                                                                                                                                                                                                  The theme will be set to my-theme.

                                                                                                                                                                                                                                                                                                                                                  theme: [ parent, child ]\n

                                                                                                                                                                                                                                                                                                                                                  The template will be set to parent, the stylesheet will be set to child.

                                                                                                                                                                                                                                                                                                                                                A word of caution: right now the only way to write tests able to take advantage of the suite is to use the WP_UnitTestCase test case class; while the module will load fine and will raise no problems WP_UnitTestCase will take care of handling the database as intended and using another test case class will almost certainly result in an error if the test case defines more than one test method.

                                                                                                                                                                                                                                                                                                                                                "},{"location":"v3/modules/WPLoader/#example-configuration","title":"Example configuration","text":"
                                                                                                                                                                                                                                                                                                                                                  modules:\n      enabled:\n          - WPLoader\n      config:\n          WPLoader:\n              multisite: false\n              wpRootFolder: \"/Users/luca/www/wordpress\"\n              dbName: \"wordpress_tests\"\n              dbHost: \"localhost\"\n              dbUser: \"root\"\n              dbPassword: \"password\"\n              isolatedInstall: true\n              installationTableHandling: drop\n              tablePrefix: \"wptests_\"\n              domain: \"wordrpess.localhost\"\n              adminEmail: \"admin@wordpress.localhost\"\n              title: \"Test Blog\"\n              theme: my-theme\n              plugins: ['hello.php', 'my-plugin/my-plugin.php']\n              activatePlugins: ['hello.php', 'my-plugin/my-plugin.php']\n
                                                                                                                                                                                                                                                                                                                                                "},{"location":"v3/modules/WPLoader/#usage-in-integration-or-wordpress-unit-tests","title":"Usage in integration or \"WordPress unit\" tests","text":"

                                                                                                                                                                                                                                                                                                                                                The most common use of this module is to run integration, or \"WordPress unit\" tests (see levels of testing for more information).

                                                                                                                                                                                                                                                                                                                                                As a first step generate a WPTestCase using Codeception command-line utility (see the commands provided by wp-browser):

                                                                                                                                                                                                                                                                                                                                                codecept generate:wpunit my_suite \"Acme\\User\"\n

                                                                                                                                                                                                                                                                                                                                                Codeception will generate the tests/my_suite/Acme/UserTest.php class. The class extends the Codeception\\TestCase\\WPTestCase class provided by wp-browser; this looks like a normal PHPUnit test case but has some perks due to it's mixed breed nature. Understanding them might help you work with it:

                                                                                                                                                                                                                                                                                                                                                • WordPress is installed and configured for the tests before the test case is loaded; WordPress defined functions and classes (and those of the plugins and themes loaded with it) will be available in the setUpBeforeClass method.
                                                                                                                                                                                                                                                                                                                                                • WordPress is not loaded when PHPUnit will call the data provider methods; this means the post_provider method will generate a function not found exception when the test case runs as the WordPress defined methods are not loaded yet:
                                                                                                                                                                                                                                                                                                                                                  public function post_provider(){\n        // `wp_insert_post` is loaded with WordPress and WordPress has not been loaded yet!\n        return [\n                [wp_insert_post(['post_title' => 'Test', 'post_status' => 'publish'])]\n        ];\n}\npublic function test_posts($post_id){\n        $this->assertInstanceOf(WP_Post::class, get_post($post_id));\n}\n
                                                                                                                                                                                                                                                                                                                                                • WordPress is reset to an initial known state before each test runs; the database transaction is rolled back to wipe any data and tables you might have manipulated in the tests, the global space is cleaned. See Everything happens in a transaction.
                                                                                                                                                                                                                                                                                                                                                • This is a Codeception Unit test, as such it does provide access to the $this->tester property to access the methods defined in other modules loaded in the suite and to Codeception test doubles
                                                                                                                                                                                                                                                                                                                                                • This is a PhpUnit test case too; there are way too many testing functions to cover to report them here but, to highlight a few: mocking with Prophecy and the wealth of PHPUnit assertion methods.
                                                                                                                                                                                                                                                                                                                                                • This is kind of a WordPress Core suite test case; as such it provides access to its functions and to the often-overlooked static::factory() method; in this instance too there are too many methods to list them all but it's worth noting how easy it is to set up test fixtures with the factory:
                                                                                                                                                                                                                                                                                                                                                  public function test_post_creation(){\n        $random_post_id = static::factory()->post->create();\n        $this->assertInstanceOf(WP_Post::class, get_post($random_post_id));\n}\n
                                                                                                                                                                                                                                                                                                                                                • The factory property can be accessed on the tester property too and will work the same way as if called using static::factory():
                                                                                                                                                                                                                                                                                                                                                  public function test_post_creation(){\n        $random_post_id = $this->tester->factory()->post->create();\n        $this->assertInstanceOf(WP_Post::class, get_post($random_post_id));\n}\n
                                                                                                                                                                                                                                                                                                                                                "},{"location":"v3/modules/WPLoader/#wploader-to-only-bootstrap-wordpress","title":"WPLoader to only bootstrap WordPress","text":"

                                                                                                                                                                                                                                                                                                                                                If the need is to just bootstrap the WordPress installation in the context of the tests variable scope then the WPLoader module loadOnly parameter should be set to true; this could be the case for functional tests in need to access WordPress provided methods, functions and values. An example configuration for the module in this mode is this one:

                                                                                                                                                                                                                                                                                                                                                  modules:\nenabled:\n- WPDb # BEFORE the WPLoader one!\n- WPLoader # AFTER the WPDb one!\nconfig:\nWPDb:\ndsn: 'mysql:host=localhost;dbname=wordpress'\nuser: 'root'\npassword: 'password'\ndump: 'tests/_data/dump.sql'\npopulate: true\ncleanup: true\nwaitlock: 10\nurl: 'http://wordpress.localhost'\nurlReplacement: true\ntablePrefix: 'wp_'\nWPLoader:\nloadOnly: true wpRootFolder: \"/Users/User/www/wordpress\"\ndbName: \"wpress-tests\"\ndbHost: \"localhost\"\ndbUser: \"root\"\ndbPassword: \"root\"\ndomain: \"wordpress.localhost\"\n

                                                                                                                                                                                                                                                                                                                                                With reference to the table above the module will not take care of the test WordPress installation state before and after the tests, the installed and activated plugins, and theme. The module can be used in conjunction with a WPDb module to provide the tests with a WordPress installation suiting the tests at hand; when doing so please take care to list, in the suite configuration file modules section (see example above) the WPDb module before the WPLoader one. Codeception will initialize the modules in the same order they are listed in the modules section of the suite configuration file and the WPLoader module needs the database to be populated by the WPDb module before it runs! As an example this is a correct suite configuration:

                                                                                                                                                                                                                                                                                                                                                modules:\nenabled:\n- WPDb # this before...\n- WPLoader # ...this one.\nconfig:\nWPDb:\n# ...\nWPLoader:\nloadOnly: true\n# ... \n

                                                                                                                                                                                                                                                                                                                                                "},{"location":"v3/modules/WPLoader/#public-api","title":"Public API","text":"
                                                                                                                                                                                                                                                                                                                                                • debugWpActionFinal
                                                                                                                                                                                                                                                                                                                                                • debugWpActionInitial
                                                                                                                                                                                                                                                                                                                                                • debugWpFilterFinal
                                                                                                                                                                                                                                                                                                                                                • debugWpFilterInitial
                                                                                                                                                                                                                                                                                                                                                • factory
                                                                                                                                                                                                                                                                                                                                                • getContentFolder
                                                                                                                                                                                                                                                                                                                                                • getPluginsFolder
                                                                                                                                                                                                                                                                                                                                                • startWpFiltersDebug
                                                                                                                                                                                                                                                                                                                                                • stopWpFiltersDebug
                                                                                                                                                                                                                                                                                                                                                debugWpActionFinal

                                                                                                                                                                                                                                                                                                                                                Debugs a single WordPress action final call using Codeception debug functions. The output will show following the selected output verbosity (--debug and -vvv CLI options).

                                                                                                                                                                                                                                                                                                                                                // Start debugging all WordPress actions final value.\n  add_action('all', [$this,'debugWpActionFinal']);\n  // Run some code firing actions and debug them.\n  // Stop debugging all WordPress actions final value.\n  remove_action('all', [$this,'debugWpActionFinal']);\n
                                                                                                                                                                                                                                                                                                                                                Parameters
                                                                                                                                                                                                                                                                                                                                                • mixed $args
                                                                                                                                                                                                                                                                                                                                                debugWpActionInitial

                                                                                                                                                                                                                                                                                                                                                Debugs a single WordPress action initial call using Codeception debug functions. The output will show following the selected output verbosity (--debug and -vvv CLI options).

                                                                                                                                                                                                                                                                                                                                                // Start debugging all WordPress actions initial value.\n  add_action('all', [$this,'debugWpActionInitial']);\n  // Run some code firing actions and debug them.\n  // Stop debugging all WordPress actions initial value.\n  remove_action('all', [$this,'debugWpActionInitial']);\n
                                                                                                                                                                                                                                                                                                                                                Parameters
                                                                                                                                                                                                                                                                                                                                                • mixed $args
                                                                                                                                                                                                                                                                                                                                                debugWpFilterFinal

                                                                                                                                                                                                                                                                                                                                                Debugs a single WordPress filter final call using Codeception debug functions. The output will show following the selected output verbosity (--debug and -vvv CLI options).

                                                                                                                                                                                                                                                                                                                                                // Start debugging all WordPress filters final value.\n  add_filter('all', [$this,'debugWpFilterFinal']);\n  // Run some code firing filters and debug them.\n  // Stop debugging all WordPress filters final value.\n  remove_filter('all', [$this,'debugWpFilterFinal']);\n
                                                                                                                                                                                                                                                                                                                                                Parameters
                                                                                                                                                                                                                                                                                                                                                • mixed $args
                                                                                                                                                                                                                                                                                                                                                debugWpFilterInitial

                                                                                                                                                                                                                                                                                                                                                Debugs a single WordPress filter initial call using Codeception debug functions. The output will show following the selected output verbosity (--debug and -vvv CLI options).

                                                                                                                                                                                                                                                                                                                                                // Start debugging all WordPress filters initial value.\n  add_filter('all', [$this,'debugWpFilterInitial']);\n  // Run some code firing filters and debug them.\n  // Stop debugging all WordPress filters initial value.\n  remove_filter('all', [$this,'debugWpFilterInitial']);\n
                                                                                                                                                                                                                                                                                                                                                Parameters
                                                                                                                                                                                                                                                                                                                                                • mixed $args
                                                                                                                                                                                                                                                                                                                                                factory

                                                                                                                                                                                                                                                                                                                                                Accessor method to get the object storing the factories for things. This methods gives access to the same factories provided by the Core test suite.

                                                                                                                                                                                                                                                                                                                                                $postId = $I->factory()->post->create();\n  $userId = $I->factory()->user->create(['role' => 'administrator']);\n
                                                                                                                                                                                                                                                                                                                                                getContentFolder

                                                                                                                                                                                                                                                                                                                                                Returns the absolute path to the WordPress content directory.

                                                                                                                                                                                                                                                                                                                                                $content = $this->getContentFolder();\n  $themes = $this->getContentFolder('themes');\n  $twentytwenty = $this->getContentFolder('themes/twentytwenty');\n
                                                                                                                                                                                                                                                                                                                                                Parameters
                                                                                                                                                                                                                                                                                                                                                • string $path - An optional path to append to the content directory absolute path.
                                                                                                                                                                                                                                                                                                                                                getPluginsFolder

                                                                                                                                                                                                                                                                                                                                                Returns the absolute path to the plugins directory. The value will first look at the WP_PLUGIN_DIR constant, then the pluginsFolder configuration parameter and will, finally, look in the default path from the WordPress root directory.

                                                                                                                                                                                                                                                                                                                                                $plugins = $this->getPluginsFolder();\n  $hello = $this->getPluginsFolder('hello.php');\n
                                                                                                                                                                                                                                                                                                                                                Parameters
                                                                                                                                                                                                                                                                                                                                                • string $path - A relative path to append to te plugins directory absolute path.
                                                                                                                                                                                                                                                                                                                                                startWpFiltersDebug

                                                                                                                                                                                                                                                                                                                                                Starts the debug of all WordPress filters and actions. The method hook on all filters and actions to debug their value.

                                                                                                                                                                                                                                                                                                                                                // Start debugging all WordPress filters and action final and initial values.\n  $this->startWpFiltersDebug();\n  // Run some code firing filters and debug them.\n  // Stop debugging all WordPress filters and action final and initial values.\n  $this->stopWpFiltersDebug();\n  the array of arguments as input.\n
                                                                                                                                                                                                                                                                                                                                                Parameters
                                                                                                                                                                                                                                                                                                                                                • \\callable $format - A callback function to format the arguments debug output; the callback will receive
                                                                                                                                                                                                                                                                                                                                                stopWpFiltersDebug

                                                                                                                                                                                                                                                                                                                                                Stops the debug of all WordPress filters and actions.

                                                                                                                                                                                                                                                                                                                                                // Start debugging all WordPress filters and action final and initial values.\n  $this->startWpFiltersDebug();\n  // Run some code firing filters and debug them.\n  // Stop debugging all WordPress filters and action final and initial values.\n  $this->stopWpFiltersDebug();\n

                                                                                                                                                                                                                                                                                                                                                This class extends \\Codeception\\Module

                                                                                                                                                                                                                                                                                                                                                "},{"location":"v3/modules/WPQueries/","title":"WPQueries","text":"

                                                                                                                                                                                                                                                                                                                                                This is the documentation for version 3 of the project. The current version is version 4 and the documentation can be found here.

                                                                                                                                                                                                                                                                                                                                                "},{"location":"v3/modules/WPQueries/#wpqueries-module","title":"WPQueries module","text":"

                                                                                                                                                                                                                                                                                                                                                This module should be used in integration tests, see levels of testing for more information, to make assertions on the database queries made by the global $wpdb object. This module requires the WPLoader module to work. The module will set, if not set already, the SAVEQUERIES constant to true and will throw an exception if the constant is already set to a falsy value.

                                                                                                                                                                                                                                                                                                                                                "},{"location":"v3/modules/WPQueries/#configuration","title":"Configuration","text":"

                                                                                                                                                                                                                                                                                                                                                This module does not require any configuration, but requires the WPLoader module to work correctly.

                                                                                                                                                                                                                                                                                                                                                "},{"location":"v3/modules/WPQueries/#usage","title":"Usage","text":"

                                                                                                                                                                                                                                                                                                                                                This module must be used in a test case extending the \\Codeception\\TestCase\\WPTestCase class.

                                                                                                                                                                                                                                                                                                                                                The module public API is accessible calling via the \\Codeception\\TestCase\\WPTestCase::queries() method:

                                                                                                                                                                                                                                                                                                                                                <?php\nuse Codeception\\Module\\WPQueries;\nclass WPQueriesUsageTest extends \\Codeception\\TestCase\\WPTestCase\n{\npublic function test_queries_made_by_factory_are_not_tracked()\n{\n$currentQueriesCount = $this->queries()->countQueries();\n$this->assertNotEmpty($currentQueriesCount);\nstatic::factory()->post->create_many(3);\n$this->assertNotEmpty($currentQueriesCount);\n$this->assertEquals($currentQueriesCount, $this->queries()->countQueries());\n}\npublic function test_count_queries()\n{\n$currentQueriesCount = $this->queries()->countQueries();\n$this->assertNotEmpty($currentQueriesCount);\nforeach (range(1, 3) as $i) {\nwp_insert_post(['post_title' => 'Post ' . $i, 'post_content' => str_repeat('test', $i)]);\n}\n$this->assertNotEmpty($currentQueriesCount);\n$this->assertGreaterThan($currentQueriesCount, $this->queries()->countQueries());\n}\n}\n
                                                                                                                                                                                                                                                                                                                                                "},{"location":"v3/modules/WPQueries/#public-api","title":"Public API","text":"
                                                                                                                                                                                                                                                                                                                                                • assertCountQueries
                                                                                                                                                                                                                                                                                                                                                • assertNotQueries
                                                                                                                                                                                                                                                                                                                                                • assertNotQueriesByAction
                                                                                                                                                                                                                                                                                                                                                • assertNotQueriesByFilter
                                                                                                                                                                                                                                                                                                                                                • assertNotQueriesByFunction
                                                                                                                                                                                                                                                                                                                                                • assertNotQueriesByMethod
                                                                                                                                                                                                                                                                                                                                                • assertNotQueriesByStatement
                                                                                                                                                                                                                                                                                                                                                • assertNotQueriesByStatementAndAction
                                                                                                                                                                                                                                                                                                                                                • assertNotQueriesByStatementAndFilter
                                                                                                                                                                                                                                                                                                                                                • assertNotQueriesByStatementAndFunction
                                                                                                                                                                                                                                                                                                                                                • assertNotQueriesByStatementAndMethod
                                                                                                                                                                                                                                                                                                                                                • assertQueries
                                                                                                                                                                                                                                                                                                                                                • assertQueriesByAction
                                                                                                                                                                                                                                                                                                                                                • assertQueriesByFilter
                                                                                                                                                                                                                                                                                                                                                • assertQueriesByFunction
                                                                                                                                                                                                                                                                                                                                                • assertQueriesByMethod
                                                                                                                                                                                                                                                                                                                                                • assertQueriesByStatement
                                                                                                                                                                                                                                                                                                                                                • assertQueriesByStatementAndAction
                                                                                                                                                                                                                                                                                                                                                • assertQueriesByStatementAndFilter
                                                                                                                                                                                                                                                                                                                                                • assertQueriesByStatementAndFunction
                                                                                                                                                                                                                                                                                                                                                • assertQueriesByStatementAndMethod
                                                                                                                                                                                                                                                                                                                                                • assertQueriesCountByAction
                                                                                                                                                                                                                                                                                                                                                • assertQueriesCountByFilter
                                                                                                                                                                                                                                                                                                                                                • assertQueriesCountByFunction
                                                                                                                                                                                                                                                                                                                                                • assertQueriesCountByMethod
                                                                                                                                                                                                                                                                                                                                                • assertQueriesCountByStatement
                                                                                                                                                                                                                                                                                                                                                • assertQueriesCountByStatementAndAction
                                                                                                                                                                                                                                                                                                                                                • assertQueriesCountByStatementAndFilter
                                                                                                                                                                                                                                                                                                                                                • assertQueriesCountByStatementAndFunction
                                                                                                                                                                                                                                                                                                                                                • assertQueriesCountByStatementAndMethod
                                                                                                                                                                                                                                                                                                                                                • countQueries
                                                                                                                                                                                                                                                                                                                                                • getQueries
                                                                                                                                                                                                                                                                                                                                                assertCountQueries

                                                                                                                                                                                                                                                                                                                                                Asserts that n queries have been made.

                                                                                                                                                                                                                                                                                                                                                $posts = $this->factory()->post->create_many(3);\n  $cachedUsers = $this->factory()->user->create_many(2);\n  $nonCachedUsers = $this->factory()->user->create_many(2);\n  foreach($cachedUsers as $userId){\n  wp_cache_set('page-posts-for-user-' . $userId, $posts, 'acme');\n  }\n  // Run the same query as different users\n  foreach(array_merge($cachedUsers, $nonCachedUsers) as $userId){\n  $pagePosts = $plugin->getPagePostsForUser($userId);\n  }\n  $I->assertCountQueries(2, 'A query should be made for each user missing cached posts.')\n
                                                                                                                                                                                                                                                                                                                                                Parameters
                                                                                                                                                                                                                                                                                                                                                • int $n - The expected number of queries.
                                                                                                                                                                                                                                                                                                                                                • string $message - An optional message to override the default one.
                                                                                                                                                                                                                                                                                                                                                assertNotQueries

                                                                                                                                                                                                                                                                                                                                                Asserts that no queries were made. Queries generated by setUp, tearDown and factory methods are excluded by default.

                                                                                                                                                                                                                                                                                                                                                $posts = $this->factory()->post->create_many(3);\n  wp_cache_set('page-posts', $posts, 'acme');\n  $pagePosts = $plugin->getPagePosts();\n  $I->assertNotQueries('Queries should not be made if the cache is set.')\n
                                                                                                                                                                                                                                                                                                                                                Parameters
                                                                                                                                                                                                                                                                                                                                                • string $message - An optional message to override the default one.
                                                                                                                                                                                                                                                                                                                                                assertNotQueriesByAction

                                                                                                                                                                                                                                                                                                                                                Asserts that no queries were made as a consequence of the specified action. Queries generated by setUp, tearDown and factory methods are excluded by default.

                                                                                                                                                                                                                                                                                                                                                add_action( 'edit_post', function($postId){\n  $count = get_option('acme_title_updates_count');\n  update_option('acme_title_updates_count', ++$count);\n  } );\n  wp_delete_post($bookId);\n  $this->assertNotQueriesByAction('edit_post');\n
                                                                                                                                                                                                                                                                                                                                                Parameters
                                                                                                                                                                                                                                                                                                                                                • string $action - The action name, e.g. 'init'.
                                                                                                                                                                                                                                                                                                                                                • string $message - An optional message to override the default one.
                                                                                                                                                                                                                                                                                                                                                assertNotQueriesByFilter

                                                                                                                                                                                                                                                                                                                                                Asserts that no queries were made as a consequence of the specified filter. Queries generated by setUp, tearDown and factory methods are excluded by default.

                                                                                                                                                                                                                                                                                                                                                add_filter('the_title', function($title, $postId){\n  $post = get_post($postId);\n  if($post->post_type !== 'book'){\n  return $title;\n  }\n  $new = get_option('acme_new_prefix');\n  return \"{$new} - \" . $title;\n  });\n  $title = apply_filters('the_title', get_post($notABookId)->post_title, $notABookId);\n  $this->assertNotQueriesByFilter('the_title');\n
                                                                                                                                                                                                                                                                                                                                                Parameters
                                                                                                                                                                                                                                                                                                                                                • string $filter - The filter name, e.g. 'posts_where'.
                                                                                                                                                                                                                                                                                                                                                • string $message - An optional message to override the default one.
                                                                                                                                                                                                                                                                                                                                                assertNotQueriesByFunction

                                                                                                                                                                                                                                                                                                                                                Asserts that no queries were made by the specified function. Queries generated by setUp, tearDown and factory methods are excluded by default.

                                                                                                                                                                                                                                                                                                                                                $this->assertEmpty(Acme\\get_orphaned_posts());\n  Acme\\delete_orphaned_posts();\n  $this->assertNotQueriesByFunction('Acme\\delete_orphaned_posts');\n
                                                                                                                                                                                                                                                                                                                                                Parameters
                                                                                                                                                                                                                                                                                                                                                • string $function - The fully qualified name of the function to check.
                                                                                                                                                                                                                                                                                                                                                • string $message - An optional message to override the default one.
                                                                                                                                                                                                                                                                                                                                                assertNotQueriesByMethod

                                                                                                                                                                                                                                                                                                                                                Asserts that no queries have been made by the specified class method. Queries generated by setUp, tearDown and factory methods are excluded by default.

                                                                                                                                                                                                                                                                                                                                                $options = new Acme\\Options();\n  $options->update('adsSource', 'not-a-real-url.org');\n  $I->assertNotQueriesByMethod('Acme\\Options', 'update');\n
                                                                                                                                                                                                                                                                                                                                                Parameters
                                                                                                                                                                                                                                                                                                                                                • string $class - The fully qualified name of the class to check.
                                                                                                                                                                                                                                                                                                                                                • string $method - The name of the method to check.
                                                                                                                                                                                                                                                                                                                                                • string $message - An optional message to override the default one.
                                                                                                                                                                                                                                                                                                                                                assertNotQueriesByStatement

                                                                                                                                                                                                                                                                                                                                                Asserts that no queries have been made by the specified class method. Queries generated by setUp, tearDown and factory methods are excluded by default.

                                                                                                                                                                                                                                                                                                                                                $bookRepository = new Acme\\BookRepository();\n  $repository->where('ID', 23)->set('title', 'Peter Pan', $deferred = true);\n  $this->assertNotQueriesByStatement('INSERT', 'Deferred write should happen on __destruct');\n  Regular expressions must contain delimiters.\n
                                                                                                                                                                                                                                                                                                                                                Parameters
                                                                                                                                                                                                                                                                                                                                                • string $statement - A simple string the statement should start with or a valid regular expression.
                                                                                                                                                                                                                                                                                                                                                • string $message - An optional message to override the default one.
                                                                                                                                                                                                                                                                                                                                                assertNotQueriesByStatementAndAction

                                                                                                                                                                                                                                                                                                                                                Asserts that no queries were made as a consequence of the specified action containing the SQL query. Queries generated by setUp, tearDown and factory methods are excluded by default.

                                                                                                                                                                                                                                                                                                                                                add_action( 'edit_post', function($postId){\n  $count = get_option('acme_title_updates_count');\n  update_option('acme_title_updates_count', ++$count);\n  } );\n  wp_delete_post($bookId);\n  $this->assertNotQueriesByStatementAndAction('DELETE', 'delete_post');\n  Regular expressions must contain delimiters.\n
                                                                                                                                                                                                                                                                                                                                                Parameters
                                                                                                                                                                                                                                                                                                                                                • string $statement - A simple string the statement should start with or a valid regular expression.
                                                                                                                                                                                                                                                                                                                                                • string $action - The action name, e.g. 'init'.
                                                                                                                                                                                                                                                                                                                                                • string $message - An optional message to override the default one.
                                                                                                                                                                                                                                                                                                                                                assertNotQueriesByStatementAndFilter

                                                                                                                                                                                                                                                                                                                                                Asserts that no queries were made as a consequence of the specified filter containing the specified SQL query. Queries generated by setUp, tearDown and factory methods are excluded by default.

                                                                                                                                                                                                                                                                                                                                                add_filter('the_title', function($title, $postId){\n  $post = get_post($postId);\n  if($post->post_type !== 'book'){\n  return $title;\n  }\n  $new = get_option('acme_new_prefix');\n  return \"{$new} - \" . $title;\n  });\n  $title = apply_filters('the_title', get_post($notABookId)->post_title, $notABookId);\n  $this->assertNotQueriesByStatementAndFilter('SELECT', 'the_title');\n  Regular expressions must contain delimiters.\n
                                                                                                                                                                                                                                                                                                                                                Parameters
                                                                                                                                                                                                                                                                                                                                                • string $statement - A simple string the statement should start with or a valid regular expression.
                                                                                                                                                                                                                                                                                                                                                • string $filter - The filter name, e.g. 'posts_where'.
                                                                                                                                                                                                                                                                                                                                                • string $message - An optional message to override the default one.
                                                                                                                                                                                                                                                                                                                                                assertNotQueriesByStatementAndFunction

                                                                                                                                                                                                                                                                                                                                                Asserts that no queries were made by the specified function starting with the specified SQL statement. Queries generated by setUp, tearDown and factory methods are excluded by default.

                                                                                                                                                                                                                                                                                                                                                wp_insert_post(['ID' => $bookId, 'post_title' => 'The Call of the Wild']);\n  $this->assertNotQueriesByStatementAndFunction('INSERT', 'wp_insert_post');\n  $this->assertQueriesByStatementAndFunction('UPDATE', 'wp_insert_post');\n  Regular expressions must contain delimiters.\n
                                                                                                                                                                                                                                                                                                                                                Parameters
                                                                                                                                                                                                                                                                                                                                                • string $statement - A simple string the statement should start with or a valid regular expression.
                                                                                                                                                                                                                                                                                                                                                • string $function - The name of the function to check the assertions for.
                                                                                                                                                                                                                                                                                                                                                • string $message - An optional message to override the default one.
                                                                                                                                                                                                                                                                                                                                                assertNotQueriesByStatementAndMethod

                                                                                                                                                                                                                                                                                                                                                Asserts that no queries were made by the specified class method starting with the specified SQL statement. Queries generated by setUp, tearDown and factory methods are excluded by default.

                                                                                                                                                                                                                                                                                                                                                Acme\\BookRepository::new(['title' => 'Alice in Wonderland'])->commit();\n  $this->assertQueriesByStatementAndMethod('INSERT', Acme\\BookRepository::class, 'commit');\n  Regular expressions must contain delimiters.\n
                                                                                                                                                                                                                                                                                                                                                Parameters
                                                                                                                                                                                                                                                                                                                                                • string $statement - A simple string the statement should start with or a valid regular expression.
                                                                                                                                                                                                                                                                                                                                                • string $class - The fully qualified name of the class to check.
                                                                                                                                                                                                                                                                                                                                                • string $method - The name of the method to check.
                                                                                                                                                                                                                                                                                                                                                • string $message - An optional message to override the default one.
                                                                                                                                                                                                                                                                                                                                                assertQueries

                                                                                                                                                                                                                                                                                                                                                Asserts that at least one query was made during the test. Queries generated by setUp, tearDown and factory methods are excluded by default.

                                                                                                                                                                                                                                                                                                                                                wp_cache_delete('page-posts', 'acme');\n  $pagePosts = $plugin->getPagePosts();\n  $I->assertQueries('Queries should be made to set the cache.')\n
                                                                                                                                                                                                                                                                                                                                                Parameters
                                                                                                                                                                                                                                                                                                                                                • string $message - An optional message to override the default one.
                                                                                                                                                                                                                                                                                                                                                assertQueriesByAction

                                                                                                                                                                                                                                                                                                                                                Asserts that at least one query was made as a consequence of the specified action. Queries generated by setUp, tearDown and factory methods are excluded by default.

                                                                                                                                                                                                                                                                                                                                                add_action( 'edit_post', function($postId){\n  $count = get_option('acme_title_updates_count');\n  update_option('acme_title_updates_count', ++$count);\n  } );\n  wp_update_post(['ID' => $bookId, 'post_title' => 'New Title']);\n  $this->assertQueriesByAction('edit_post');\n
                                                                                                                                                                                                                                                                                                                                                Parameters
                                                                                                                                                                                                                                                                                                                                                • string $action - The action name, e.g. 'init'.
                                                                                                                                                                                                                                                                                                                                                • string $message - An optional message to override the default one.
                                                                                                                                                                                                                                                                                                                                                assertQueriesByFilter

                                                                                                                                                                                                                                                                                                                                                Asserts that at least one query was made as a consequence of the specified filter. Queries generated by setUp, tearDown and factory methods are excluded by default.

                                                                                                                                                                                                                                                                                                                                                add_filter('the_title', function($title, $postId){\n  $post = get_post($postId);\n  if($post->post_type !== 'book'){\n  return $title;\n  }\n  $new = get_option('acme_new_prefix');\n  return \"{$new} - \" . $title;\n  });\n  $title = apply_filters('the_title', get_post($bookId)->post_title, $bookId);\n  $this->assertQueriesByFilter('the_title');\n
                                                                                                                                                                                                                                                                                                                                                Parameters
                                                                                                                                                                                                                                                                                                                                                • string $filter - The filter name, e.g. 'posts_where'.
                                                                                                                                                                                                                                                                                                                                                • string $message - An optional message to override the default one.
                                                                                                                                                                                                                                                                                                                                                assertQueriesByFunction

                                                                                                                                                                                                                                                                                                                                                Asserts that queries were made by the specified function. Queries generated by setUp, tearDown and factory methods are excluded by default.

                                                                                                                                                                                                                                                                                                                                                acme_clean_queue();\n  $this->assertQueriesByFunction('acme_clean_queue');\n
                                                                                                                                                                                                                                                                                                                                                Parameters
                                                                                                                                                                                                                                                                                                                                                • string $function - The fully qualified name of the function to check.
                                                                                                                                                                                                                                                                                                                                                • string $message - An optional message to override the default one.
                                                                                                                                                                                                                                                                                                                                                assertQueriesByMethod

                                                                                                                                                                                                                                                                                                                                                Asserts that at least one query has been made by the specified class method. Queries generated by setUp, tearDown and factory methods are excluded by default.

                                                                                                                                                                                                                                                                                                                                                $options = new Acme\\Options();\n  $options->update('showAds', false);\n  $I->assertQueriesByMethod('Acme\\Options', 'update');\n
                                                                                                                                                                                                                                                                                                                                                Parameters
                                                                                                                                                                                                                                                                                                                                                • string $class - The fully qualified name of the class to check.
                                                                                                                                                                                                                                                                                                                                                • string $method - The name of the method to check.
                                                                                                                                                                                                                                                                                                                                                • string $message - An optional message to override the default one.
                                                                                                                                                                                                                                                                                                                                                assertQueriesByStatement

                                                                                                                                                                                                                                                                                                                                                Asserts that at least a query starting with the specified statement was made. Queries generated by setUp, tearDown and factory methods are excluded by default.

                                                                                                                                                                                                                                                                                                                                                wp_cache_flush();\n  cached_get_posts($args);\n  $I->assertQueriesByStatement('SELECT');\n  Regular expressions must contain delimiters.\n
                                                                                                                                                                                                                                                                                                                                                Parameters
                                                                                                                                                                                                                                                                                                                                                • string $statement - A simple string the statement should start with or a valid regular expression.
                                                                                                                                                                                                                                                                                                                                                • string $message - An optional message to override the default one.
                                                                                                                                                                                                                                                                                                                                                assertQueriesByStatementAndAction

                                                                                                                                                                                                                                                                                                                                                Asserts that at least one query was made as a consequence of the specified action containing the SQL query. Queries generated by setUp, tearDown and factory methods are excluded by default.

                                                                                                                                                                                                                                                                                                                                                add_action( 'edit_post', function($postId){\n  $count = get_option('acme_title_updates_count');\n  update_option('acme_title_updates_count', ++$count);\n  } );\n  wp_update_post(['ID' => $bookId, 'post_title' => 'New']);\n  $this->assertQueriesByStatementAndAction('UPDATE', 'edit_post');\n  Regular expressions must contain delimiters.\n
                                                                                                                                                                                                                                                                                                                                                Parameters
                                                                                                                                                                                                                                                                                                                                                • string $statement - A simple string the statement should start with or a valid regular expression.
                                                                                                                                                                                                                                                                                                                                                • string $action - The action name, e.g. 'init'.
                                                                                                                                                                                                                                                                                                                                                • string $message - An optional message to override the default one.
                                                                                                                                                                                                                                                                                                                                                assertQueriesByStatementAndFilter

                                                                                                                                                                                                                                                                                                                                                Asserts that at least one query was made as a consequence of the specified filter containing the SQL query. Queries generated by setUp, tearDown and factory methods are excluded by default.

                                                                                                                                                                                                                                                                                                                                                add_filter('the_title', function($title, $postId){\n  $post = get_post($postId);\n  if($post->post_type !== 'book'){\n  return $title;\n  }\n  $new = get_option('acme_new_prefix');\n  return \"{$new} - \" . $title;\n  });\n  $title = apply_filters('the_title', get_post($bookId)->post_title, $bookId);\n  $this->assertQueriesByStatementAndFilter('SELECT', 'the_title');\n  Regular expressions must contain delimiters.\n
                                                                                                                                                                                                                                                                                                                                                Parameters
                                                                                                                                                                                                                                                                                                                                                • string $statement - A simple string the statement should start with or a valid regular expression.
                                                                                                                                                                                                                                                                                                                                                • string $filter - The filter name, e.g. 'posts_where'.
                                                                                                                                                                                                                                                                                                                                                • string $message - An optional message to override the default one.
                                                                                                                                                                                                                                                                                                                                                assertQueriesByStatementAndFunction

                                                                                                                                                                                                                                                                                                                                                Asserts that queries were made by the specified function starting with the specified SQL statement. Queries generated by setUp, tearDown and factory methods are excluded by default.

                                                                                                                                                                                                                                                                                                                                                wp_insert_post(['post_type' => 'book', 'post_title' => 'Alice in Wonderland']);\n  $this->assertQueriesByStatementAndFunction('INSERT', 'wp_insert_post');\n  Regular expressions must contain delimiters.\n
                                                                                                                                                                                                                                                                                                                                                Parameters
                                                                                                                                                                                                                                                                                                                                                • string $statement - A simple string the statement should start with or a valid regular expression.
                                                                                                                                                                                                                                                                                                                                                • string $function - The fully qualified function name.
                                                                                                                                                                                                                                                                                                                                                • string $message - An optional message to override the default one.
                                                                                                                                                                                                                                                                                                                                                assertQueriesByStatementAndMethod

                                                                                                                                                                                                                                                                                                                                                Asserts that queries were made by the specified class method starting with the specified SQL statement. Queries generated by setUp, tearDown and factory methods are excluded by default.

                                                                                                                                                                                                                                                                                                                                                Acme\\BookRepository::new(['title' => 'Alice in Wonderland'])->commit();\n  $this->assertQueriesByStatementAndMethod('UPDATE', Acme\\BookRepository::class, 'commit');\n  Regular expressions must contain delimiters.\n
                                                                                                                                                                                                                                                                                                                                                Parameters
                                                                                                                                                                                                                                                                                                                                                • string $statement - A simple string the statement should start with or a valid regular expression.
                                                                                                                                                                                                                                                                                                                                                • string $class - The fully qualified name of the class to check.
                                                                                                                                                                                                                                                                                                                                                • string $method - The name of the method to check.
                                                                                                                                                                                                                                                                                                                                                • string $message - An optional message to override the default one.
                                                                                                                                                                                                                                                                                                                                                assertQueriesCountByAction

                                                                                                                                                                                                                                                                                                                                                Asserts that n queries were made as a consequence of the specified action. Queries generated by setUp, tearDown and factory methods are excluded by default.

                                                                                                                                                                                                                                                                                                                                                add_action( 'edit_post', function($postId){\n  $count = get_option('acme_title_updates_count');\n  update_option('acme_title_updates_count', ++$count);\n  } );\n  wp_update_post(['ID' => $bookOneId, 'post_title' => 'One']);\n  wp_update_post(['ID' => $bookTwoId, 'post_title' => 'Two']);\n  wp_update_post(['ID' => $bookThreeId, 'post_title' => 'Three']);\n  $this->assertQueriesCountByAction(3, 'edit_post');\n
                                                                                                                                                                                                                                                                                                                                                Parameters
                                                                                                                                                                                                                                                                                                                                                • int $n - The expected number of queries.
                                                                                                                                                                                                                                                                                                                                                • string $action - The action name, e.g. 'init'.
                                                                                                                                                                                                                                                                                                                                                • string $message - An optional message to override the default one.
                                                                                                                                                                                                                                                                                                                                                assertQueriesCountByFilter

                                                                                                                                                                                                                                                                                                                                                Asserts that n queries were made as a consequence of the specified filter. Queries generated by setUp, tearDown and factory methods are excluded by default.

                                                                                                                                                                                                                                                                                                                                                add_filter('the_title', function($title, $postId){\n  $post = get_post($postId);\n  if($post->post_type !== 'book'){\n  return $title;\n  }\n  $new = get_option('acme_new_prefix');\n  return \"{$new} - \" . $title;\n  });\n  $title = apply_filters('the_title', get_post($bookOneId)->post_title, $bookOneId);\n  $title = apply_filters('the_title', get_post($notABookId)->post_title, $notABookId);\n  $title = apply_filters('the_title', get_post($bookTwoId)->post_title, $bookTwoId);\n  $this->assertQueriesCountByFilter(2, 'the_title');\n
                                                                                                                                                                                                                                                                                                                                                Parameters
                                                                                                                                                                                                                                                                                                                                                • int $n - The expected number of queries.
                                                                                                                                                                                                                                                                                                                                                • string $filter - The filter name, e.g. 'posts_where'.
                                                                                                                                                                                                                                                                                                                                                • string $message - An optional message to override the default one.
                                                                                                                                                                                                                                                                                                                                                assertQueriesCountByFunction

                                                                                                                                                                                                                                                                                                                                                Asserts that n queries were made by the specified function. Queries generated by setUp, tearDown and factory methods are excluded by default.

                                                                                                                                                                                                                                                                                                                                                $this->assertCount(3, Acme\\get_orphaned_posts());\n  Acme\\delete_orphaned_posts();\n  $this->assertQueriesCountByFunction(3, 'Acme\\delete_orphaned_posts');\n
                                                                                                                                                                                                                                                                                                                                                Parameters
                                                                                                                                                                                                                                                                                                                                                • int $n - The expected number of queries.
                                                                                                                                                                                                                                                                                                                                                • string $function - The function to check the queries for.
                                                                                                                                                                                                                                                                                                                                                • string $message - An optional message to override the default one.
                                                                                                                                                                                                                                                                                                                                                assertQueriesCountByMethod

                                                                                                                                                                                                                                                                                                                                                Asserts that n queries have been made by the specified class method. Queries generated by setUp, tearDown and factory methods are excluded by default.

                                                                                                                                                                                                                                                                                                                                                $bookRepository = new Acme\\BookRepository();\n  $repository->where('ID', 23)->commit('title', 'Peter Pan');\n  $repository->where('ID', 89)->commit('title', 'Moby-dick');\n  $repository->where('ID', 2389)->commit('title', 'The call of the wild');\n  $this->assertQueriesCountByMethod(3, 'Acme\\BookRepository', 'commit');\n
                                                                                                                                                                                                                                                                                                                                                Parameters
                                                                                                                                                                                                                                                                                                                                                • int $n - The expected number of queries.
                                                                                                                                                                                                                                                                                                                                                • string $class - The fully qualified name of the class to check.
                                                                                                                                                                                                                                                                                                                                                • string $method - The name of the method to check.
                                                                                                                                                                                                                                                                                                                                                • string $message - An optional message to override the default one.
                                                                                                                                                                                                                                                                                                                                                assertQueriesCountByStatement

                                                                                                                                                                                                                                                                                                                                                Asserts that n queries starting with the specified statement were made. Queries generated by setUp, tearDown and factory methods are excluded by default.

                                                                                                                                                                                                                                                                                                                                                $bookRepository = new Acme\\BookRepository();\n  $repository->where('ID', 23)->set('title', 'Peter Pan', $deferred = true);\n  $repository->where('ID', 89)->set('title', 'Moby-dick', $deferred = true);\n  $repository->where('ID', 2389)->set('title', 'The call of the wild', $deferred = false);\n  $this->assertQueriesCountByStatement(1, 'INSERT', 'Deferred write should happen on __destruct');\n  Regular expressions must contain delimiters.\n
                                                                                                                                                                                                                                                                                                                                                Parameters
                                                                                                                                                                                                                                                                                                                                                • int $n - The expected number of queries.
                                                                                                                                                                                                                                                                                                                                                • string $statement - A simple string the statement should start with or a valid regular expression.
                                                                                                                                                                                                                                                                                                                                                • string $message - An optional message to override the default one.
                                                                                                                                                                                                                                                                                                                                                assertQueriesCountByStatementAndAction

                                                                                                                                                                                                                                                                                                                                                Asserts that n queries were made as a consequence of the specified action containing the specified SQL statement. Queries generated by setUp, tearDown and factory methods are excluded by default.

                                                                                                                                                                                                                                                                                                                                                add_action( 'edit_post', function($postId){\n  $count = get_option('acme_title_updates_count');\n  update_option('acme_title_updates_count', ++$count);\n  } );\n  wp_delete_post($bookOneId);\n  wp_delete_post($bookTwoId);\n  wp_update_post(['ID' => $bookThreeId, 'post_title' => 'New']);\n  $this->assertQueriesCountByStatementAndAction(2, 'DELETE', 'delete_post');\n  $this->assertQueriesCountByStatementAndAction(1, 'INSERT', 'edit_post');\n  Regular expressions must contain delimiters.\n
                                                                                                                                                                                                                                                                                                                                                Parameters
                                                                                                                                                                                                                                                                                                                                                • int $n - The expected number of queries.
                                                                                                                                                                                                                                                                                                                                                • string $statement - A simple string the statement should start with or a valid regular expression.
                                                                                                                                                                                                                                                                                                                                                • string $action - The action name, e.g. 'init'.
                                                                                                                                                                                                                                                                                                                                                • string $message - An optional message to override the default one.
                                                                                                                                                                                                                                                                                                                                                assertQueriesCountByStatementAndFilter

                                                                                                                                                                                                                                                                                                                                                Asserts that n queries were made as a consequence of the specified filter containing the specified SQL statement. Queries generated by setUp, tearDown and factory methods are excluded by default.

                                                                                                                                                                                                                                                                                                                                                add_filter('the_title', function($title, $postId){\n  $post = get_post($postId);\n  if($post->post_type !== 'book'){\n  return $title;\n  }\n  $new = get_option('acme_new_prefix');\n  return \"{$new} - \" . $title;\n  });\n  // Warm up the cache.\n  $title = apply_filters('the_title', get_post($bookOneId)->post_title, $bookOneId);\n  // Cache is warmed up now.\n  $title = apply_filters('the_title', get_post($bookTwoId)->post_title, $bookTwoId);\n  $title = apply_filters('the_title', get_post($bookThreeId)->post_title, $bookThreeId);\n  $this->assertQueriesCountByStatementAndFilter(1, 'SELECT', 'the_title');\n  Regular expressions must contain delimiters.\n
                                                                                                                                                                                                                                                                                                                                                Parameters
                                                                                                                                                                                                                                                                                                                                                • int $n - The expected number of queries.
                                                                                                                                                                                                                                                                                                                                                • string $statement - A simple string the statement should start with or a valid regular expression.
                                                                                                                                                                                                                                                                                                                                                • string $filter - The filter name, e.g. 'posts_where'.
                                                                                                                                                                                                                                                                                                                                                • string $message - An optional message to override the default one.
                                                                                                                                                                                                                                                                                                                                                assertQueriesCountByStatementAndFunction

                                                                                                                                                                                                                                                                                                                                                Asserts that n queries were made by the specified function starting with the specified SQL statement. Queries generated by setUp, tearDown and factory methods are excluded by default.

                                                                                                                                                                                                                                                                                                                                                wp_insert_post(['post_type' => 'book', 'post_title' => 'The Call of the Wild']);\n  wp_insert_post(['post_type' => 'book', 'post_title' => 'Alice in Wonderland']);\n  wp_insert_post(['post_type' => 'book', 'post_title' => 'The Chocolate Factory']);\n  $this->assertQueriesCountByStatementAndFunction(3, 'INSERT', 'wp_insert_post');\n  Regular expressions must contain delimiters.\n
                                                                                                                                                                                                                                                                                                                                                Parameters
                                                                                                                                                                                                                                                                                                                                                • int $n - The expected number of queries.
                                                                                                                                                                                                                                                                                                                                                • string $statement - A simple string the statement should start with or a valid regular expression.
                                                                                                                                                                                                                                                                                                                                                • string $function - The fully-qualified function name.
                                                                                                                                                                                                                                                                                                                                                • string $message - An optional message to override the default one.
                                                                                                                                                                                                                                                                                                                                                assertQueriesCountByStatementAndMethod

                                                                                                                                                                                                                                                                                                                                                Asserts that n queries were made by the specified class method starting with the specified SQL statement. Queries generated by setUp, tearDown and factory methods are excluded by default.

                                                                                                                                                                                                                                                                                                                                                Acme\\BookRepository::new(['title' => 'Alice in Wonderland'])->commit();\n  Acme\\BookRepository::new(['title' => 'Moby-Dick'])->commit();\n  Acme\\BookRepository::new(['title' => 'The Call of the Wild'])->commit();\n  $this->assertQueriesCountByStatementAndMethod(3, 'INSERT', Acme\\BookRepository::class, 'commit');\n  Regular expressions must contain delimiters.\n
                                                                                                                                                                                                                                                                                                                                                Parameters
                                                                                                                                                                                                                                                                                                                                                • int $n - The expected number of queries.
                                                                                                                                                                                                                                                                                                                                                • string $statement - A simple string the statement should start with or a valid regular expression.
                                                                                                                                                                                                                                                                                                                                                • string $class - The fully qualified name of the class to check.
                                                                                                                                                                                                                                                                                                                                                • string $method - The name of the method to check.
                                                                                                                                                                                                                                                                                                                                                • string $message - An optional message to override the default one.
                                                                                                                                                                                                                                                                                                                                                countQueries

                                                                                                                                                                                                                                                                                                                                                Returns the current number of queries. Set-up and tear-down queries performed by the test case are filtered out.

                                                                                                                                                                                                                                                                                                                                                // In a WPTestCase, using the global $wpdb object.\n  $queriesCount = $this->queries()->countQueries();\n  // In a WPTestCase, using a custom $wpdb object.\n  $queriesCount = $this->queries()->countQueries($customWdbb);\n
                                                                                                                                                                                                                                                                                                                                                Parameters
                                                                                                                                                                                                                                                                                                                                                • \\wpdb/null $wpdb - A specific instance of the wpdb class or null to use the global one.
                                                                                                                                                                                                                                                                                                                                                getQueries

                                                                                                                                                                                                                                                                                                                                                Returns the queries currently performed by the global database object or the specified one. Set-up and tear-down queries performed by the test case are filtered out.

                                                                                                                                                                                                                                                                                                                                                // In a WPTestCase, using the global $wpdb object.\n  $queries = $this->queries()->getQueries();\n  // In a WPTestCase, using a custom $wpdb object.\n  $queries = $this->queries()->getQueries($customWdbb);\n
                                                                                                                                                                                                                                                                                                                                                Parameters
                                                                                                                                                                                                                                                                                                                                                • null/\\wpdb $wpdb - A specific instance of the wpdb class or null to use the global one.

                                                                                                                                                                                                                                                                                                                                                This class extends \\Codeception\\Module

                                                                                                                                                                                                                                                                                                                                                "},{"location":"v3/modules/WPWebDriver/","title":"WPWebDriver","text":"

                                                                                                                                                                                                                                                                                                                                                This is the documentation for version 3 of the project. The current version is version 4 and the documentation can be found here.

                                                                                                                                                                                                                                                                                                                                                "},{"location":"v3/modules/WPWebDriver/#wpwebdriver-module","title":"WpWebDriver module","text":"

                                                                                                                                                                                                                                                                                                                                                This module should be used in acceptance tests, see levels of testing for more information.

                                                                                                                                                                                                                                                                                                                                                This module extends the WebDriver module adding WordPress-specific configuration parameters and methods.

                                                                                                                                                                                                                                                                                                                                                The module simulates a user interaction with the site with Javascript support; if you don't need to test your project with Javascript support use the WPBrowser module.

                                                                                                                                                                                                                                                                                                                                                "},{"location":"v3/modules/WPWebDriver/#module-requirements-for-codeception-40","title":"Module requirements for Codeception 4.0+","text":"

                                                                                                                                                                                                                                                                                                                                                This module requires the codeception/module-webdriver Composer package to work when wp-browser is used with Codeception 4.0.

                                                                                                                                                                                                                                                                                                                                                To install the package run:

                                                                                                                                                                                                                                                                                                                                                composer require --dev codeception/module-webdriver:^1.0\n
                                                                                                                                                                                                                                                                                                                                                "},{"location":"v3/modules/WPWebDriver/#configuration","title":"Configuration","text":"

                                                                                                                                                                                                                                                                                                                                                Due to the combination of possible browsers, capabilities and configurations, it's not possible to provide an exhaustive coverage of all the possible configuration parameteters here.

                                                                                                                                                                                                                                                                                                                                                Please refer to WebDriver documentation for more information.

                                                                                                                                                                                                                                                                                                                                                • url required - Start URL of your WordPress project, e.g. http://wp.test.
                                                                                                                                                                                                                                                                                                                                                • adminUsername required - This is the login name, not the \"nice\" name, of the administrator user of the WordPress test site. This will be used to fill the username field in WordPress login page.
                                                                                                                                                                                                                                                                                                                                                • adminPassword required - This is the the password of the administrator use of the WordPress test site. This will be used to fill the password in WordPress login page.
                                                                                                                                                                                                                                                                                                                                                • adminPath required - The path, relative to the WordPress test site home URL, to the administration area, usually /wp-admin.
                                                                                                                                                                                                                                                                                                                                                • browser - The browser to use for the tests, e.g. chrome or firefox.
                                                                                                                                                                                                                                                                                                                                                • capabilities - Depending on the browser set in browser this is a list of browser-specific capabilities.
                                                                                                                                                                                                                                                                                                                                                "},{"location":"v3/modules/WPWebDriver/#example-configuration","title":"Example configuration","text":"
                                                                                                                                                                                                                                                                                                                                                modules:\nenabled:\n- WPWebDriver\nconfig:\nWPWebDriver:\nurl: 'http://wp.test'\nadminUsername: 'admin'\nadminPassword: 'password'\nadminPath: '/wp-admin'\nbrowser: chrome\nhost: localhost\nport: 4444\nwindow_size: false #disabled for Chrome driver\ncapabilities:\nchromeOptions:\nargs: [\"--headless\", \"--disable-gpu\", \"--proxy-server='direct://'\", \"--proxy-bypass-list=*\"]\n
                                                                                                                                                                                                                                                                                                                                                "},{"location":"v3/modules/WPWebDriver/#public-api","title":"Public API","text":"
                                                                                                                                                                                                                                                                                                                                                • activatePlugin
                                                                                                                                                                                                                                                                                                                                                • amEditingPostWithId
                                                                                                                                                                                                                                                                                                                                                • amOnAdminAjaxPage
                                                                                                                                                                                                                                                                                                                                                • amOnAdminPage
                                                                                                                                                                                                                                                                                                                                                • amOnCronPage
                                                                                                                                                                                                                                                                                                                                                • amOnPagesPage
                                                                                                                                                                                                                                                                                                                                                • amOnPluginsPage
                                                                                                                                                                                                                                                                                                                                                • deactivatePlugin
                                                                                                                                                                                                                                                                                                                                                • dontSeePluginInstalled
                                                                                                                                                                                                                                                                                                                                                • grabCookiesWithPattern
                                                                                                                                                                                                                                                                                                                                                • grabFullUrl
                                                                                                                                                                                                                                                                                                                                                • grabWordPressTestCookie
                                                                                                                                                                                                                                                                                                                                                • logOut
                                                                                                                                                                                                                                                                                                                                                • loginAs
                                                                                                                                                                                                                                                                                                                                                • loginAsAdmin
                                                                                                                                                                                                                                                                                                                                                • seeErrorMessage
                                                                                                                                                                                                                                                                                                                                                • seeMessage
                                                                                                                                                                                                                                                                                                                                                • seePluginActivated
                                                                                                                                                                                                                                                                                                                                                • seePluginDeactivated
                                                                                                                                                                                                                                                                                                                                                • seePluginInstalled
                                                                                                                                                                                                                                                                                                                                                • seeWpDiePage
                                                                                                                                                                                                                                                                                                                                                • waitForJqueryAjax
                                                                                                                                                                                                                                                                                                                                                activatePlugin

                                                                                                                                                                                                                                                                                                                                                In the plugin administration screen activates one or more plugins clicking the \"Activate\" link. The method will not handle authentication and navigation to the plugins administration page.

                                                                                                                                                                                                                                                                                                                                                // Activate a plugin.\n  $I->loginAsAdmin();\n  $I->amOnPluginsPage();\n  $I->activatePlugin('hello-dolly');\n  // Activate a list of plugins.\n  $I->loginAsAdmin();\n  $I->amOnPluginsPage();\n  $I->activatePlugin(['hello-dolly','another-plugin']);\n
                                                                                                                                                                                                                                                                                                                                                Parameters
                                                                                                                                                                                                                                                                                                                                                • string/\\Codeception\\Module\\array $pluginSlug - The plugin slug, like \"hello-dolly\" or a list of plugin slugs. amEditingPostWithId

                                                                                                                                                                                                                                                                                                                                                  Go to the admin page to edit the post with the specified ID. The method will not handle authentication the admin area.

                                                                                                                                                                                                                                                                                                                                                  $I->loginAsAdmin();\n  $postId = $I->havePostInDatabase();\n  $I->amEditingPostWithId($postId);\n  $I->fillField('post_title', 'Post title');\n
                                                                                                                                                                                                                                                                                                                                                  Parameters
                                                                                                                                                                                                                                                                                                                                                  • int $id - The post ID.
                                                                                                                                                                                                                                                                                                                                                  amOnAdminAjaxPage

                                                                                                                                                                                                                                                                                                                                                  Go to the admin-ajax.php page to start a synchronous, and blocking, GET AJAX request. The method will not handle authentication, nonces or authorization.

                                                                                                                                                                                                                                                                                                                                                  $I->amOnAdminAjaxPage(['action' => 'my-action', 'data' => ['id' => 23], 'nonce' => $nonce]);\n
                                                                                                                                                                                                                                                                                                                                                  Parameters
                                                                                                                                                                                                                                                                                                                                                  • string/\\Codeception\\Module\\array $queryVars - A string or array of query variables to append to the AJAX path. amOnAdminPage

                                                                                                                                                                                                                                                                                                                                                    Go to a page in the admininstration area of the site. This method will not handle authentication to the administration area.

                                                                                                                                                                                                                                                                                                                                                    $I->loginAs('user', 'password');\n  // Go to the plugins management screen.\n  $I->amOnAdminPage('/plugins.php');\n
                                                                                                                                                                                                                                                                                                                                                    Parameters
                                                                                                                                                                                                                                                                                                                                                    • string $page - The path, relative to the admin area URL, to the page.
                                                                                                                                                                                                                                                                                                                                                    amOnCronPage

                                                                                                                                                                                                                                                                                                                                                    Go to the cron page to start a synchronous, and blocking, GET request to the cron script.

                                                                                                                                                                                                                                                                                                                                                    // Triggers the cron job with an optional query argument.\n  $I->amOnCronPage('/?some-query-var=some-value');\n
                                                                                                                                                                                                                                                                                                                                                    Parameters
                                                                                                                                                                                                                                                                                                                                                    • string/\\Codeception\\Module\\array $queryVars - A string or array of query variables to append to the AJAX path. amOnPagesPage

                                                                                                                                                                                                                                                                                                                                                      Go the \"Pages\" administration screen. The method will not handle authentication.

                                                                                                                                                                                                                                                                                                                                                      $I->loginAsAdmin();\n  $I->amOnPagesPage();\n  $I->see('Add New');\n
                                                                                                                                                                                                                                                                                                                                                      amOnPluginsPage

                                                                                                                                                                                                                                                                                                                                                      Go to the plugins administration screen. The method will not handle authentication.

                                                                                                                                                                                                                                                                                                                                                      $I->loginAsAdmin();\n  $I->amOnPluginsPage();\n  $I->activatePlugin('hello-dolly');\n
                                                                                                                                                                                                                                                                                                                                                      deactivatePlugin

                                                                                                                                                                                                                                                                                                                                                      In the plugin administration screen deactivate a plugin clicking the \"Deactivate\" link. The method will not handle authentication and navigation to the plugins administration page.

                                                                                                                                                                                                                                                                                                                                                      // Deactivate one plugin.\n  $I->loginAsAdmin();\n  $I->amOnPluginsPage();\n  $I->deactivatePlugin('hello-dolly');\n  // Deactivate a list of plugins.\n  $I->loginAsAdmin();\n  $I->amOnPluginsPage();\n  $I->deactivatePlugin(['hello-dolly', 'my-plugin']);\n
                                                                                                                                                                                                                                                                                                                                                      Parameters
                                                                                                                                                                                                                                                                                                                                                      • string/\\Codeception\\Module\\array $pluginSlug - The plugin slug, like \"hello-dolly\", or a list of plugin slugs. dontSeePluginInstalled

                                                                                                                                                                                                                                                                                                                                                        Assert a plugin is not installed in the plugins administration screen. The method will not handle authentication and navigation to the plugin administration screen.

                                                                                                                                                                                                                                                                                                                                                        $I->loginAsAdmin();\n  $I->amOnPluginsPage();\n  $I->dontSeePluginInstalled('my-plugin');\n
                                                                                                                                                                                                                                                                                                                                                        Parameters
                                                                                                                                                                                                                                                                                                                                                        • string $pluginSlug - The plugin slug, like \"hello-dolly\".
                                                                                                                                                                                                                                                                                                                                                        grabCookiesWithPattern

                                                                                                                                                                                                                                                                                                                                                        Returns all the cookies whose name matches a regex pattern.

                                                                                                                                                                                                                                                                                                                                                        $I->loginAs('customer','password');\n  $I->amOnPage('/shop');\n  $cartCookies = $I->grabCookiesWithPattern(\"#^shop_cart\\\\.*#\");\n
                                                                                                                                                                                                                                                                                                                                                        Parameters
                                                                                                                                                                                                                                                                                                                                                        • string $cookiePattern - The regular expression pattern to use for the matching.
                                                                                                                                                                                                                                                                                                                                                        grabFullUrl

                                                                                                                                                                                                                                                                                                                                                        Grabs the current page full URL including the query vars.

                                                                                                                                                                                                                                                                                                                                                        $today = date('Y-m-d');\n  $I->amOnPage('/concerts?date=' . $today);\n  $I->assertRegExp('#\\\\/concerts$#', $I->grabFullUrl());\n
                                                                                                                                                                                                                                                                                                                                                        grabWordPressTestCookie

                                                                                                                                                                                                                                                                                                                                                        Returns WordPress default test cookie object if present.

                                                                                                                                                                                                                                                                                                                                                        // Grab the default WordPress test cookie.\n  $wpTestCookie = $I->grabWordPressTestCookie();\n  // Grab a customized version of the test cookie.\n  $myTestCookie = $I->grabWordPressTestCookie('my_test_cookie');\n
                                                                                                                                                                                                                                                                                                                                                        Parameters
                                                                                                                                                                                                                                                                                                                                                        • string $name - Optional, overrides the default cookie name.
                                                                                                                                                                                                                                                                                                                                                        logOut

                                                                                                                                                                                                                                                                                                                                                        Navigate to the default WordPress logout page and click the logout link.

                                                                                                                                                                                                                                                                                                                                                        // Log out using the `wp-login.php` form and return to the current page.\n  $I->logOut(true);\n  // Log out using the `wp-login.php` form and remain there.\n  $I->logOut(false);\n  // Log out using the `wp-login.php` form and move to another page.\n  $I->logOut('/some-other-page');\n
                                                                                                                                                                                                                                                                                                                                                        Parameters
                                                                                                                                                                                                                                                                                                                                                        • bool/bool/string $redirectTo - Whether to redirect to another (optionally specified) page after the logout.
                                                                                                                                                                                                                                                                                                                                                        loginAs

                                                                                                                                                                                                                                                                                                                                                        Login as the specified user. The method will not follow redirection, after the login, to any page. Depending on the driven browser the login might be \"too fast\" and the server might have not replied with valid cookies yet; in that case the method will re-attempt the login to obtain the cookies.

                                                                                                                                                                                                                                                                                                                                                        $I->loginAs('user', 'password');\n  $I->amOnAdminPage('/');\n  $I->see('Dashboard');\n
                                                                                                                                                                                                                                                                                                                                                        Parameters
                                                                                                                                                                                                                                                                                                                                                        • string $username - The user login name.
                                                                                                                                                                                                                                                                                                                                                        • string $password - The user password in plain text.
                                                                                                                                                                                                                                                                                                                                                        • int $timeout - The max time, in seconds, to try to login.
                                                                                                                                                                                                                                                                                                                                                        • int $maxAttempts - The max number of attempts to try to login.
                                                                                                                                                                                                                                                                                                                                                        loginAsAdmin

                                                                                                                                                                                                                                                                                                                                                        Login as the administrator user using the credentials specified in the module configuration. The method will not follow redirection, after the login, to any page.

                                                                                                                                                                                                                                                                                                                                                        $I->loginAsAdmin();\n  $I->amOnAdminPage('/');\n  $I->see('Dashboard');\n
                                                                                                                                                                                                                                                                                                                                                        Parameters
                                                                                                                                                                                                                                                                                                                                                        • int $timeout - The max time, in seconds, to try to login.
                                                                                                                                                                                                                                                                                                                                                        • int $maxAttempts - The max number of attempts to try to login.
                                                                                                                                                                                                                                                                                                                                                        seeErrorMessage

                                                                                                                                                                                                                                                                                                                                                        In an administration screen look for an error admin notice. The check is class-based to decouple from internationalization. The method will not handle authentication and navigation the administration area. .notice.notice-error ones.

                                                                                                                                                                                                                                                                                                                                                        $I->loginAsAdmin()\n  $I->amOnAdminPage('/');\n  $I->seeErrorMessage('.my-plugin');\n
                                                                                                                                                                                                                                                                                                                                                        Parameters
                                                                                                                                                                                                                                                                                                                                                        • string/string/\\Codeception\\Module\\array $classes - A list of classes the notice should have other than the seeMessage

                                                                                                                                                                                                                                                                                                                                                          In an administration screen look for an admin notice. The check is class-based to decouple from internationalization. The method will not handle authentication and navigation the administration area.

                                                                                                                                                                                                                                                                                                                                                          $I->loginAsAdmin()\n  $I->amOnAdminPage('/');\n  $I->seeMessage('.missing-api-token.my-plugin');\n
                                                                                                                                                                                                                                                                                                                                                          Parameters
                                                                                                                                                                                                                                                                                                                                                          • string/\\Codeception\\Module\\array/string $classes - A list of classes the message should have in addition to the .notice one. seePluginActivated

                                                                                                                                                                                                                                                                                                                                                            Assert a plugin is activated in the plugin administration screen. The method will not handle authentication and navigation to the plugin administration screen.

                                                                                                                                                                                                                                                                                                                                                            $I->loginAsAdmin();\n  $I->amOnPluginsPage();\n  $I->seePluginActivated('my-plugin');\n
                                                                                                                                                                                                                                                                                                                                                            Parameters
                                                                                                                                                                                                                                                                                                                                                            • string $pluginSlug - The plugin slug, like \"hello-dolly\".
                                                                                                                                                                                                                                                                                                                                                            seePluginDeactivated

                                                                                                                                                                                                                                                                                                                                                            Assert a plugin is not activated in the plugins administration screen. The method will not handle authentication and navigation to the plugin administration screen.

                                                                                                                                                                                                                                                                                                                                                            $I->loginAsAdmin();\n  $I->amOnPluginsPage();\n  $I->seePluginDeactivated('my-plugin');\n
                                                                                                                                                                                                                                                                                                                                                            Parameters
                                                                                                                                                                                                                                                                                                                                                            • string $pluginSlug - The plugin slug, like \"hello-dolly\".
                                                                                                                                                                                                                                                                                                                                                            seePluginInstalled

                                                                                                                                                                                                                                                                                                                                                            Assert a plugin is installed, no matter its activation status, in the plugin administration screen. The method will not handle authentication and navigation to the plugin administration screen.

                                                                                                                                                                                                                                                                                                                                                            $I->loginAsAdmin();\n  $I->amOnPluginsPage();\n  $I->seePluginInstalled('my-plugin');\n
                                                                                                                                                                                                                                                                                                                                                            Parameters
                                                                                                                                                                                                                                                                                                                                                            • string $pluginSlug - The plugin slug, like \"hello-dolly\".
                                                                                                                                                                                                                                                                                                                                                            seeWpDiePage

                                                                                                                                                                                                                                                                                                                                                            Checks that the current page is one generated by the wp_die function. The method will try to identify the page based on the default WordPress die page HTML attributes.

                                                                                                                                                                                                                                                                                                                                                            $I->loginAs('user', 'password');\n  $I->amOnAdminPage('/forbidden');\n  $I->seeWpDiePage();\n
                                                                                                                                                                                                                                                                                                                                                            waitForJqueryAjax

                                                                                                                                                                                                                                                                                                                                                            Waits for any jQuery triggered AJAX request to be resolved.

                                                                                                                                                                                                                                                                                                                                                            $I->amOnPage('/triggering-ajax-requests');\n  $I->waitForJqueryAjax();\n  $I->see('From AJAX');\n
                                                                                                                                                                                                                                                                                                                                                            Parameters
                                                                                                                                                                                                                                                                                                                                                            • int $time - The max time to wait for AJAX requests to complete.

                                                                                                                                                                                                                                                                                                                                                            This class extends \\Codeception\\Module\\WebDriver

                                                                                                                                                                                                                                                                                                                                                            This class implements \\Codeception\\Lib\\Interfaces\\RequiresPackage, \\Codeception\\Lib\\Interfaces\\ConflictsWithModule, \\Codeception\\Lib\\Interfaces\\ElementLocator, \\Codeception\\Lib\\Interfaces\\PageSourceSaver, \\Codeception\\Lib\\Interfaces\\ScreenshotSaver, \\Codeception\\Lib\\Interfaces\\SessionSnapshot, \\Codeception\\Lib\\Interfaces\\MultiSession, \\Codeception\\Lib\\Interfaces\\Remote, \\Codeception\\Lib\\Interfaces\\Web

                                                                                                                                                                                                                                                                                                                                                            "},{"location":"v3/modules/WordPress/","title":"WordPress","text":"

                                                                                                                                                                                                                                                                                                                                                            This is the documentation for version 3 of the project. The current version is version 4 and the documentation can be found here.

                                                                                                                                                                                                                                                                                                                                                            "},{"location":"v3/modules/WordPress/#wordpress-module","title":"WordPress module","text":"

                                                                                                                                                                                                                                                                                                                                                            This module requires good knowledge and attention to be used effectively; you can replace it with a combination of the WPBrowser module together with the WPLoader module in loadOnly mode. This module should be used in functional tests, see levels of testing for more information. This module provides a middle-ground, in terms of testing and effects, between the fully isolated approach of the WPBrowser module and the fully integrated approach of the WPLoader module with loadOnly set to false. It allows to interact with WordPress on a very high level, using methods like $I->loginAs() or $I->amOnPage() as you could do with the WPBrowser module while also loading WordPress in the same variable scope as the tests as the WPLoader module would. Due to WordPress reliance on constants, globals and side-effects this module will make requests to WordPress in an insulated manner and reproduce WordPress environment (globals and super-globals) after each response in the tests variable scope. The module simulates a user interaction with the site without Javascript support, use the WPWebDriver module for any kind of testing that requires Javascript-based interaction with the site.

                                                                                                                                                                                                                                                                                                                                                            "},{"location":"v3/modules/WordPress/#module-requirements-for-codeception-40","title":"Module requirements for Codeception 4.0+","text":"

                                                                                                                                                                                                                                                                                                                                                            This module requires the codeception/lib-innerbrowser Composer package to work when wp-browser is used with Codeception 4.0.

                                                                                                                                                                                                                                                                                                                                                            To install the package run:

                                                                                                                                                                                                                                                                                                                                                            composer require --dev codeception/lib-innerbrowser:^1.0\n
                                                                                                                                                                                                                                                                                                                                                            "},{"location":"v3/modules/WordPress/#detecting-requests-coming-from-this-module","title":"Detecting requests coming from this module","text":"

                                                                                                                                                                                                                                                                                                                                                            When it runs this module will set the WPBROWSER_HOST_REQUEST environment variable. You can detect and use that information to, as an example, use the correct database in your test site wp-config.php file:

                                                                                                                                                                                                                                                                                                                                                            <?php\nif ( \n// Custom header.\nisset( $_SERVER['HTTP_X_TESTING'] )\n// Custom user agent.\n|| ( isset( $_SERVER['HTTP_USER_AGENT'] ) && $_SERVER['HTTP_USER_AGENT'] === 'wp-browser' )\n// The env var set by the WPClIr or WordPress modules.\n|| getenv( 'WPBROWSER_HOST_REQUEST' )\n) {\n// Use the test database if the request comes from a test.\ndefine( 'DB_NAME', 'wordpress_test' );\n} else {\n// Else use the default one.\ndefine( 'DB_NAME', 'wordpress' );\n}\n

                                                                                                                                                                                                                                                                                                                                                            "},{"location":"v3/modules/WordPress/#configuration","title":"Configuration","text":"
                                                                                                                                                                                                                                                                                                                                                            • wpRootFolder required The absolute, or relative to the project root folder, path to the root WordPress installation folder. The WordPress installation root folder is the one that contains the wp-load.php file.
                                                                                                                                                                                                                                                                                                                                                            • adminUsername required - This is the login name, not the \"nice\" name, of the administrator user of the WordPress test site. This will be used to fill the username field in WordPress login page.
                                                                                                                                                                                                                                                                                                                                                            • adminPassword required - This is the the password of the administrator use of the WordPress test site. This will be used to fill the password in WordPress login page.
                                                                                                                                                                                                                                                                                                                                                            • adminPath required - The path, relative to the WordPress test site home URL, to the administration area, usually /wp-admin.
                                                                                                                                                                                                                                                                                                                                                            "},{"location":"v3/modules/WordPress/#example-configuration","title":"Example configuration","text":"
                                                                                                                                                                                                                                                                                                                                                              modules:\nenabled:\n- WordPress\nconfig:\nWordPress:\nwpRootFolder: \"/var/www/wordpress\"\nadminUsername: 'admin'\nadminPassword: 'password'\nadminPath: '/wp-admin'\n
                                                                                                                                                                                                                                                                                                                                                            "},{"location":"v3/modules/WordPress/#public-api","title":"Public API","text":"
                                                                                                                                                                                                                                                                                                                                                            • amEditingPostWithId
                                                                                                                                                                                                                                                                                                                                                            • amOnAdminAjaxPage
                                                                                                                                                                                                                                                                                                                                                            • amOnAdminPage
                                                                                                                                                                                                                                                                                                                                                            • amOnCronPage
                                                                                                                                                                                                                                                                                                                                                            • amOnPage
                                                                                                                                                                                                                                                                                                                                                            • amOnPagesPage
                                                                                                                                                                                                                                                                                                                                                            • amOnPluginsPage
                                                                                                                                                                                                                                                                                                                                                            • dontSeePluginInstalled
                                                                                                                                                                                                                                                                                                                                                            • extractCookie
                                                                                                                                                                                                                                                                                                                                                            • getResponseContent
                                                                                                                                                                                                                                                                                                                                                            • getWpRootFolder
                                                                                                                                                                                                                                                                                                                                                            • grabWordPressTestCookie
                                                                                                                                                                                                                                                                                                                                                            • logOut
                                                                                                                                                                                                                                                                                                                                                            • loginAs
                                                                                                                                                                                                                                                                                                                                                            • loginAsAdmin
                                                                                                                                                                                                                                                                                                                                                            • seeErrorMessage
                                                                                                                                                                                                                                                                                                                                                            • seeMessage
                                                                                                                                                                                                                                                                                                                                                            • seePluginActivated
                                                                                                                                                                                                                                                                                                                                                            • seePluginDeactivated
                                                                                                                                                                                                                                                                                                                                                            • seePluginInstalled
                                                                                                                                                                                                                                                                                                                                                            • seeWpDiePage
                                                                                                                                                                                                                                                                                                                                                            amEditingPostWithId

                                                                                                                                                                                                                                                                                                                                                            Go to the admin page to edit the post with the specified ID. The method will not handle authentication the admin area.

                                                                                                                                                                                                                                                                                                                                                            $I->loginAsAdmin();\n  $postId = $I->havePostInDatabase();\n  $I->amEditingPostWithId($postId);\n  $I->fillField('post_title', 'Post title');\n
                                                                                                                                                                                                                                                                                                                                                            Parameters
                                                                                                                                                                                                                                                                                                                                                            • int $id - The post ID.
                                                                                                                                                                                                                                                                                                                                                            amOnAdminAjaxPage

                                                                                                                                                                                                                                                                                                                                                            Go to the admin-ajax.php page to start a synchronous, and blocking, GET AJAX request. The method will not handle authentication, nonces or authorization.

                                                                                                                                                                                                                                                                                                                                                            $I->amOnAdminAjaxPage(['action' => 'my-action', 'data' => ['id' => 23], 'nonce' => $nonce]);\n
                                                                                                                                                                                                                                                                                                                                                            Parameters
                                                                                                                                                                                                                                                                                                                                                            • string/\\Codeception\\Module\\array $queryVars - A string or array of query variables to append to the AJAX path. amOnAdminPage

                                                                                                                                                                                                                                                                                                                                                              Go to a page in the admininstration area of the site.

                                                                                                                                                                                                                                                                                                                                                              $I->loginAs('user', 'password');\n  // Go to the plugins management screen.\n  $I->amOnAdminPage('/plugins.php');\n
                                                                                                                                                                                                                                                                                                                                                              Parameters
                                                                                                                                                                                                                                                                                                                                                              • string $page - The path, relative to the admin area URL, to the page.
                                                                                                                                                                                                                                                                                                                                                              amOnCronPage

                                                                                                                                                                                                                                                                                                                                                              Go to the cron page to start a synchronous, and blocking, GET request to the cron script.

                                                                                                                                                                                                                                                                                                                                                              // Triggers the cron job with an optional query argument.\n  $I->amOnCronPage('/?some-query-var=some-value');\n
                                                                                                                                                                                                                                                                                                                                                              Parameters
                                                                                                                                                                                                                                                                                                                                                              • string/\\Codeception\\Module\\array $queryVars - A string or array of query variables to append to the AJAX path. amOnPage

                                                                                                                                                                                                                                                                                                                                                                Go to a page on the site. The module will try to reach the page, relative to the URL specified in the module configuration, without applying any permalink resolution.

                                                                                                                                                                                                                                                                                                                                                                // Go the the homepage.\n  $I->amOnPage('/');\n  // Go to the single page of post with ID 23.\n  $I->amOnPage('/?p=23');\n  // Go to search page for the string \"foo\".\n  $I->amOnPage('/?s=foo');\n
                                                                                                                                                                                                                                                                                                                                                                Parameters
                                                                                                                                                                                                                                                                                                                                                                • string $page - The path to the page, relative to the the root URL.
                                                                                                                                                                                                                                                                                                                                                                amOnPagesPage

                                                                                                                                                                                                                                                                                                                                                                Go the \"Pages\" administration screen. The method will not handle authentication.

                                                                                                                                                                                                                                                                                                                                                                $I->loginAsAdmin();\n  $I->amOnPagesPage();\n  $I->see('Add New');\n
                                                                                                                                                                                                                                                                                                                                                                amOnPluginsPage

                                                                                                                                                                                                                                                                                                                                                                Go to the plugins administration screen. The method will not handle authentication.

                                                                                                                                                                                                                                                                                                                                                                $I->loginAsAdmin();\n  $I->amOnPluginsPage();\n  $I->activatePlugin('hello-dolly');\n
                                                                                                                                                                                                                                                                                                                                                                dontSeePluginInstalled

                                                                                                                                                                                                                                                                                                                                                                Assert a plugin is not installed in the plugins administration screen. The method will not handle authentication and navigation to the plugin administration screen.

                                                                                                                                                                                                                                                                                                                                                                $I->loginAsAdmin();\n  $I->amOnPluginsPage();\n  $I->dontSeePluginInstalled('my-plugin');\n
                                                                                                                                                                                                                                                                                                                                                                Parameters
                                                                                                                                                                                                                                                                                                                                                                • string $pluginSlug - The plugin slug, like \"hello-dolly\".
                                                                                                                                                                                                                                                                                                                                                                extractCookie

                                                                                                                                                                                                                                                                                                                                                                Grab a cookie value from the current session, sets it in the $_COOKIE array and returns its value. This method utility is to get, in the scope of test code, the value of a cookie set during the tests.

                                                                                                                                                                                                                                                                                                                                                                $id = $I->haveUserInDatabase('user', 'subscriber', ['user_pass' => 'pass']);\n  $I->loginAs('user', 'pass');\n  // The cookie is now set in the `$_COOKIE` super-global.\n  $I->extractCookie(LOGGED_IN_COOKIE);\n  // Generate a nonce using WordPress methods (see WPLoader in loadOnly mode) with correctly set context.\n  wp_set_current_user($id);\n  $nonce = wp_create_nonce('wp_rest');\n  // Use the generated nonce to make a request to the the REST API.\n  $I->haveHttpHeader('X-WP-Nonce', $nonce);\n
                                                                                                                                                                                                                                                                                                                                                                Parameters
                                                                                                                                                                                                                                                                                                                                                                • string $cookie - The cookie name.
                                                                                                                                                                                                                                                                                                                                                                • array/\\Codeception\\Module\\array/array $params - Parameters to filter the cookie value. getResponseContent

                                                                                                                                                                                                                                                                                                                                                                  Returns content of the last response. This method exposes an underlying API for custom assertions.

                                                                                                                                                                                                                                                                                                                                                                  // In test class.\n  $this->assertContains($text, $this->getResponseContent(), \"foo-bar\");\n
                                                                                                                                                                                                                                                                                                                                                                  getWpRootFolder

                                                                                                                                                                                                                                                                                                                                                                  Returns the absolute path to the WordPress root folder.

                                                                                                                                                                                                                                                                                                                                                                  $root = $I->getWpRootFolder();\n  $this->assertFileExists($root . '/someFile.txt');\n
                                                                                                                                                                                                                                                                                                                                                                  grabWordPressTestCookie

                                                                                                                                                                                                                                                                                                                                                                  Returns WordPress default test cookie object if present.

                                                                                                                                                                                                                                                                                                                                                                  // Grab the default WordPress test cookie.\n  $wpTestCookie = $I->grabWordPressTestCookie();\n  // Grab a customized version of the test cookie.\n  $myTestCookie = $I->grabWordPressTestCookie('my_test_cookie');\n
                                                                                                                                                                                                                                                                                                                                                                  Parameters
                                                                                                                                                                                                                                                                                                                                                                  • string $name - Optional, overrides the default cookie name.
                                                                                                                                                                                                                                                                                                                                                                  logOut

                                                                                                                                                                                                                                                                                                                                                                  Navigate to the default WordPress logout page and click the logout link.

                                                                                                                                                                                                                                                                                                                                                                  // Log out using the `wp-login.php` form and return to the current page.\n  $I->logOut(true);\n  // Log out using the `wp-login.php` form and remain there.\n  $I->logOut(false);\n  // Log out using the `wp-login.php` form and move to another page.\n  $I->logOut('/some-other-page');\n
                                                                                                                                                                                                                                                                                                                                                                  Parameters
                                                                                                                                                                                                                                                                                                                                                                  • bool/bool/string $redirectTo - Whether to redirect to another (optionally specified) page after the logout.
                                                                                                                                                                                                                                                                                                                                                                  loginAs

                                                                                                                                                                                                                                                                                                                                                                  Login as the specified user. The method will not follow redirection, after the login, to any page.

                                                                                                                                                                                                                                                                                                                                                                  $I->loginAs('user', 'password');\n  $I->amOnAdminPage('/');\n  $I->seeElement('.admin');\n
                                                                                                                                                                                                                                                                                                                                                                  Parameters
                                                                                                                                                                                                                                                                                                                                                                  • string $username - The user login name.
                                                                                                                                                                                                                                                                                                                                                                  • string $password - The user password in plain text.
                                                                                                                                                                                                                                                                                                                                                                  loginAsAdmin

                                                                                                                                                                                                                                                                                                                                                                  Login as the administrator user using the credentials specified in the module configuration. The method will not follow redirection, after the login, to any page.

                                                                                                                                                                                                                                                                                                                                                                  $I->loginAsAdmin();\n  $I->amOnAdminPage('/');\n  $I->see('Dashboard');\n
                                                                                                                                                                                                                                                                                                                                                                  seeErrorMessage

                                                                                                                                                                                                                                                                                                                                                                  In an administration screen look for an error admin notice. The check is class-based to decouple from internationalization. The method will not handle authentication and navigation the administration area. .notice.notice-error ones.

                                                                                                                                                                                                                                                                                                                                                                  $I->loginAsAdmin()\n  $I->amOnAdminPage('/');\n  $I->seeErrorMessage('.my-plugin');\n
                                                                                                                                                                                                                                                                                                                                                                  Parameters
                                                                                                                                                                                                                                                                                                                                                                  • string/string/\\Codeception\\Module\\array $classes - A list of classes the notice should have other than the seeMessage

                                                                                                                                                                                                                                                                                                                                                                    In an administration screen look for an admin notice. The check is class-based to decouple from internationalization. The method will not handle authentication and navigation the administration area.

                                                                                                                                                                                                                                                                                                                                                                    $I->loginAsAdmin()\n  $I->amOnAdminPage('/');\n  $I->seeMessage('.missing-api-token.my-plugin');\n
                                                                                                                                                                                                                                                                                                                                                                    Parameters
                                                                                                                                                                                                                                                                                                                                                                    • string/\\Codeception\\Module\\array/string $classes - A list of classes the message should have in addition to the .notice one. seePluginActivated

                                                                                                                                                                                                                                                                                                                                                                      Assert a plugin is activated in the plugin administration screen. The method will not handle authentication and navigation to the plugin administration screen.

                                                                                                                                                                                                                                                                                                                                                                      $I->loginAsAdmin();\n  $I->amOnPluginsPage();\n  $I->seePluginActivated('my-plugin');\n
                                                                                                                                                                                                                                                                                                                                                                      Parameters
                                                                                                                                                                                                                                                                                                                                                                      • string $pluginSlug - The plugin slug, like \"hello-dolly\".
                                                                                                                                                                                                                                                                                                                                                                      seePluginDeactivated

                                                                                                                                                                                                                                                                                                                                                                      Assert a plugin is not activated in the plugins administration screen. The method will not handle authentication and navigation to the plugin administration screen.

                                                                                                                                                                                                                                                                                                                                                                      $I->loginAsAdmin();\n  $I->amOnPluginsPage();\n  $I->seePluginDeactivated('my-plugin');\n
                                                                                                                                                                                                                                                                                                                                                                      Parameters
                                                                                                                                                                                                                                                                                                                                                                      • string $pluginSlug - The plugin slug, like \"hello-dolly\".
                                                                                                                                                                                                                                                                                                                                                                      seePluginInstalled

                                                                                                                                                                                                                                                                                                                                                                      Assert a plugin is installed, no matter its activation status, in the plugin administration screen. The method will not handle authentication and navigation to the plugin administration screen.

                                                                                                                                                                                                                                                                                                                                                                      $I->loginAsAdmin();\n  $I->amOnPluginsPage();\n  $I->seePluginInstalled('my-plugin');\n
                                                                                                                                                                                                                                                                                                                                                                      Parameters
                                                                                                                                                                                                                                                                                                                                                                      • string $pluginSlug - The plugin slug, like \"hello-dolly\".
                                                                                                                                                                                                                                                                                                                                                                      seeWpDiePage

                                                                                                                                                                                                                                                                                                                                                                      Checks that the current page is one generated by the wp_die function. The method will try to identify the page based on the default WordPress die page HTML attributes.

                                                                                                                                                                                                                                                                                                                                                                      $I->loginAs('user', 'password');\n  $I->amOnAdminPage('/forbidden');\n  $I->seeWpDiePage();\n

                                                                                                                                                                                                                                                                                                                                                                      This class extends \\Codeception\\Lib\\Framework

                                                                                                                                                                                                                                                                                                                                                                      This class implements \\Codeception\\Lib\\Interfaces\\Web, \\Codeception\\Lib\\Interfaces\\PageSourceSaver, \\Codeception\\Lib\\Interfaces\\ElementLocator, \\Codeception\\Lib\\Interfaces\\ConflictsWithModule, \\Codeception\\Lib\\Interfaces\\DependsOnModule

                                                                                                                                                                                                                                                                                                                                                                      "},{"location":"v3/tutorials/automatically-change-db-in-tests/","title":"Automatically change database during acceptance and functional tests","text":"

                                                                                                                                                                                                                                                                                                                                                                      This is the documentation for version 3 of the project. The current version is version 4 and the documentation can be found here.

                                                                                                                                                                                                                                                                                                                                                                      "},{"location":"v3/tutorials/automatically-change-db-in-tests/#automatically-change-database-during-acceptance-and-functional-tests","title":"Automatically change database during acceptance and functional tests","text":"

                                                                                                                                                                                                                                                                                                                                                                      You should always back up any site you run tests on if you care about the site content.

                                                                                                                                                                                                                                                                                                                                                                      Now this disclaimer has been made ad nauseam; there's a simple way to use a different database when during tests.

                                                                                                                                                                                                                                                                                                                                                                      "},{"location":"v3/tutorials/automatically-change-db-in-tests/#identifying-requests","title":"Identifying requests","text":"

                                                                                                                                                                                                                                                                                                                                                                      The first component of this solution is identifying the source of the current HTTP request. WordPress makes this identification before deciding which database to use.

                                                                                                                                                                                                                                                                                                                                                                      To provide the WordPress installation with this information, you can set the headers entry of the WPBrowser or WPWebDriver module in the suite configuration file.

                                                                                                                                                                                                                                                                                                                                                                      As an example here is an acceptance suite configuration file setting two custom headers, X_WPBROWSER_REQUEST and X_TEST_REQUEST, on each request sent by the WPWebDriver module:

                                                                                                                                                                                                                                                                                                                                                                      actor: AcceptanceTester\nmodules:\nenabled:\n- WPDb\n- WPBrowser\n- \\Helper\\Acceptance\nconfig:\nWPDb:\ndsn: 'mysql:host=localhost;dbname=tests'\nuser: 'root'\npassword: 'root'\ndump: 'tests/_data/dump.sql'\npopulate: true\ncleanup: true\nwaitlock: 10\nurl: 'http://wp.test'\nurlReplacement: true\ntablePrefix: 'wp_'\nWPBrowser:\nurl: 'http://wp.test'\nadminUsername: 'admin'\nadminPassword: 'admin'\nadminPath: '/wp-admin'\nheaders:\nX_WPBROWSER_REQUEST: 1\nX_TEST_REQUEST: 1\n

                                                                                                                                                                                                                                                                                                                                                                      The two headers are sent on each HTTP request type, not just on GET type requests.

                                                                                                                                                                                                                                                                                                                                                                      "},{"location":"v3/tutorials/automatically-change-db-in-tests/#using-a-different-database-to-handle-test-requests","title":"Using a different database to handle test requests","text":"

                                                                                                                                                                                                                                                                                                                                                                      Now that each request made by the WPWebDriver module contains those two headers, it's time for WordPress to check those and change the database to use accordingly.

                                                                                                                                                                                                                                                                                                                                                                      The database to use is set by the DB_NAME constant that is, in turn, set in the wp-config.php file. Different setups could involve more complex configurations for the wp-config.php file but, for the sake of simplicity, I assume the default WordPress wp-config.php file structure. In the example below, the default database name is wordpress, while the name of the test database is tests.

                                                                                                                                                                                                                                                                                                                                                                      - define( 'DB_NAME', 'wordpress' );\n+ if( isset( $_SERVER['HTTP_X_TEST_REQUEST'] ) && $_SERVER['HTTP_X_TEST_REQUEST'] ) {\n+     define( 'DB_NAME', 'tests' );\n+ } else {\n+     define( 'DB_NAME', 'wordpress' );\n+ }\n

                                                                                                                                                                                                                                                                                                                                                                      The diff shows the replacement done in the WordPress installation wp-config.php file.

                                                                                                                                                                                                                                                                                                                                                                      For copy-and-paste pleasure, replace the line starting with:

                                                                                                                                                                                                                                                                                                                                                                      define( 'DB_NAME', 'default_db_name' );\n

                                                                                                                                                                                                                                                                                                                                                                      With this snippet:

                                                                                                                                                                                                                                                                                                                                                                      if( isset( $_SERVER['HTTP_X_TEST_REQUEST'] ) && $_SERVER['HTTP_X_TEST_REQUEST'] ) {\n      define( 'DB_NAME', 'test_db_name' );\n} else {\n      define( 'DB_NAME', 'default_db_name' );\n}\n

                                                                                                                                                                                                                                                                                                                                                                      Where default_db_name is the name of the database your test WordPress installation normally uses.

                                                                                                                                                                                                                                                                                                                                                                      Happy, and safer, testing.

                                                                                                                                                                                                                                                                                                                                                                      "},{"location":"v3/tutorials/local-flywheel-setup/","title":"Setting up wp-browser on Local by Flywheel to test a plugin","text":"

                                                                                                                                                                                                                                                                                                                                                                      This is the documentation for version 3 of the project. The current version is version 4 and the documentation can be found here.

                                                                                                                                                                                                                                                                                                                                                                      "},{"location":"v3/tutorials/local-flywheel-setup/#setting-up-wp-browser-with-local-by-flywheel-to-test-a-plugin","title":"Setting up wp-browser with Local by Flywheel to test a plugin","text":"

                                                                                                                                                                                                                                                                                                                                                                      Note: the original version of this guide used, on Mac, the version of Local by Flywheel based on VirtualBox and Docker containers. That version has been replaced by a new one that will not use any virtualization layer. The UI is almost the same but, for back-compatibility purposes, I've not removed the references to the previous version; I have, instead, pointed out where the set up values and procedures might differ due to the changes.

                                                                                                                                                                                                                                                                                                                                                                      "},{"location":"v3/tutorials/local-flywheel-setup/#requirements","title":"Requirements","text":"
                                                                                                                                                                                                                                                                                                                                                                      • A Mac or Windows machine
                                                                                                                                                                                                                                                                                                                                                                      • A working installation of Local By Flywheel.
                                                                                                                                                                                                                                                                                                                                                                      • You should be able to create sites and visit them from your browser without issues.
                                                                                                                                                                                                                                                                                                                                                                      • Composer installed and working on your terminal PATH, you should be able to run composer --version at the terminal and see the version correctly.
                                                                                                                                                                                                                                                                                                                                                                      "},{"location":"v3/tutorials/local-flywheel-setup/#install-local-by-flywheel","title":"Install Local by Flywheel","text":"

                                                                                                                                                                                                                                                                                                                                                                      This walk-through starts after Local by Flywheel has been installed and is correctly running on your machine; you can download Local from the site and follow the installation instructions.

                                                                                                                                                                                                                                                                                                                                                                      In the context of this guide I'm assuming the sites directory is ~/Local Sites, the default \"Sites Path\" in Local preferences.

                                                                                                                                                                                                                                                                                                                                                                      If your document root lies elsewhere, replace the ~/Local Sites path with the actual directory in each command.

                                                                                                                                                                                                                                                                                                                                                                      "},{"location":"v3/tutorials/local-flywheel-setup/#creating-the-databases-and-installing-wordpress","title":"Creating the databases and installing WordPress","text":"

                                                                                                                                                                                                                                                                                                                                                                      Using Local UI create a new site:

                                                                                                                                                                                                                                                                                                                                                                      • The site name is myplugin.
                                                                                                                                                                                                                                                                                                                                                                      • The site administrator user name is admin.
                                                                                                                                                                                                                                                                                                                                                                      • The site administrator password is password.

                                                                                                                                                                                                                                                                                                                                                                      Once Local provisioned and installed the new site, open the \"Database\" administration tab and, depending on your OS, start a database administration UI or website. In the image below I'm using Adminer:

                                                                                                                                                                                                                                                                                                                                                                      Create a database called tests:

                                                                                                                                                                                                                                                                                                                                                                      Make sure you can visit the WordPress installation at http://myplugin.local and that you can correctly access the administration area at http://myplugin.local/wp-admin.

                                                                                                                                                                                                                                                                                                                                                                      "},{"location":"v3/tutorials/local-flywheel-setup/#scaffolding-the-project-folder","title":"Scaffolding the project folder","text":"

                                                                                                                                                                                                                                                                                                                                                                      I'm assuming the scope of the development is to test the my-plugin plugin.

                                                                                                                                                                                                                                                                                                                                                                      The first step is to create the bare minimum code required to make the plugin show up among the available WordPress plugins. Create the main plugin file in the WordPress installation plugins directory, in the ~/Local Sites/myplugin/app/public/wp-content/plugins/my-plugin/my-plugin.php file:

                                                                                                                                                                                                                                                                                                                                                                      <?php\n/**\n * Plugin Name: My plugin\n */ \n

                                                                                                                                                                                                                                                                                                                                                                      The plugin should now show up, activate and deactivate correctly, among the plugins listed in the WordPress installation at http://myplugin.local/wp-admin/plugins.php.

                                                                                                                                                                                                                                                                                                                                                                      "},{"location":"v3/tutorials/local-flywheel-setup/#installing-wp-browser","title":"Installing wp-browser","text":"

                                                                                                                                                                                                                                                                                                                                                                      Open a terminal window and navigate to the plugin directory and initialize the Composer project:

                                                                                                                                                                                                                                                                                                                                                                      cd ~/Local Sites/myplugin/app/public/wp-content/plugins/my-plugin\ncomposer init\n

                                                                                                                                                                                                                                                                                                                                                                      Composer will ask some questions to initialize the project, for the sake of this small guide the answers are not relevant. Here is the composer.json file generated by the above answers:

                                                                                                                                                                                                                                                                                                                                                                      {\n\"name\": \"local/my-plugin\",\n\"type\": \"wordpress-plugin\",\n\"require\": {}\n}\n

                                                                                                                                                                                                                                                                                                                                                                      Next require lucatume/wp-browser as a development dependency:

                                                                                                                                                                                                                                                                                                                                                                      composer require --dev lucatume/wp-browser\n

                                                                                                                                                                                                                                                                                                                                                                      Composer installs any dependency binary file, an executable file, in the project vendor/bin folder. To check Codeception is correctly installed run this command:

                                                                                                                                                                                                                                                                                                                                                                      vendor/bin/codecept --version\n

                                                                                                                                                                                                                                                                                                                                                                      Since wp-browser requires Codeception, there is no need to require Codeception explicitly as a development dependency.

                                                                                                                                                                                                                                                                                                                                                                      "},{"location":"v3/tutorials/local-flywheel-setup/#setting-up-wp-browser","title":"Setting up wp-browser","text":"

                                                                                                                                                                                                                                                                                                                                                                      For those that might get lost while trying to set up wp-browser for the first time the VVV context provides an excellent base to understand the process.

                                                                                                                                                                                                                                                                                                                                                                      wp-browser needs to know:

                                                                                                                                                                                                                                                                                                                                                                      • Where the WordPress installation files are located: they will be loaded in integration and \"WordPress unit\" tests.
                                                                                                                                                                                                                                                                                                                                                                      • How to connect to the WordPress site \"normal\" database: this is the database that stores the data of the site I would see when visiting the local installation URL at http://myplugin.local.
                                                                                                                                                                                                                                                                                                                                                                      • How to connect to the database dedicated to the integration and \"WordPress unit\" tests: this database will be used to install WordPress during integration and \"WordPress unit\" tests.

                                                                                                                                                                                                                                                                                                                                                                      Any test suite using a database should never run on a database containing data of any value; this means that your first step should be to backup the site database.

                                                                                                                                                                                                                                                                                                                                                                      You can create a backup of the current site database contents using whatever tool the version of Local you're using provides. In this example I'm using Adminer:

                                                                                                                                                                                                                                                                                                                                                                      At any moment you can re-import the site database dump using, again, phpMyAdmin, under the \"Import\" tab:

                                                                                                                                                                                                                                                                                                                                                                      "},{"location":"v3/tutorials/local-flywheel-setup/#bootstrapping-and-configuring-wp-browser","title":"Bootstrapping and configuring wp-browser","text":"

                                                                                                                                                                                                                                                                                                                                                                      After the backup is done it's time to bootstrap wp-browser using its interactive mode:

                                                                                                                                                                                                                                                                                                                                                                      cd ~/Local Sites/myplugin/app/public/wp-content/plugins/my-plugin\nvendor/bin/codecept init wpbrowser\n

                                                                                                                                                                                                                                                                                                                                                                      The initialization guide will ask a number of questions.

                                                                                                                                                                                                                                                                                                                                                                      "},{"location":"v3/tutorials/local-flywheel-setup/#windows-configuration","title":"Windows configuration","text":"

                                                                                                                                                                                                                                                                                                                                                                      In the screenshots below are the answers I used to configure wp-browser on Windows.

                                                                                                                                                                                                                                                                                                                                                                      Note that I've set up the database host using the values provided by Local UI, yours might differ depending on the version of Local you're using:

                                                                                                                                                                                                                                                                                                                                                                      Below a complete list of each answer:

                                                                                                                                                                                                                                                                                                                                                                      • I acknowledge wp-browser should run on development servers... y
                                                                                                                                                                                                                                                                                                                                                                      • Would you like to set up the suites interactively now? y
                                                                                                                                                                                                                                                                                                                                                                      • How would you like the acceptance suite to be called? acceptance
                                                                                                                                                                                                                                                                                                                                                                      • How would you like the functional suite to be called? functional
                                                                                                                                                                                                                                                                                                                                                                      • How would you like the WordPress unit and integration suite to be called? wpunit
                                                                                                                                                                                                                                                                                                                                                                      • How would you like to call the env configuration file? .env.testing
                                                                                                                                                                                                                                                                                                                                                                      • What is the path of the WordPress root directory? ~/Local Sites/myplugin/app/public
                                                                                                                                                                                                                                                                                                                                                                      • What is the path, relative to WordPress root URL, of the admin area of the test site? /wp-admin
                                                                                                                                                                                                                                                                                                                                                                      • What is the name of the test database used by the test site? tests
                                                                                                                                                                                                                                                                                                                                                                      • What is the host of the test database used by the test site? localhost:10003
                                                                                                                                                                                                                                                                                                                                                                      • What is the user of the test database used by the test site? root
                                                                                                                                                                                                                                                                                                                                                                      • What is the password of the test database used by the test site? root
                                                                                                                                                                                                                                                                                                                                                                      • What is the table prefix of the test database used by the test site? wp_
                                                                                                                                                                                                                                                                                                                                                                      • What is the name of the test database WPLoader should use? tests
                                                                                                                                                                                                                                                                                                                                                                      • What is the host of the test database WPLoader should use? localhost:10003
                                                                                                                                                                                                                                                                                                                                                                      • What is the user of the test database WPLoader should use? root
                                                                                                                                                                                                                                                                                                                                                                      • What is the password of the test database WPLoader should use? root
                                                                                                                                                                                                                                                                                                                                                                      • What is the table prefix of the test database WPLoader should use? wp_
                                                                                                                                                                                                                                                                                                                                                                      • What is the URL the test site? http://myplugin.local
                                                                                                                                                                                                                                                                                                                                                                      • What is the email of the test site WordPress administrator? admin@myplugin.local
                                                                                                                                                                                                                                                                                                                                                                      • What is the title of the test site? My Plugin Test
                                                                                                                                                                                                                                                                                                                                                                      • What is the login of the administrator user of the test site? admin
                                                                                                                                                                                                                                                                                                                                                                      • What is the password of the administrator user of the test site? password
                                                                                                                                                                                                                                                                                                                                                                      • Are you testing a plugin, a theme or a combination of both (both)? plugin
                                                                                                                                                                                                                                                                                                                                                                      • What is the folder/plugin.php name of the plugin? my-plugin/my-plugin.php
                                                                                                                                                                                                                                                                                                                                                                      • Does your project needs additional plugins to be activated to work? no

                                                                                                                                                                                                                                                                                                                                                                      Codeception will build the suites for the first time and should be ready to go.

                                                                                                                                                                                                                                                                                                                                                                      "},{"location":"v3/tutorials/local-flywheel-setup/#mac-configuration","title":"Mac configuration","text":"

                                                                                                                                                                                                                                                                                                                                                                      In the screenshots below are the answers I used to configure wp-browser on Mac.

                                                                                                                                                                                                                                                                                                                                                                      Note that I've set up the database host using the values provided by Local UI, yours might differ.

                                                                                                                                                                                                                                                                                                                                                                      This screenshot is from the previous version of Local, the one based on VirtualBox and Docker:

                                                                                                                                                                                                                                                                                                                                                                      Below a complete list of each answer:

                                                                                                                                                                                                                                                                                                                                                                      • I acknowledge wp-browser should run on development servers... y
                                                                                                                                                                                                                                                                                                                                                                      • Would you like to set up the suites interactively now? y
                                                                                                                                                                                                                                                                                                                                                                      • How would you like the acceptance suite to be called? acceptance
                                                                                                                                                                                                                                                                                                                                                                      • How would you like the functional suite to be called? functional
                                                                                                                                                                                                                                                                                                                                                                      • How would you like the WordPress unit and integration suite to be called? wpunit
                                                                                                                                                                                                                                                                                                                                                                      • How would you like to call the env configuration file? .env.testing
                                                                                                                                                                                                                                                                                                                                                                      • What is the path of the WordPress root directory? ~/Local Sites/myplugin/app/public
                                                                                                                                                                                                                                                                                                                                                                      • What is the path, relative to WordPress root URL, of the admin area of the test site? /wp-admin
                                                                                                                                                                                                                                                                                                                                                                      • What is the name of the test database used by the test site? tests
                                                                                                                                                                                                                                                                                                                                                                      • What is the host of the test database used by the test site? /Users/lucatume/Library/Application Support/Local/run/FjKWfVMGd/mysql/mysqld.sock ( or 192.168.95.100:4055 on an older version of Local)
                                                                                                                                                                                                                                                                                                                                                                      • What is the user of the test database used by the test site? root
                                                                                                                                                                                                                                                                                                                                                                      • What is the password of the test database used by the test site? root
                                                                                                                                                                                                                                                                                                                                                                      • What is the table prefix of the test database used by the test site? wp_
                                                                                                                                                                                                                                                                                                                                                                      • What is the name of the test database WPLoader should use? tests
                                                                                                                                                                                                                                                                                                                                                                      • What is the host of the test database WPLoader should use? /Users/lucatume/Library/Application Support/Local/run/FjKWfVMGd/mysql/mysqld.sock (or 192.168.95.100:4055 on an older version of Local)
                                                                                                                                                                                                                                                                                                                                                                      • What is the user of the test database WPLoader should use? root
                                                                                                                                                                                                                                                                                                                                                                      • What is the password of the test database WPLoader should use? root
                                                                                                                                                                                                                                                                                                                                                                      • What is the table prefix of the test database WPLoader should use? wp_
                                                                                                                                                                                                                                                                                                                                                                      • What is the URL the test site? http://myplugin.local
                                                                                                                                                                                                                                                                                                                                                                      • What is the email of the test site WordPress administrator? admin@myplugin.local
                                                                                                                                                                                                                                                                                                                                                                      • What is the title of the test site? My Plugin Test
                                                                                                                                                                                                                                                                                                                                                                      • What is the login of the administrator user of the test site? admin
                                                                                                                                                                                                                                                                                                                                                                      • What is the password of the administrator user of the test site? password
                                                                                                                                                                                                                                                                                                                                                                      • Are you testing a plugin, a theme or a combination of both (both)? plugin
                                                                                                                                                                                                                                                                                                                                                                      • What is the folder/plugin.php name of the plugin? my-plugin/my-plugin.php
                                                                                                                                                                                                                                                                                                                                                                      • Does your project needs additional plugins to be activated to work? no

                                                                                                                                                                                                                                                                                                                                                                      Codeception will build the suites for the first time and should be ready to go.

                                                                                                                                                                                                                                                                                                                                                                      "},{"location":"v3/tutorials/local-flywheel-setup/#setting-up-the-starting-database-fixture","title":"Setting up the starting database fixture","text":"

                                                                                                                                                                                                                                                                                                                                                                      A \"fixture\", in testing terms, is a minimal, starting environment shared by all tests. In BDD it's the Background any scenario will share. In the case of a plugin the minimal, starting environment is the following:

                                                                                                                                                                                                                                                                                                                                                                      • A fresh WordPress installation empty of any content.
                                                                                                                                                                                                                                                                                                                                                                      • WordPress using its default theme.
                                                                                                                                                                                                                                                                                                                                                                      • The only active plugin is the one you're testing, in this example: my-plugin.

                                                                                                                                                                                                                                                                                                                                                                      You should set up this fixture \"manually\", using the site administration UI at http://myplugin.local/wp-admin.

                                                                                                                                                                                                                                                                                                                                                                      The following command will empty the site, backup any content you care about first!

                                                                                                                                                                                                                                                                                                                                                                      When you're done setting up the initial database fixture, export it using the \"Export\" tab of your database tool of choice, and move the file to the ~/Local Sites/myplugin/app/public/wp-content/plugins/my-plugin/tests/_data/dump.sql directory.

                                                                                                                                                                                                                                                                                                                                                                      There is one last step left to complete the setup.

                                                                                                                                                                                                                                                                                                                                                                      "},{"location":"v3/tutorials/local-flywheel-setup/#using-the-tests-database-in-acceptance-and-functional-tests","title":"Using the tests database in acceptance and functional tests","text":"

                                                                                                                                                                                                                                                                                                                                                                      Acceptance and functional tests will act as users, navigating to the site pages and making requests as a user would.

                                                                                                                                                                                                                                                                                                                                                                      This means that WordPress will load, and with it its wp-config.php file, to handle the requests made by the tests.

                                                                                                                                                                                                                                                                                                                                                                      During the setup phase I've specified the database to be used for acceptance and functional tests as tests but, looking at the contents of the ~/Local Sites/myplugin/app/public/wp-config.php file, the DB_NAME constant is set to local.

                                                                                                                                                                                                                                                                                                                                                                      What we'll do now means:

                                                                                                                                                                                                                                                                                                                                                                      • If the request is a normal one, use the local database.
                                                                                                                                                                                                                                                                                                                                                                      • If the request comes from a test, use the tests database.

                                                                                                                                                                                                                                                                                                                                                                      In your IDE/text-editor of choice edit the ~/Local Sites/myplugin/app/public/wp-config.php and replace the line defining the DB_NAME constant like this:

                                                                                                                                                                                                                                                                                                                                                                      - define( 'DB_NAME', 'local' );\n+ if( isset( $_SERVER['HTTP_X_WPBROWSER_REQUEST'] ) && $_SERVER['HTTP_X_WPBROWSER_REQUEST'] ) { \n+    define( 'DB_NAME', 'tests' );\n+ } else {\n+    define( 'DB_NAME', 'local' );\n+ }\n

                                                                                                                                                                                                                                                                                                                                                                      Here's the copy-and-paste friendly version:

                                                                                                                                                                                                                                                                                                                                                                      if( isset( $_SERVER['HTTP_X_TEST_REQUEST'] ) && $_SERVER['HTTP_X_TEST_REQUEST'] ) {\n        define( 'DB_NAME', 'tests' );\n} else {\n        define( 'DB_NAME', 'local' );\n}\n

                                                                                                                                                                                                                                                                                                                                                                      If you look at the tests/acceptance.suite.yml and tests/functional.suite.yml files, respectively the acceptance and functional suite configuration files, you will see these entries in the WPBrowser module configuration:

                                                                                                                                                                                                                                                                                                                                                                      headers:\nX_TEST_REQUEST: 1\nX_WPBROWSER_REQUEST: 1\n

                                                                                                                                                                                                                                                                                                                                                                      This means that, with each HTTP request done during tests, the module will send the two headers. Those headers are read, on the WordPress side, using the $_SERVER['HTTP_X_TEST_REQUEST'] and $_SERVER['X_WPBROWSER_REQUEST'] variables.

                                                                                                                                                                                                                                                                                                                                                                      Codeception and wp-browser are ready to run and the test-drive development can start.

                                                                                                                                                                                                                                                                                                                                                                      "},{"location":"v3/tutorials/local-flywheel-setup/#sanity-check","title":"Sanity check","text":"

                                                                                                                                                                                                                                                                                                                                                                      Before starting to write tests, take a moment to run each suite separately and make sure all is set up correctly.

                                                                                                                                                                                                                                                                                                                                                                      If you run into issues, there's a chance you forgot something along the way, please take the time to read this tutorial a second time before opening an issue.

                                                                                                                                                                                                                                                                                                                                                                      You have created 4 suites, each suite has at least one example test to make sure all works. Run each suite and make sure all tests succeed, from within the box run:

                                                                                                                                                                                                                                                                                                                                                                      cd ~/Local Sites/myplugin/app/public/wp-content/plugins/my-plugin vendor/bin/codecept run acceptance\nvendor/bin/codecept run functional\nvendor/bin/codecept run wpunit\nvendor/bin/codecept run unit\n

                                                                                                                                                                                                                                                                                                                                                                      You're now run to customize the suites to your liking or start writing tests, run vendor/bin/codecept to see a list of the available commands.

                                                                                                                                                                                                                                                                                                                                                                      "},{"location":"v3/tutorials/mamp-mac-setup/","title":"Setting up wp-browser on MAMP for Mac to test a plugin","text":"

                                                                                                                                                                                                                                                                                                                                                                      This is the documentation for version 3 of the project. The current version is version 4 and the documentation can be found here.

                                                                                                                                                                                                                                                                                                                                                                      "},{"location":"v3/tutorials/mamp-mac-setup/#setting-up-wp-browser-with-mamp-on-mac-to-test-a-plugin","title":"Setting up wp-browser with MAMP on Mac to test a plugin","text":""},{"location":"v3/tutorials/mamp-mac-setup/#requirements","title":"Requirements","text":"
                                                                                                                                                                                                                                                                                                                                                                      • A Mac machine
                                                                                                                                                                                                                                                                                                                                                                      • A working installation of MAMP.
                                                                                                                                                                                                                                                                                                                                                                      • You should be able to create sites and visit them from your browser without issues.
                                                                                                                                                                                                                                                                                                                                                                      • Composer installed and working on your terminal PATH, you should be able to run composer --version at the terminal and see the version correctly.

                                                                                                                                                                                                                                                                                                                                                                      The version of MAMP used in this tutorial is the free, non PRO, one. MAMP PRO provides more features, but the setup instructions should remain valid.

                                                                                                                                                                                                                                                                                                                                                                      "},{"location":"v3/tutorials/mamp-mac-setup/#install-and-configure-mamp","title":"Install and configure MAMP","text":"

                                                                                                                                                                                                                                                                                                                                                                      This walk-through starts after MAMP has been installed and is correctly running on the host machine; you can download MAMP from the site and follow the installation instructions. In the context of this guide I'm assuming the \"Document Root\" directory is the default one, in the /Applications/MAMP/htdocs directory. If your document root lies elsewhere, replace the /Applications/MAMP/htdocs path with the actual directory in each command.

                                                                                                                                                                                                                                                                                                                                                                      "},{"location":"v3/tutorials/mamp-mac-setup/#creating-the-databases-and-installing-wordpress","title":"Creating the databases and installing WordPress","text":"

                                                                                                                                                                                                                                                                                                                                                                      Go to the http://localhost/phpMyAdmin/ page and create two new databases:

                                                                                                                                                                                                                                                                                                                                                                      • wordpress is the database you will use for WordPress
                                                                                                                                                                                                                                                                                                                                                                      • tests is the database you will use for the tests

                                                                                                                                                                                                                                                                                                                                                                      Unzip the the WordPress files into the /Applications/MAMP/htdocs and head over to http://localhost to install WordPress.

                                                                                                                                                                                                                                                                                                                                                                      The database credentials for the installation are:

                                                                                                                                                                                                                                                                                                                                                                      • Database name: wordpress
                                                                                                                                                                                                                                                                                                                                                                      • Database user: root
                                                                                                                                                                                                                                                                                                                                                                      • Database password: root
                                                                                                                                                                                                                                                                                                                                                                      • Database host: localhost

                                                                                                                                                                                                                                                                                                                                                                      Use admin as administrator user name and password as password for the administrator user.

                                                                                                                                                                                                                                                                                                                                                                      Make sure you can visit the WordPress installation at http://localhost and that you can correctly access the administration area at http://localhost/wp-admin.

                                                                                                                                                                                                                                                                                                                                                                      "},{"location":"v3/tutorials/mamp-mac-setup/#scaffolding-the-project-folder","title":"Scaffolding the project folder","text":"

                                                                                                                                                                                                                                                                                                                                                                      I'm assuming the scope of the development is to test the my-plugin plugin.

                                                                                                                                                                                                                                                                                                                                                                      The first step is to create the bare minimum code required to make the plugin show up among the available WordPress plugins. Create the main plugin file in the WordPress installation plugins directory, in the /Applications/MAMP/htdocs/wp-content/plugins/my-plugin/my-plugin.php file:

                                                                                                                                                                                                                                                                                                                                                                      <?php\n/**\n * Plugin Name: My plugin\n */ \n

                                                                                                                                                                                                                                                                                                                                                                      The plugin should now show up, activate and deactivate correctly, among the plugins listed in the WordPress installation at http://localhost/wp-admin/plugins.php.

                                                                                                                                                                                                                                                                                                                                                                      "},{"location":"v3/tutorials/mamp-mac-setup/#installing-wp-browser","title":"Installing wp-browser","text":"

                                                                                                                                                                                                                                                                                                                                                                      Open a terminal window and navigate to the plugin directory and initialize the Composer project:

                                                                                                                                                                                                                                                                                                                                                                      cd /Applications/MAMP/htdocs/wp-content/plugins/my-plugin\ncomposer init\n

                                                                                                                                                                                                                                                                                                                                                                      Composer will ask some questions to initialize the project, for the sake of this small guide the answers are not relevant. Here is the composer.json file generated by the above answers:

                                                                                                                                                                                                                                                                                                                                                                      {\n\"name\": \"mamp/my-plugin\",\n\"type\": \"wordpress-plugin\",\n\"require\": {}\n}\n

                                                                                                                                                                                                                                                                                                                                                                      Next require lucatume/wp-browser as a development dependency:

                                                                                                                                                                                                                                                                                                                                                                      composer require --dev lucatume/wp-browser\n

                                                                                                                                                                                                                                                                                                                                                                      Composer installs any dependency binary file, an executable file, in the project vendor/bin folder. To check Codeception is correctly installed run this command:

                                                                                                                                                                                                                                                                                                                                                                      vendor/bin/codecept --version\n

                                                                                                                                                                                                                                                                                                                                                                      Since wp-browser requires Codeception, there is no need to require Codeception explicitly as a development dependency.

                                                                                                                                                                                                                                                                                                                                                                      "},{"location":"v3/tutorials/mamp-mac-setup/#setting-up-wp-browser","title":"Setting up wp-browser","text":"

                                                                                                                                                                                                                                                                                                                                                                      For those that might get lost while trying to set up wp-browser for the first time the VVV context provides an excellent base to understand the process.

                                                                                                                                                                                                                                                                                                                                                                      wp-browser needs to know:

                                                                                                                                                                                                                                                                                                                                                                      • Where the WordPress installation files are located: they will be loaded in integration and \"WordPress unit\" tests.
                                                                                                                                                                                                                                                                                                                                                                      • How to connect to the WordPress site \"normal\" database: this is the database that stores the data of the site I would see when visiting the local installation URL at http://localhost.
                                                                                                                                                                                                                                                                                                                                                                      • How to connect to the database dedicated to the integration and \"WordPress unit\" tests: this database will be used to install WordPress during integration and \"WordPress unit\" tests.

                                                                                                                                                                                                                                                                                                                                                                      Any test suite using a database should never run on a database containing data of any value; this means that your first step should be to backup the site database.

                                                                                                                                                                                                                                                                                                                                                                      You can create a backup of the current site database contents using phpMyAdmin, at http://localhost/phpMyAdmin/, under the \"Export\" tab:

                                                                                                                                                                                                                                                                                                                                                                      At any moment you can re-import the site database dump using, again, phpMyAdmin, under the \"Import\" tab:

                                                                                                                                                                                                                                                                                                                                                                      "},{"location":"v3/tutorials/mamp-mac-setup/#bootstrapping-and-configuring-wp-browser","title":"Bootstrapping and configuring wp-browser","text":"

                                                                                                                                                                                                                                                                                                                                                                      After the backup is done it's time to bootstrap wp-browser using its interactive mode:

                                                                                                                                                                                                                                                                                                                                                                      cd /Applications/MAMP/htdocs/wp-content/plugins/my-plugin\nvendor/bin/codecept init wpbrowser\n

                                                                                                                                                                                                                                                                                                                                                                      The initialization guide will ask a number of questions. In the screenshots below are the answers I used to configure wp-browser.

                                                                                                                                                                                                                                                                                                                                                                      Below a complete list of each answer:

                                                                                                                                                                                                                                                                                                                                                                      • I acknowledge wp-browser should run on development servers... y
                                                                                                                                                                                                                                                                                                                                                                      • Would you like to set up the suites interactively now? y
                                                                                                                                                                                                                                                                                                                                                                      • How would you like the acceptance suite to be called? acceptance
                                                                                                                                                                                                                                                                                                                                                                      • How would you like the functional suite to be called? functional
                                                                                                                                                                                                                                                                                                                                                                      • How would you like the WordPress unit and integration suite to be called? wpunit
                                                                                                                                                                                                                                                                                                                                                                      • How would you like to call the env configuration file? .env.testing
                                                                                                                                                                                                                                                                                                                                                                      • What is the path of the WordPress root directory? /Applications/MAMP/htdocs
                                                                                                                                                                                                                                                                                                                                                                      • What is the path, relative to WordPress root URL, of the admin area of the test site? /wp-admin
                                                                                                                                                                                                                                                                                                                                                                      • What is the name of the test database used by the test site? tests
                                                                                                                                                                                                                                                                                                                                                                      • What is the host of the test database used by the test site? localhost
                                                                                                                                                                                                                                                                                                                                                                      • What is the user of the test database used by the test site? root
                                                                                                                                                                                                                                                                                                                                                                      • What is the password of the test database used by the test site? root
                                                                                                                                                                                                                                                                                                                                                                      • What is the table prefix of the test database used by the test site? wp_
                                                                                                                                                                                                                                                                                                                                                                      • What is the name of the test database WPLoader should use? tests
                                                                                                                                                                                                                                                                                                                                                                      • What is the host of the test database WPLoader should use? localhost
                                                                                                                                                                                                                                                                                                                                                                      • What is the user of the test database WPLoader should use? root
                                                                                                                                                                                                                                                                                                                                                                      • What is the password of the test database WPLoader should use? root
                                                                                                                                                                                                                                                                                                                                                                      • What is the table prefix of the test database WPLoader should use? wp_
                                                                                                                                                                                                                                                                                                                                                                      • What is the URL the test site? http://localhost
                                                                                                                                                                                                                                                                                                                                                                      • What is the email of the test site WordPress administrator? admin@wp.test
                                                                                                                                                                                                                                                                                                                                                                      • What is the title of the test site? My Plugin Test
                                                                                                                                                                                                                                                                                                                                                                      • What is the login of the administrator user of the test site? admin
                                                                                                                                                                                                                                                                                                                                                                      • What is the password of the administrator user of the test site? password
                                                                                                                                                                                                                                                                                                                                                                      • Are you testing a plugin, a theme or a combination of both (both)? plugin
                                                                                                                                                                                                                                                                                                                                                                      • What is the folder/plugin.php name of the plugin? my-plugin/my-plugin.php
                                                                                                                                                                                                                                                                                                                                                                      • Does your project needs additional plugins to be activated to work? no

                                                                                                                                                                                                                                                                                                                                                                      Codeception will build the suites for the first time and should be ready to go.

                                                                                                                                                                                                                                                                                                                                                                      "},{"location":"v3/tutorials/mamp-mac-setup/#setting-up-the-starting-database-fixture","title":"Setting up the starting database fixture","text":"

                                                                                                                                                                                                                                                                                                                                                                      A \"fixture\", in testing terms, is a minimal, starting environment shared by all tests. In BDD it's the Background any scenario will share. In the case of a plugin the minimal, starting environment is the following:

                                                                                                                                                                                                                                                                                                                                                                      • A fresh WordPress installation empty of any content.
                                                                                                                                                                                                                                                                                                                                                                      • WordPress using its default theme.
                                                                                                                                                                                                                                                                                                                                                                      • The only active plugin is the one you're testing, in this example: my-plugin.

                                                                                                                                                                                                                                                                                                                                                                      You should set up this fixture \"manually\", using the site administration UI at http://localhost/wp-admin.

                                                                                                                                                                                                                                                                                                                                                                      The following command will empty the site, backup any content you care about first!

                                                                                                                                                                                                                                                                                                                                                                      When you're done setting up the initial database fixture, export it using the \"Export\" tab of phpMyAdmin, at http://localhost/phpMyAdmin/ and move the file to the /Applications/MAMP/htdocs/wp-content/plugins/my-plugin/tests/_data/dump.sql directory.

                                                                                                                                                                                                                                                                                                                                                                      There is one last step left to complete the setup.

                                                                                                                                                                                                                                                                                                                                                                      "},{"location":"v3/tutorials/mamp-mac-setup/#using-the-tests-database-in-acceptance-and-functional-tests","title":"Using the tests database in acceptance and functional tests","text":"

                                                                                                                                                                                                                                                                                                                                                                      Acceptance and functional tests will act as users, navigating to the site pages and making requests as a user would.

                                                                                                                                                                                                                                                                                                                                                                      This means that WordPress will load, and with it its wp-config.php file, to handle the requests made by the tests.

                                                                                                                                                                                                                                                                                                                                                                      During the setup phase I've specified the database to be used for acceptance and functional tests as tests but, looking at the contents of the /Applications/MAMP/htdocs/wp-config.php file, the DB_NAME constant is set to wordpress.

                                                                                                                                                                                                                                                                                                                                                                      What we'll do now means:

                                                                                                                                                                                                                                                                                                                                                                      • If the request is a normal one, use the wordpress database.
                                                                                                                                                                                                                                                                                                                                                                      • If the request comes from a test, use the tests database.

                                                                                                                                                                                                                                                                                                                                                                      In your IDE/text-editor of choice edit the /Applications/MAMP/htdocs/wp-config.php and replace the line defining the DB_NAME constant like this:

                                                                                                                                                                                                                                                                                                                                                                      - define( 'DB_NAME', 'wordpress' );\n+ if( isset( $_SERVER['HTTP_X_WPBROWSER_REQUEST'] ) && $_SERVER['HTTP_X_WPBROWSER_REQUEST'] ) { \n+    define( 'DB_NAME', 'tests' );\n+ } else {\n+    define( 'DB_NAME', 'wordpress' );\n+ }\n

                                                                                                                                                                                                                                                                                                                                                                      Here's the copy-and-paste friendly version:

                                                                                                                                                                                                                                                                                                                                                                      if( isset( $_SERVER['HTTP_X_TEST_REQUEST'] ) && $_SERVER['HTTP_X_TEST_REQUEST'] ) {\n        define( 'DB_NAME', 'tests' );\n} else {\n        define( 'DB_NAME', 'wordpress' );\n}\n

                                                                                                                                                                                                                                                                                                                                                                      If you look at the tests/acceptance.suite.yml and tests/functional.suite.yml files, respectively the acceptance and functional suite configuration files, you will see these entries in the WPBrowser module configuration:

                                                                                                                                                                                                                                                                                                                                                                      headers:\nX_TEST_REQUEST: 1\nX_WPBROWSER_REQUEST: 1\n

                                                                                                                                                                                                                                                                                                                                                                      This means that, with each HTTP request done during tests, the module will send the two headers. Those headers are read, on the WordPress side, using the $_SERVER['HTTP_X_TEST_REQUEST'] and $_SERVER['X_WPBROWSER_REQUEST'] variables.

                                                                                                                                                                                                                                                                                                                                                                      Codeception and wp-browser are ready to run and the test-drive development can start.

                                                                                                                                                                                                                                                                                                                                                                      "},{"location":"v3/tutorials/mamp-mac-setup/#sanity-check","title":"Sanity check","text":"

                                                                                                                                                                                                                                                                                                                                                                      Before starting to write tests, take a moment to run each suite separately and make sure all is set up correctly.

                                                                                                                                                                                                                                                                                                                                                                      If you run into issues, there's a chance you forgot something along the way, please take the time to read this tutorial a second time before opening an issue.

                                                                                                                                                                                                                                                                                                                                                                      You have created 4 suites, each suite has at least one example test to make sure all works. Run each suite and make sure all tests succeed, from within the box run:

                                                                                                                                                                                                                                                                                                                                                                      cd /Applications/MAMP/htdocs/wp-content/plugins/my-plugin vendor/bin/codecept run acceptance\nvendor/bin/codecept run functional\nvendor/bin/codecept run wpunit\nvendor/bin/codecept run unit\n

                                                                                                                                                                                                                                                                                                                                                                      You're now run to customize the suites to your liking or start writing tests, run vendor/bin/codecept to see a list of the available commands.

                                                                                                                                                                                                                                                                                                                                                                      "},{"location":"v3/tutorials/vvv-setup/","title":"Setting up wp-browser on VVV to test a plugin","text":"

                                                                                                                                                                                                                                                                                                                                                                      This is the documentation for version 3 of the project. The current version is version 4 and the documentation can be found here.

                                                                                                                                                                                                                                                                                                                                                                      "},{"location":"v3/tutorials/vvv-setup/#setting-up-wp-browser-on-vvv-to-test-a-plugin","title":"Setting up wp-browser on VVV to test a plugin","text":""},{"location":"v3/tutorials/vvv-setup/#requirements","title":"Requirements","text":"
                                                                                                                                                                                                                                                                                                                                                                      • A Windows, Linux or Mac machine (I'll call this the \"host machine\" or just \"host\").
                                                                                                                                                                                                                                                                                                                                                                      • A working installation of VVV; you should be able to navigate to VVV root directory, run the vagrant up command, and have VVV up and running.
                                                                                                                                                                                                                                                                                                                                                                      • On the VVV installation you should be able to visit the two default sites URLs without issues; the two default sites addresses are:
                                                                                                                                                                                                                                                                                                                                                                        • http://one.wordpress.test
                                                                                                                                                                                                                                                                                                                                                                        • http://two.wordpress.test
                                                                                                                                                                                                                                                                                                                                                                      "},{"location":"v3/tutorials/vvv-setup/#why-vvv","title":"Why VVV?","text":"

                                                                                                                                                                                                                                                                                                                                                                      The VVV project provides a \"a Vagrant configuration for developing with WordPress\" and is an excellent, no-frills, starting point to develop WordPress projects (themes, plugins and whole sites. Based on Vagrant and Virtual Box, VVV removes the differences between systems by providing a uniform, Ubuntu Linux based, virtual machine that will bahave the same on Windows, Linux and Mac. Configuring it to run WordPress tests is easy: let's get started.

                                                                                                                                                                                                                                                                                                                                                                      "},{"location":"v3/tutorials/vvv-setup/#check-vvv-works-correctly","title":"Check VVV works correctly","text":"

                                                                                                                                                                                                                                                                                                                                                                      This walk-through starts after VVV has been installed and is running on the host machine; the installation guide is clear and simple to follow and I'm not duplicating it here. In the context of this guide I'm assuming VVV lives in the ~/Repos/VVV directory, that we are working on the my-plugin project and that the plugin is being developed in the default (wordpress-one) WordPress installation provided by the box. If your VVV installation lies elsewhere, replace the ~/Repos/VVV with the actual directory in each command.

                                                                                                                                                                                                                                                                                                                                                                      After completing the installation of VVV navigate to VVV root folder and run the vagrant up command:

                                                                                                                                                                                                                                                                                                                                                                      cd ~/Repos/VVV\nvagrant up\n

                                                                                                                                                                                                                                                                                                                                                                      After the automatic bootstrap and initialization process completed, VVV makes two WordPress sites available:

                                                                                                                                                                                                                                                                                                                                                                      • http://one.wordpress.test/ is the first default site address.
                                                                                                                                                                                                                                                                                                                                                                      • http://two.wordpress.test/ is the second default site address.
                                                                                                                                                                                                                                                                                                                                                                      • http://vvv.test/ is VVV dashboard address.

                                                                                                                                                                                                                                                                                                                                                                      You should be able to reach each one of the URLs above without issues, should this not be the case something during VVV setup did not go according to the plan and you should fix it before moving on.

                                                                                                                                                                                                                                                                                                                                                                      If the sanity check above is complete it's time to move to the following part specific to Codeception and wp-browser setup.

                                                                                                                                                                                                                                                                                                                                                                      "},{"location":"v3/tutorials/vvv-setup/#in-and-out-host-and-guest","title":"In and out, host and guest","text":"

                                                                                                                                                                                                                                                                                                                                                                      The Vagrant box provided by VVV goes beyond a simple MySQL, PHP and Ngnix server stack and provides a complete WordPress development environment; tools like Composer, [grunt-cli][4992-0003], and [wp-cli][4992-0006] are ready to use.

                                                                                                                                                                                                                                                                                                                                                                      This allows the entire development, when it comes to the CLI tools, to happen in the virtual machine and not outside of it.

                                                                                                                                                                                                                                                                                                                                                                      \"Inside the virtual machine\" means the first CLI instruction to run from the ~/Repos/VVV folder (assuming that is the folder where VVV was installed) is this:

                                                                                                                                                                                                                                                                                                                                                                      cd ~/Repos/VVV\nvagrant ssh\n

                                                                                                                                                                                                                                                                                                                                                                      This will connect, via SSH, to the virtual machine as the vagrant user. To exit from the SSH session inside the box, just type exit and return.

                                                                                                                                                                                                                                                                                                                                                                      Note: any further instruction I'm showing here, beside the code editing that will happen in a dedicated PHP IDE like [PHPStorm][4992-0004] or [Sublime Text][4992-0005] on the host machine, will happen \"inside the virtual machine\".

                                                                                                                                                                                                                                                                                                                                                                      When I say \"host machine\" I mean your laptop, desktop or whatever computer you're working on; when I say \"guest machine\" I mean VVV virtual machine; this is usually the case for any virtual-ish setup (Vagrant, Docker and the like).

                                                                                                                                                                                                                                                                                                                                                                      "},{"location":"v3/tutorials/vvv-setup/#scaffolding-the-project-folder","title":"Scaffolding the project folder","text":"

                                                                                                                                                                                                                                                                                                                                                                      I'm assuming the scope of the development is to test the my-plugin plugin.

                                                                                                                                                                                                                                                                                                                                                                      The first step is to create the bare minimum code required to make the plugin show up among the available WordPress plugins. Create the main plugin file in the http://one.wordpress.test installation plugins directory, in the ~/Repos/VVV/www/wordpress-one/public_html/wp-content/plugins/my-plugin/my-plugin.php file:

                                                                                                                                                                                                                                                                                                                                                                      <?php\n/**\n * Plugin Name: My plugin\n */ \n

                                                                                                                                                                                                                                                                                                                                                                      The plugin should now show up, activate and deactivate correctly, among the plugins listed in the VVV default WordPress installation at http://one.wordpress.test/wp-admin/plugins.php.

                                                                                                                                                                                                                                                                                                                                                                      By default, VVV administrator user name is admin and password is password.

                                                                                                                                                                                                                                                                                                                                                                      "},{"location":"v3/tutorials/vvv-setup/#installing-wp-browser","title":"Installing wp-browser","text":"

                                                                                                                                                                                                                                                                                                                                                                      Since Composer is provided from VVV, installing wp-browser requires entering the virtual machine (if you did not already):

                                                                                                                                                                                                                                                                                                                                                                      cd ~/Repos/VVV\nvagrant ssh\n

                                                                                                                                                                                                                                                                                                                                                                      Once inside navigate to the plugins folder. The path is now relative to VVV filesystem structure so it won't be the same as the one used above that was, instead, in the context of the \"host machine\":

                                                                                                                                                                                                                                                                                                                                                                      cd /srv/www/wordpress-one/public_html/wp-content/plugins/my-plugin composer init\n

                                                                                                                                                                                                                                                                                                                                                                      Composer will ask some questions to initialize the project, for the sake of this small guide the answers are not relevant. Here is the composer.json file generated by the above answers:

                                                                                                                                                                                                                                                                                                                                                                      {\n\"name\": \"vagrant/my-plugin\",\n\"type\": \"wordpress-plugin\",\n\"require\": {}\n}\n

                                                                                                                                                                                                                                                                                                                                                                      Next require lucatume/wp-browser as a development dependency:

                                                                                                                                                                                                                                                                                                                                                                      composer require --dev lucatume/wp-browser\n

                                                                                                                                                                                                                                                                                                                                                                      Composer installs any dependency binary file, an executable file, in the project vendor/bin folder. To check Codeception is correctly installed run this command:

                                                                                                                                                                                                                                                                                                                                                                      vendor/bin/codecept --version\n

                                                                                                                                                                                                                                                                                                                                                                      Since wp-browser requires Codeception, there is no need to require Codeception explicitly as a development dependency.

                                                                                                                                                                                                                                                                                                                                                                      "},{"location":"v3/tutorials/vvv-setup/#setting-up-wp-browser","title":"Setting up wp-browser","text":"

                                                                                                                                                                                                                                                                                                                                                                      For those that might get lost while trying to set up wp-browser for the first time the VVV context provides an excellent base to understand the process.

                                                                                                                                                                                                                                                                                                                                                                      wp-browser needs to know:

                                                                                                                                                                                                                                                                                                                                                                      • Where the WordPress installation files are located: they will be loaded in integration and \"WordPress unit\" tests.
                                                                                                                                                                                                                                                                                                                                                                      • How to connect to the WordPress site \"normal\" database: this is the database that stores the data of the site I would see when visiting the local installation URL (http://one.wordpress.test in the case of the VVV default installation).
                                                                                                                                                                                                                                                                                                                                                                      • How to connect to the database dedicated to the integration and \"WordPress unit\" tests: this database will be used to install WordPress during integration and \"WordPress unit\" tests.

                                                                                                                                                                                                                                                                                                                                                                      Any test suite using a database should never run on a database containing data of any value; this means that if I am using VVV for my day to day WordPress development my first step should be to backup the site database.

                                                                                                                                                                                                                                                                                                                                                                      You can create a backup of the current site database contents using wp-cli from within the virtual machine:

                                                                                                                                                                                                                                                                                                                                                                      cd /srv/www/wordpress-one/public_html\nwp db export wordpress-one-backup.sql\n

                                                                                                                                                                                                                                                                                                                                                                      At any moment you can re-import the site database dump using this command, the site database will be reset to the state it was when you created the database dump:

                                                                                                                                                                                                                                                                                                                                                                      cd /srv/www/wordpress-one/public_html\nwp db import wordpress-one-backup.sql\n

                                                                                                                                                                                                                                                                                                                                                                      "},{"location":"v3/tutorials/vvv-setup/#creating-the-database-dedicated-to-the-tests","title":"Creating the database dedicated to the tests","text":"

                                                                                                                                                                                                                                                                                                                                                                      wp-browser will use the databases it works on in a destructive way: between tests the data will be lost.

                                                                                                                                                                                                                                                                                                                                                                      After the backup you should have done in the previous step, the next step is creating a database dedicated to the test.

                                                                                                                                                                                                                                                                                                                                                                      At the VVV box command line run:

                                                                                                                                                                                                                                                                                                                                                                      mysql -u root -p -e \"CREATE DATABASE if not exists tests\"\nmysql -u root -p -e \"GRANT ALL PRIVILEGES ON tests.* TO 'wp'@'localhost';\"\n

                                                                                                                                                                                                                                                                                                                                                                      When prompted for the password enter root. The first command creates the tests database, if it does not exist; the second command grants the wp user all privileges on it.

                                                                                                                                                                                                                                                                                                                                                                      In VVV the root database user name is root and the password is root.

                                                                                                                                                                                                                                                                                                                                                                      Check the database was correctly created running this command:

                                                                                                                                                                                                                                                                                                                                                                      mysql -u root -p -e \"SHOW DATABASES\"\n

                                                                                                                                                                                                                                                                                                                                                                      The tests database should be present in the list.

                                                                                                                                                                                                                                                                                                                                                                      "},{"location":"v3/tutorials/vvv-setup/#bootstrapping-and-configuring-wp-browser","title":"Bootstrapping and configuring wp-browser","text":"

                                                                                                                                                                                                                                                                                                                                                                      After the backup is done it's time to bootstrap wp-browser using its interactive mode:

                                                                                                                                                                                                                                                                                                                                                                      cd /srv/www/wordpress-one/public_html/wp-content/plugins/my-plugin\nvendor/bin/codecept init wpbrowser\n

                                                                                                                                                                                                                                                                                                                                                                      The initialization guide will ask a number of questions. In the screenshots below are the answers I used to configure wp-browser.

                                                                                                                                                                                                                                                                                                                                                                      Below a complete list of each answer:

                                                                                                                                                                                                                                                                                                                                                                      • I acknowledge wp-browser should run on development servers... y
                                                                                                                                                                                                                                                                                                                                                                      • Would you like to set up the suites interactively now? y
                                                                                                                                                                                                                                                                                                                                                                      • How would you like the acceptance suite to be called? acceptance
                                                                                                                                                                                                                                                                                                                                                                      • How would you like the functional suite to be called? functional
                                                                                                                                                                                                                                                                                                                                                                      • How would you like the WordPress unit and integration suite to be called? wpunit
                                                                                                                                                                                                                                                                                                                                                                      • How would you like to call the env configuration file? .env.testing
                                                                                                                                                                                                                                                                                                                                                                      • What is the path of the WordPress root directory? /srv/www/wordpress-one/public_html
                                                                                                                                                                                                                                                                                                                                                                      • What is the path, relative to WordPress root URL, of the admin area of the test site? /wp-admin
                                                                                                                                                                                                                                                                                                                                                                      • What is the name of the test database used by the test site? tests
                                                                                                                                                                                                                                                                                                                                                                      • What is the host of the test database used by the test site? localhost
                                                                                                                                                                                                                                                                                                                                                                      • What is the user of the test database used by the test site? root
                                                                                                                                                                                                                                                                                                                                                                      • What is the password of the test database used by the test site? root
                                                                                                                                                                                                                                                                                                                                                                      • What is the table prefix of the test database used by the test site? wp_
                                                                                                                                                                                                                                                                                                                                                                      • What is the name of the test database WPLoader should use? tests
                                                                                                                                                                                                                                                                                                                                                                      • What is the host of the test database WPLoader should use? localhost
                                                                                                                                                                                                                                                                                                                                                                      • What is the user of the test database WPLoader should use? root
                                                                                                                                                                                                                                                                                                                                                                      • What is the password of the test database WPLoader should use? root
                                                                                                                                                                                                                                                                                                                                                                      • What is the table prefix of the test database WPLoader should use? wp_
                                                                                                                                                                                                                                                                                                                                                                      • What is the URL the test site? http://one.wordpress.test
                                                                                                                                                                                                                                                                                                                                                                      • What is the email of the test site WordPress administrator? admin@one.wordpress.test
                                                                                                                                                                                                                                                                                                                                                                      • What is the title of the test site? My Plugin Test
                                                                                                                                                                                                                                                                                                                                                                      • What is the login of the administrator user of the test site? admin
                                                                                                                                                                                                                                                                                                                                                                      • What is the password of the administrator user of the test site? password
                                                                                                                                                                                                                                                                                                                                                                      • Are you testing a plugin, a theme or a combination of both (both)? plugin
                                                                                                                                                                                                                                                                                                                                                                      • What is the folder/plugin.php name of the plugin? my-plugin/my-plugin.php
                                                                                                                                                                                                                                                                                                                                                                      • Does your project needs additional plugins to be activated to work? no

                                                                                                                                                                                                                                                                                                                                                                      Codeception will build the suites for the first time and should be ready to go.

                                                                                                                                                                                                                                                                                                                                                                      "},{"location":"v3/tutorials/vvv-setup/#setting-up-the-starting-database-fixture","title":"Setting up the starting database fixture","text":"

                                                                                                                                                                                                                                                                                                                                                                      A \"fixture\", in testing terms, is a minimal, starting environment shared by all tests. In BDD it's the Background any scenario will share. In the case of a plugin the minimal, starting environment is the following:

                                                                                                                                                                                                                                                                                                                                                                      • A fresh WordPress installation empty of any content.
                                                                                                                                                                                                                                                                                                                                                                      • WordPress using its default theme.
                                                                                                                                                                                                                                                                                                                                                                      • The only active plugin is the one you're testing, in this example: my-plugin.

                                                                                                                                                                                                                                                                                                                                                                      You can set up this fixture \"manually\", using the site administration UI at http://one.wordpress.test/wp-admin, or use wp-cli and save precious time.

                                                                                                                                                                                                                                                                                                                                                                      The following command will empty the site, backup any content you care about first!

                                                                                                                                                                                                                                                                                                                                                                      As it's been the case so far, I'm running the following command from within the VVV box (use vagrant ssh to log in):

                                                                                                                                                                                                                                                                                                                                                                      cd /srv/www/wordpress-one/public_html\nwp site empty --yes --uploads\nwp plugin deactivate --all\nwp plugin activate my-plugin\nwp db export wp-content/plugins/my-plugin/tests/_data/dump.sql\n

                                                                                                                                                                                                                                                                                                                                                                      The initial database fixture has been created, now there's one last step to complete.

                                                                                                                                                                                                                                                                                                                                                                      "},{"location":"v3/tutorials/vvv-setup/#using-the-tests-database-in-acceptance-and-functional-tests","title":"Using the tests database in acceptance and functional tests","text":"

                                                                                                                                                                                                                                                                                                                                                                      Acceptance and functional tests will act as users, navigating to the site pages and making requests as a user would.

                                                                                                                                                                                                                                                                                                                                                                      This means that WordPress will load, and with it its wp-config.php file, to handle the requests made by the tests.

                                                                                                                                                                                                                                                                                                                                                                      During the setup phase I've specified the database to be used for acceptance and functional tests as tests but, looking at the contents of the /srv/www/wordpress-one/public_html/wp-config.php file, the DB_NAME constant is set to wordpress-one.

                                                                                                                                                                                                                                                                                                                                                                      What we'll do now means:

                                                                                                                                                                                                                                                                                                                                                                      • If the request is a normal one, use the wordpress-one database.
                                                                                                                                                                                                                                                                                                                                                                      • If the request comes from a test, use the tests database.

                                                                                                                                                                                                                                                                                                                                                                      In your IDE/text-editor of choice edit the ~/Repos/VVV/www/wordpress-one/public_html/wp-config.php and replace the line defining the DB_NAME constant like this:

                                                                                                                                                                                                                                                                                                                                                                      - define( 'DB_NAME', 'wordpress-one' );\n+ if( isset( $_SERVER['HTTP_X_WPBROWSER_REQUEST'] ) && $_SERVER['HTTP_X_WPBROWSER_REQUEST'] ) { \n+    define( 'DB_NAME', 'tests' );\n+ } else {\n+    define( 'DB_NAME', 'wordpress-one' );\n+ }\n

                                                                                                                                                                                                                                                                                                                                                                      Here's the copy-and-paste friendly version:

                                                                                                                                                                                                                                                                                                                                                                      if( isset( $_SERVER['HTTP_X_TEST_REQUEST'] ) && $_SERVER['HTTP_X_TEST_REQUEST'] ) {\n        define( 'DB_NAME', 'tests' );\n} else {\n        define( 'DB_NAME', 'wordpress-one' );\n}\n

                                                                                                                                                                                                                                                                                                                                                                      If you look at the tests/acceptance.suite.yml and tests/functional.suite.yml files, respectively the acceptance and functional suite configuration files, you will see these entries in the WPBrowser module configuration:

                                                                                                                                                                                                                                                                                                                                                                      headers:\nX_TEST_REQUEST: 1\nX_WPBROWSER_REQUEST: 1\n

                                                                                                                                                                                                                                                                                                                                                                      This means that, with each HTTP request done during tests, the module will send the two headers. Those headers are read, on the WordPress side, using the $_SERVER['HTTP_X_TEST_REQUEST'] and $_SERVER['X_WPBROWSER_REQUEST'] variables.

                                                                                                                                                                                                                                                                                                                                                                      Codeception and wp-browser are ready to run and the test-drive development can start.

                                                                                                                                                                                                                                                                                                                                                                      "},{"location":"v3/tutorials/vvv-setup/#sanity-check","title":"Sanity check","text":"

                                                                                                                                                                                                                                                                                                                                                                      Before starting to write tests, take a moment to run each suite separately and make sure all is set up correctly.

                                                                                                                                                                                                                                                                                                                                                                      If you run into issues, there's a chance you forgot something along the way, please take the time to read this tutorial a second time before opening an issue.

                                                                                                                                                                                                                                                                                                                                                                      You have created 4 suites, each suite has at least one example test to make sure all works. Run each suite and make sure all tests succeed, from within the box run:

                                                                                                                                                                                                                                                                                                                                                                      cd /srv/www/wordpress-one/public_html/wp-content/plugins/my-plugin vendor/bin/codecept run acceptance\nvendor/bin/codecept run functional\nvendor/bin/codecept run wpunit\nvendor/bin/codecept run unit\n

                                                                                                                                                                                                                                                                                                                                                                      You're now run to customize the suites to your liking or start writing tests, run vendor/bin/codecept to see a list of the available commands.

                                                                                                                                                                                                                                                                                                                                                                      "},{"location":"v3/tutorials/wamp-setup/","title":"Setting up wp-browser on WAMP for Windows to test a plugin","text":"

                                                                                                                                                                                                                                                                                                                                                                      This is the documentation for version 3 of the project. The current version is version 4 and the documentation can be found here.

                                                                                                                                                                                                                                                                                                                                                                      "},{"location":"v3/tutorials/wamp-setup/#setting-up-wp-browser-with-wamp-on-windows-to-test-a-plugin","title":"Setting up wp-browser with WAMP on Windows to test a plugin","text":""},{"location":"v3/tutorials/wamp-setup/#requirements","title":"Requirements","text":"
                                                                                                                                                                                                                                                                                                                                                                      • A Windows machine
                                                                                                                                                                                                                                                                                                                                                                      • A working installation of WAMP.
                                                                                                                                                                                                                                                                                                                                                                      • You should be able to create sites and visit them from your browser without issues.
                                                                                                                                                                                                                                                                                                                                                                      • Composer installed and working on your terminal PATH, you should be able to run composer --version at the terminal and see the version correctly.
                                                                                                                                                                                                                                                                                                                                                                      "},{"location":"v3/tutorials/wamp-setup/#install-and-configure-wamp","title":"Install and configure WAMP","text":"

                                                                                                                                                                                                                                                                                                                                                                      This walk-through starts after WAMP has been installed and is correctly running on the host machine; you can download WAMP from the site and follow the installation instructions. In the context of this guide I'm installing the test WordPress installation in the C:\\wamp64\\www\\wp directory. If your installation lies elsewhere, replace the C:\\wamp64\\www\\wp path with the actual directory in each command.

                                                                                                                                                                                                                                                                                                                                                                      "},{"location":"v3/tutorials/wamp-setup/#creating-the-databases-and-installing-wordpress","title":"Creating the databases and installing WordPress","text":"

                                                                                                                                                                                                                                                                                                                                                                      Go to the http://localhost/phpmyadmin/index.php page and create two new databases:

                                                                                                                                                                                                                                                                                                                                                                      • wordpress is the database you will use for WordPress
                                                                                                                                                                                                                                                                                                                                                                      • tests is the database you will use for the tests

                                                                                                                                                                                                                                                                                                                                                                      The default database user is root, the default password is empty.

                                                                                                                                                                                                                                                                                                                                                                      Unzip the the WordPress files into the C:\\wamp64\\www\\wp and head over to http://localhost/wp to install WordPress. The database credentials for the installation are:

                                                                                                                                                                                                                                                                                                                                                                      • Database name: wordpress
                                                                                                                                                                                                                                                                                                                                                                      • Database user: root
                                                                                                                                                                                                                                                                                                                                                                      • Database password is empty
                                                                                                                                                                                                                                                                                                                                                                      • Database host: localhost

                                                                                                                                                                                                                                                                                                                                                                      Use admin as administrator user name and password as password for the administrator user.

                                                                                                                                                                                                                                                                                                                                                                      Make sure you can visit the WordPress installation at http://localhost/wp and that you can correctly access the administration area at http://localhost/wp/wp-admin.

                                                                                                                                                                                                                                                                                                                                                                      "},{"location":"v3/tutorials/wamp-setup/#scaffolding-the-project-folder","title":"Scaffolding the project folder","text":"

                                                                                                                                                                                                                                                                                                                                                                      I'm assuming the scope of the development is to test the my-plugin plugin.

                                                                                                                                                                                                                                                                                                                                                                      The first step is to create the bare minimum code required to make the plugin show up among the available WordPress plugins. Create the main plugin file in the WordPress installation plugins directory, in the C:\\wamp64\\www\\wp\\wp-content\\plugins\\my-plugin\\my-plugin.php file:

                                                                                                                                                                                                                                                                                                                                                                      <?php\n/**\n * Plugin Name: My plugin\n */ \n

                                                                                                                                                                                                                                                                                                                                                                      The plugin should now show up, activate and deactivate correctly, among the plugins listed in the WordPress installation at http://localhost/wp/wp-admin/plugins.php.

                                                                                                                                                                                                                                                                                                                                                                      "},{"location":"v3/tutorials/wamp-setup/#installing-wp-browser","title":"Installing wp-browser","text":"

                                                                                                                                                                                                                                                                                                                                                                      Open a terminal window and navigate to the plugin directory and initialize the Composer project. I'm using Cmder as terminal emulator on Windows, but you can use the default one.

                                                                                                                                                                                                                                                                                                                                                                      cd C:\\wamp64\\www\\wp\\wp-content\\plugins\\my-plugin\ncomposer init\n

                                                                                                                                                                                                                                                                                                                                                                      Composer will ask some questions to initialize the project, for the sake of this small guide the answers are not relevant. Here is the composer.json file generated by the above answers:

                                                                                                                                                                                                                                                                                                                                                                      {\n\"name\": \"wamp/my-plugin\",\n\"type\": \"wordpress-plugin\",\n\"require\": {}\n}\n

                                                                                                                                                                                                                                                                                                                                                                      Next require lucatume/wp-browser as a development dependency:

                                                                                                                                                                                                                                                                                                                                                                      composer require --dev lucatume/wp-browser\n

                                                                                                                                                                                                                                                                                                                                                                      Composer installs any dependency binary file, an executable file, in the project vendor/bin folder. To check Codeception is correctly installed run this command:

                                                                                                                                                                                                                                                                                                                                                                      vendor\\bin\\codecept.bat --version\n

                                                                                                                                                                                                                                                                                                                                                                      Since wp-browser requires Codeception, there is no need to require Codeception explicitly as a development dependency.

                                                                                                                                                                                                                                                                                                                                                                      "},{"location":"v3/tutorials/wamp-setup/#setting-up-wp-browser","title":"Setting up wp-browser","text":"

                                                                                                                                                                                                                                                                                                                                                                      For those that might get lost while trying to set up wp-browser for the first time the VVV context provides an excellent base to understand the process.

                                                                                                                                                                                                                                                                                                                                                                      wp-browser needs to know:

                                                                                                                                                                                                                                                                                                                                                                      • Where the WordPress installation files are located: they will be loaded in integration and \"WordPress unit\" tests.
                                                                                                                                                                                                                                                                                                                                                                      • How to connect to the WordPress site \"normal\" database: this is the database that stores the data of the site I would see when visiting the local installation URL at http://localhost/wp.
                                                                                                                                                                                                                                                                                                                                                                      • How to connect to the database dedicated to the integration and \"WordPress unit\" tests: this database will be used to install WordPress during integration and \"WordPress unit\" tests.

                                                                                                                                                                                                                                                                                                                                                                      Any test suite using a database should never run on a database containing data of any value; this means that your first step should be to backup the site database.

                                                                                                                                                                                                                                                                                                                                                                      You can create a backup of the current site database contents using phpMyAdmin, at http://localhost/phpmyadmin/, under the \"Export\" tab:

                                                                                                                                                                                                                                                                                                                                                                      At any moment you can re-import the site database dump using, again, phpMyAdmin, under the \"Import\" tab:

                                                                                                                                                                                                                                                                                                                                                                      "},{"location":"v3/tutorials/wamp-setup/#bootstrapping-and-configuring-wp-browser","title":"Bootstrapping and configuring wp-browser","text":"

                                                                                                                                                                                                                                                                                                                                                                      After the backup is done it's time to bootstrap wp-browser using its interactive mode:

                                                                                                                                                                                                                                                                                                                                                                      cd C:\\wamp64\\www\\wp\\wp-content\\plugins\\my-plugin\nvendor/bin/codecept.bat init wpbrowser\n

                                                                                                                                                                                                                                                                                                                                                                      The initialization guide will ask a number of questions. In the screenshots below are the answers I used to configure wp-browser.

                                                                                                                                                                                                                                                                                                                                                                      Below a complete list of each answer:

                                                                                                                                                                                                                                                                                                                                                                      • I acknowledge wp-browser should run on development servers... y
                                                                                                                                                                                                                                                                                                                                                                      • Would you like to set up the suites interactively now? y
                                                                                                                                                                                                                                                                                                                                                                      • How would you like the acceptance suite to be called? acceptance
                                                                                                                                                                                                                                                                                                                                                                      • How would you like the functional suite to be called? functional
                                                                                                                                                                                                                                                                                                                                                                      • How would you like the WordPress unit and integration suite to be called? wpunit
                                                                                                                                                                                                                                                                                                                                                                      • How would you like to call the env configuration file? .env.testing
                                                                                                                                                                                                                                                                                                                                                                      • What is the path of the WordPress root directory? C:/wamp64/www/wp
                                                                                                                                                                                                                                                                                                                                                                      • What is the path, relative to WordPress root URL, of the admin area of the test site? /wp-admin
                                                                                                                                                                                                                                                                                                                                                                      • What is the name of the test database used by the test site? tests
                                                                                                                                                                                                                                                                                                                                                                      • What is the host of the test database used by the test site? localhost
                                                                                                                                                                                                                                                                                                                                                                      • What is the user of the test database used by the test site? root
                                                                                                                                                                                                                                                                                                                                                                      • What is the password of the test database used by the test site? ``
                                                                                                                                                                                                                                                                                                                                                                      • What is the table prefix of the test database used by the test site? wp_
                                                                                                                                                                                                                                                                                                                                                                      • What is the name of the test database WPLoader should use? tests
                                                                                                                                                                                                                                                                                                                                                                      • What is the host of the test database WPLoader should use? localhost
                                                                                                                                                                                                                                                                                                                                                                      • What is the user of the test database WPLoader should use? root
                                                                                                                                                                                                                                                                                                                                                                      • What is the password of the test database WPLoader should use? ``
                                                                                                                                                                                                                                                                                                                                                                      • What is the table prefix of the test database WPLoader should use? wp_
                                                                                                                                                                                                                                                                                                                                                                      • What is the URL the test site? http://localhost/wp
                                                                                                                                                                                                                                                                                                                                                                      • What is the email of the test site WordPress administrator? admin@wp.test
                                                                                                                                                                                                                                                                                                                                                                      • What is the title of the test site? My Plugin Test
                                                                                                                                                                                                                                                                                                                                                                      • What is the login of the administrator user of the test site? admin
                                                                                                                                                                                                                                                                                                                                                                      • What is the password of the administrator user of the test site? password
                                                                                                                                                                                                                                                                                                                                                                      • Are you testing a plugin, a theme or a combination of both (both)? plugin
                                                                                                                                                                                                                                                                                                                                                                      • What is the folder/plugin.php name of the plugin? my-plugin/my-plugin.php
                                                                                                                                                                                                                                                                                                                                                                      • Does your project needs additional plugins to be activated to work? no

                                                                                                                                                                                                                                                                                                                                                                      Codeception will build the suites for the first time and should be ready to go.

                                                                                                                                                                                                                                                                                                                                                                      "},{"location":"v3/tutorials/wamp-setup/#setting-up-the-starting-database-fixture","title":"Setting up the starting database fixture","text":"

                                                                                                                                                                                                                                                                                                                                                                      A \"fixture\", in testing terms, is a minimal, starting environment shared by all tests. In BDD it's the Background any scenario will share. In the case of a plugin the minimal, starting environment is the following:

                                                                                                                                                                                                                                                                                                                                                                      • A fresh WordPress installation empty of any content.
                                                                                                                                                                                                                                                                                                                                                                      • WordPress using its default theme.
                                                                                                                                                                                                                                                                                                                                                                      • The only active plugin is the one you're testing, in this example: my-plugin.

                                                                                                                                                                                                                                                                                                                                                                      You should set up this fixture \"manually\", using the site administration UI at http://localhost/wp/wp-admin.

                                                                                                                                                                                                                                                                                                                                                                      The following command will empty the site, backup any content you care about first!

                                                                                                                                                                                                                                                                                                                                                                      When you're done setting up the initial database fixture, export it using the \"Export\" tab of phpMyAdmin, at http://localhost/phpmyadmin/ and move the file to the C:\\wamp64\\www\\wp\\wp-content\\plugins\\my-plugin\\tests\\_data\\dump.sql directory.

                                                                                                                                                                                                                                                                                                                                                                      There is one last step left to complete the setup.

                                                                                                                                                                                                                                                                                                                                                                      "},{"location":"v3/tutorials/wamp-setup/#using-the-tests-database-in-acceptance-and-functional-tests","title":"Using the tests database in acceptance and functional tests","text":"

                                                                                                                                                                                                                                                                                                                                                                      Acceptance and functional tests will act as users, navigating to the site pages and making requests as a user would.

                                                                                                                                                                                                                                                                                                                                                                      This means that WordPress will load, and with it its wp-config.php file, to handle the requests made by the tests.

                                                                                                                                                                                                                                                                                                                                                                      During the setup phase I've specified the database to be used for acceptance and functional tests as tests but, looking at the contents of the C:\\wamp64\\www\\wp\\wp-config.php file, the DB_NAME constant is set to wordpress.

                                                                                                                                                                                                                                                                                                                                                                      What we'll do now means:

                                                                                                                                                                                                                                                                                                                                                                      • If the request is a normal one, use the wordpress database.
                                                                                                                                                                                                                                                                                                                                                                      • If the request comes from a test, use the tests database.

                                                                                                                                                                                                                                                                                                                                                                      In your IDE/text-editor of choice edit the C:\\wamp64\\www\\wp\\wp-config.php and replace the line defining the DB_NAME constant like this:

                                                                                                                                                                                                                                                                                                                                                                      - define( 'DB_NAME', 'wordpress' );\n+ if( isset( $_SERVER['HTTP_X_WPBROWSER_REQUEST'] ) && $_SERVER['HTTP_X_WPBROWSER_REQUEST'] ) { \n+    define( 'DB_NAME', 'tests' );\n+ } else {\n+    define( 'DB_NAME', 'wordpress' );\n+ }\n

                                                                                                                                                                                                                                                                                                                                                                      Here's the copy-and-paste friendly version:

                                                                                                                                                                                                                                                                                                                                                                      if( isset( $_SERVER['HTTP_X_TEST_REQUEST'] ) && $_SERVER['HTTP_X_TEST_REQUEST'] ) {\n        define( 'DB_NAME', 'tests' );\n} else {\n        define( 'DB_NAME', 'wordpress' );\n}\n

                                                                                                                                                                                                                                                                                                                                                                      If you look at the tests/acceptance.suite.yml and tests/functional.suite.yml files, respectively the acceptance and functional suite configuration files, you will see these entries in the WPBrowser module configuration:

                                                                                                                                                                                                                                                                                                                                                                      headers:\nX_TEST_REQUEST: 1\nX_WPBROWSER_REQUEST: 1\n

                                                                                                                                                                                                                                                                                                                                                                      This means that, with each HTTP request done during tests, the module will send the two headers. Those headers are read, on the WordPress side, using the $_SERVER['HTTP_X_TEST_REQUEST'] and $_SERVER['X_WPBROWSER_REQUEST'] variables.

                                                                                                                                                                                                                                                                                                                                                                      Codeception and wp-browser are ready to run and the test-drive development can start.

                                                                                                                                                                                                                                                                                                                                                                      "},{"location":"v3/tutorials/wamp-setup/#sanity-check","title":"Sanity check","text":"

                                                                                                                                                                                                                                                                                                                                                                      Before starting to write tests, take a moment to run each suite separately and make sure all is set up correctly.

                                                                                                                                                                                                                                                                                                                                                                      If you run into issues, there's a chance you forgot something along the way, please take the time to read this tutorial a second time before opening an issue.

                                                                                                                                                                                                                                                                                                                                                                      You have created 4 suites, each suite has at least one example test to make sure all works. Run each suite and make sure all tests succeed, from within the box run:

                                                                                                                                                                                                                                                                                                                                                                      cd C:\\wamp64\\www\\wp\\wp-content\\plugins\\my-plugin vendor/bin/codecept run acceptance\nvendor/bin/codecept run functional\nvendor/bin/codecept run wpunit\nvendor/bin/codecept run unit\n

                                                                                                                                                                                                                                                                                                                                                                      You're now run to customize the suites to your liking or start writing tests, run vendor/bin/codecept.bat to see a list of the available commands.

                                                                                                                                                                                                                                                                                                                                                                      "}]} \ No newline at end of file diff --git a/docs/public/sitemap.xml b/docs/sitemap.xml similarity index 74% rename from docs/public/sitemap.xml rename to docs/sitemap.xml index 665c6ba5e..2f6073554 100644 --- a/docs/public/sitemap.xml +++ b/docs/sitemap.xml @@ -2,207 +2,197 @@ https://wpbrowser.wptestkit.dev/ - 2023-09-04 + 2023-09-05 daily https://wpbrowser.wptestkit.dev/commands/ - 2023-09-04 + 2023-09-05 daily https://wpbrowser.wptestkit.dev/custom-configuration/ - 2023-09-04 + 2023-09-05 daily https://wpbrowser.wptestkit.dev/default-configuration/ - 2023-09-04 + 2023-09-05 daily https://wpbrowser.wptestkit.dev/extensions/ - 2023-09-04 + 2023-09-05 daily https://wpbrowser.wptestkit.dev/modules/WPBrowser/ - 2023-09-04 + 2023-09-05 daily https://wpbrowser.wptestkit.dev/modules/WPCLI/ - 2023-09-04 + 2023-09-05 daily https://wpbrowser.wptestkit.dev/modules/WPDb/ - 2023-09-04 + 2023-09-05 daily https://wpbrowser.wptestkit.dev/modules/WPFilesystem/ - 2023-09-04 + 2023-09-05 daily https://wpbrowser.wptestkit.dev/modules/WPLoader/ - 2023-09-04 + 2023-09-05 daily https://wpbrowser.wptestkit.dev/modules/WPQueries/ - 2023-09-04 + 2023-09-05 daily https://wpbrowser.wptestkit.dev/modules/WPWebDriver/ - 2023-09-04 + 2023-09-05 daily https://wpbrowser.wptestkit.dev/v3/ - 2023-09-04 + 2023-09-05 daily https://wpbrowser.wptestkit.dev/v3/codeception-4-support/ - 2023-09-04 + 2023-09-05 daily https://wpbrowser.wptestkit.dev/v3/codeception-phpunit-and-wpbrowser/ - 2023-09-04 + 2023-09-05 daily https://wpbrowser.wptestkit.dev/v3/commands/ - 2023-09-04 + 2023-09-05 daily https://wpbrowser.wptestkit.dev/v3/configuration/ - 2023-09-04 - daily - - - https://wpbrowser.wptestkit.dev/v3/contributing/ - 2023-09-04 + 2023-09-05 daily https://wpbrowser.wptestkit.dev/v3/events-api/ - 2023-09-04 + 2023-09-05 daily https://wpbrowser.wptestkit.dev/v3/extensions/ - 2023-09-04 + 2023-09-05 daily https://wpbrowser.wptestkit.dev/v3/faq/ - 2023-09-04 + 2023-09-05 daily https://wpbrowser.wptestkit.dev/v3/installation/ - 2023-09-04 + 2023-09-05 daily https://wpbrowser.wptestkit.dev/v3/levels-of-testing/ - 2023-09-04 + 2023-09-05 daily https://wpbrowser.wptestkit.dev/v3/requirements/ - 2023-09-04 + 2023-09-05 daily https://wpbrowser.wptestkit.dev/v3/setting-up-minimum-wordpress-installation/ - 2023-09-04 - daily - - - https://wpbrowser.wptestkit.dev/v3/sponsors/ - 2023-09-04 + 2023-09-05 daily https://wpbrowser.wptestkit.dev/v3/advanced/run-in-separate-process/ - 2023-09-04 + 2023-09-05 daily https://wpbrowser.wptestkit.dev/v3/migration/from-version-2-to-version-3/ - 2023-09-04 + 2023-09-05 daily https://wpbrowser.wptestkit.dev/v3/modules/WPBrowser/ - 2023-09-04 + 2023-09-05 daily https://wpbrowser.wptestkit.dev/v3/modules/WPCLI/ - 2023-09-04 + 2023-09-05 daily https://wpbrowser.wptestkit.dev/v3/modules/WPDb/ - 2023-09-04 + 2023-09-05 daily https://wpbrowser.wptestkit.dev/v3/modules/WPFilesystem/ - 2023-09-04 + 2023-09-05 daily https://wpbrowser.wptestkit.dev/v3/modules/WPLoader/ - 2023-09-04 + 2023-09-05 daily https://wpbrowser.wptestkit.dev/v3/modules/WPQueries/ - 2023-09-04 + 2023-09-05 daily https://wpbrowser.wptestkit.dev/v3/modules/WPWebDriver/ - 2023-09-04 + 2023-09-05 daily https://wpbrowser.wptestkit.dev/v3/modules/WordPress/ - 2023-09-04 + 2023-09-05 daily https://wpbrowser.wptestkit.dev/v3/tutorials/automatically-change-db-in-tests/ - 2023-09-04 + 2023-09-05 daily https://wpbrowser.wptestkit.dev/v3/tutorials/local-flywheel-setup/ - 2023-09-04 + 2023-09-05 daily https://wpbrowser.wptestkit.dev/v3/tutorials/mamp-mac-setup/ - 2023-09-04 + 2023-09-05 daily https://wpbrowser.wptestkit.dev/v3/tutorials/vvv-setup/ - 2023-09-04 + 2023-09-05 daily https://wpbrowser.wptestkit.dev/v3/tutorials/wamp-setup/ - 2023-09-04 + 2023-09-05 daily \ No newline at end of file diff --git a/docs/sitemap.xml.gz b/docs/sitemap.xml.gz new file mode 100644 index 000000000..57a087155 Binary files /dev/null and b/docs/sitemap.xml.gz differ diff --git a/docs/v3/advanced/run-in-separate-process/index.html b/docs/v3/advanced/run-in-separate-process/index.html new file mode 100644 index 000000000..4febd4007 --- /dev/null +++ b/docs/v3/advanced/run-in-separate-process/index.html @@ -0,0 +1,2435 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Running tests in separate processes - wp-browser docs + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      + + +
                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + + + +

                                                                                                                                                                                                                                                                                                                                                                      Running tests in separate processes

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      This is the documentation for version 3 of the project. +The current version is version 4 and the documentation can be found here.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Running tests in separate processes

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      PHPUnit offers the possibility to run tests in a separate PHP process; Codeception does not officially support the option as of version 4.0.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      The wp-browser project tries to fill that gap by supporting the @runInSeparateProcess annotation.
                                                                                                                                                                                                                                                                                                                                                                      +This support comes with some caveats, though:

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      1. The support is only for test cases extending the Codeception\TestCase\WPTestCase class (the base test case for integration or "WordPress unit" tests)
                                                                                                                                                                                                                                                                                                                                                                      2. +
                                                                                                                                                                                                                                                                                                                                                                      3. The support wp-browser provides only supports the @preserveGlobalState annotation with the disabled value; this means there is no support for preserving global state between tests.
                                                                                                                                                                                                                                                                                                                                                                      4. +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Read more about what this means in PHPUnit documentation.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Why run tests in a separate PHP process?

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      One main reason: isolation.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      What does "isolation" means?

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Before answering that question, it's essential to understand, via an example, why a lack of isolation might be an issue.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      I want to test the get_api function. The function will return the correct singleton instance of an API handling class: an instance of Api when the function is called in non-admin context, and an instance of AdminApi when the function is called in admin context. The get_api function is acting as a service locator.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      <?php
                                                                                                                                                                                                                                                                                                                                                                      +function get_api(){
                                                                                                                                                                                                                                                                                                                                                                      +    static $api;
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +    if(null !== $api){
                                                                                                                                                                                                                                                                                                                                                                      +        return $api;
                                                                                                                                                                                                                                                                                                                                                                      +    }
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +    if( is_admin() ) {
                                                                                                                                                                                                                                                                                                                                                                      +        $api = new Admin_Api();
                                                                                                                                                                                                                                                                                                                                                                      +    } else {
                                                                                                                                                                                                                                                                                                                                                                      +        $api = new Api();
                                                                                                                                                                                                                                                                                                                                                                      +    }
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +    return $api;
                                                                                                                                                                                                                                                                                                                                                                      +}
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      There are two challenges to testing this function:

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      1. The is_admin function, defined by WordPress, looks up a WP_ADMIN constant to know if the context of the current request is an administration UI one or not.
                                                                                                                                                                                                                                                                                                                                                                      2. +
                                                                                                                                                                                                                                                                                                                                                                      3. The get_api function will check for the context and resolve and build the correct instance only once, the first time it's called in the context of a request.
                                                                                                                                                                                                                                                                                                                                                                      4. +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      There are some possible solutions to this problem:

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      a. Refactor the get_api function into a method of an Api_Factory object taking the context as a dependency, thus allowing injection of the "context" (which implies the creation of a Context adapter that will proxy its is_admin method to the is_admin function). You can find the code for such refactoring in the OOP refactoring of get_api section. +b. Refactor the get_api function to accept the current is_admin value as an input argument, get_api( $is_admin ), this refactoring moves part of the complexity of getting hold of the correct instance of the API handler on the client code. Adding more build condition and checks, e.g., if the current request is a REST request or not or some tests on the user authorizations, then, requires adding more input arguments to the get_api function: the knowledge of the implementation of the get_api method will "leak" to the client code having to replicate complexity throughout the system.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      I want to layout possible solutions to the problem to show there is always a design alternative to make code testable that might or might not fit the current time or scope constraint.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      In this example, I've inherited the get_api function from the existing code, and it cannot be changed, yet I want to test it dealing with the two problems outlined above.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Running tests in separate PHP processes

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      To test the get_api function shown above I've created a new wpunit type of test:

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      vendor/bin/codecept g:wpunit integration "api"
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      The command scaffolds a test/integration/apiTest.php file that I've modified to ensure full coverage of the get_api function:

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      <?php
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +class apiTest extends \Codeception\TestCase\WPTestCase
                                                                                                                                                                                                                                                                                                                                                                      +{
                                                                                                                                                                                                                                                                                                                                                                      +    public function test_get_api_exists()
                                                                                                                                                                                                                                                                                                                                                                      +    {
                                                                                                                                                                                                                                                                                                                                                                      +        $this->assertTrue(function_exists('get_api'));
                                                                                                                                                                                                                                                                                                                                                                      +    }
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +    public function test_get_api_will_cache()
                                                                                                                                                                                                                                                                                                                                                                      +    {
                                                                                                                                                                                                                                                                                                                                                                      +        $this->assertSame(get_api(), get_api());
                                                                                                                                                                                                                                                                                                                                                                      +    }
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +    /**
                                                                                                                                                                                                                                                                                                                                                                      +     * @runInSeparateProcess
                                                                                                                                                                                                                                                                                                                                                                      +     * @preserveGlobalState disabled
                                                                                                                                                                                                                                                                                                                                                                      +     */
                                                                                                                                                                                                                                                                                                                                                                      +    public function test_get_api_will_return_api_if_not_admin()
                                                                                                                                                                                                                                                                                                                                                                      +    {
                                                                                                                                                                                                                                                                                                                                                                      +        // Let's make sure we're NOT in admin context.
                                                                                                                                                                                                                                                                                                                                                                      +        define('WP_ADMIN', false);
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +        $api = get_api();
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +        $this->assertInstanceOf(Api::class, $api);
                                                                                                                                                                                                                                                                                                                                                                      +    }
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +    /**
                                                                                                                                                                                                                                                                                                                                                                      +     * @runInSeparateProcess
                                                                                                                                                                                                                                                                                                                                                                      +     * @preserveGlobalState disabled
                                                                                                                                                                                                                                                                                                                                                                      +     */
                                                                                                                                                                                                                                                                                                                                                                      +    public function test_get_api_will_cache_api_if_not_admin()
                                                                                                                                                                                                                                                                                                                                                                      +    {
                                                                                                                                                                                                                                                                                                                                                                      +        // Let's make sure we're NOT in admin context.
                                                                                                                                                                                                                                                                                                                                                                      +        define('WP_ADMIN', false);
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +        $api = get_api();
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +        $this->assertSame(get_api(), $api);
                                                                                                                                                                                                                                                                                                                                                                      +    }
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +    /**
                                                                                                                                                                                                                                                                                                                                                                      +     * @runInSeparateProcess
                                                                                                                                                                                                                                                                                                                                                                      +     * @preserveGlobalState disabled
                                                                                                                                                                                                                                                                                                                                                                      +     */
                                                                                                                                                                                                                                                                                                                                                                      +    public function test_get_api_will_return_api_if_is_admin()
                                                                                                                                                                                                                                                                                                                                                                      +    {
                                                                                                                                                                                                                                                                                                                                                                      +        // Let's make sure we're NOT in admin context.
                                                                                                                                                                                                                                                                                                                                                                      +        define('WP_ADMIN', true);
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +        $api = get_api();
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +        $this->assertInstanceOf(AdminApi::class, $api);
                                                                                                                                                                                                                                                                                                                                                                      +    }
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +    /**
                                                                                                                                                                                                                                                                                                                                                                      +     * @runInSeparateProcess
                                                                                                                                                                                                                                                                                                                                                                      +     * @preserveGlobalState disabled
                                                                                                                                                                                                                                                                                                                                                                      +     */
                                                                                                                                                                                                                                                                                                                                                                      +    public function test_get_api_will_cache_api_if_is_admin()
                                                                                                                                                                                                                                                                                                                                                                      +    {
                                                                                                                                                                                                                                                                                                                                                                      +        // Let's make sure we're NOT in admin context.
                                                                                                                                                                                                                                                                                                                                                                      +        define('WP_ADMIN', true);
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +        $api = get_api();
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +        $this->assertSame(get_api(), $api);
                                                                                                                                                                                                                                                                                                                                                                      +    }
                                                                                                                                                                                                                                                                                                                                                                      +}
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Some pieces of this code are worth pointing out:

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      1. There are two test methods, test_get_api_exists and test_get_api_will_cache that are not running in a separate process. Running tests in a separate process provide isolation at the cost of speed, only tests that require isolation should run in a separate PHP process.
                                                                                                                                                                                                                                                                                                                                                                      2. +
                                                                                                                                                                                                                                                                                                                                                                      3. I instruct the Codeception and PHPUnit test runner to run a test method in a different process by adding two annotations that are both required ** precisely as shown**: +
                                                                                                                                                                                                                                                                                                                                                                        /**
                                                                                                                                                                                                                                                                                                                                                                        + * @runInSeparateProcess
                                                                                                                                                                                                                                                                                                                                                                        + * @preserveGlobalState disabled
                                                                                                                                                                                                                                                                                                                                                                        + */
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      4. +
                                                                                                                                                                                                                                                                                                                                                                      5. The isolation part of this testing approach shines through when I define, in the last four tests, the WP_ADMIN constant multiple times. If I try to do that in test code running in the same PHP process, then the second define call would cause a fatal error.
                                                                                                                                                                                                                                                                                                                                                                      6. +
                                                                                                                                                                                                                                                                                                                                                                      7. The isolation has also taken care of the second issue where the get_api function caches the $api instance after its first resolution in a static variable: since each test happens in a self-contained, dedicated PHP process, the static $api variable will be null at the start of each test.
                                                                                                                                                                                                                                                                                                                                                                      8. +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Can I run some tests in the same process and some in a separate process?

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Yes. In the example test code in the previous section, the test_get_api_exists and test_get_api_will_cache test methods are not running in separate processes.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      In your test cases extending the Codeception\TestCase\WPTestCase, you can mix test methods running in the primary PHP process and those running in a separate PHP process without issues.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      OOP refactoring of get_api

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      In the Why run tests in a separate PHP process? section I've outlined a possible refactoring of the get_api function to make it testable without requiring the use of separate PHP processes.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      I'm providing this refactoring code below for the sake of completeness, the judgment of which approach is "better" is up to the reader.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      <?php
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +class Context_Adapter{
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +    public function is_admin(){
                                                                                                                                                                                                                                                                                                                                                                      +        return \is_admin();
                                                                                                                                                                                                                                                                                                                                                                      +    }
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +}
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +class Api_Factory{
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +    private $api;
                                                                                                                                                                                                                                                                                                                                                                      +    private $context;
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +    public function __construct(Context_Adapter $context){
                                                                                                                                                                                                                                                                                                                                                                      +        $this->context = $context;
                                                                                                                                                                                                                                                                                                                                                                      +    }
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +    public function getApi(){
                                                                                                                                                                                                                                                                                                                                                                      +        if(null !== $this->api){
                                                                                                                                                                                                                                                                                                                                                                      +            return $this->api;    
                                                                                                                                                                                                                                                                                                                                                                      +        }
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +        if($this->context->is_admin()){
                                                                                                                                                                                                                                                                                                                                                                      +            $api = new Admin_Api;
                                                                                                                                                                                                                                                                                                                                                                      +        } else {
                                                                                                                                                                                                                                                                                                                                                                      +            $api = new Api;
                                                                                                                                                                                                                                                                                                                                                                      +        }
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +        return $api;
                                                                                                                                                                                                                                                                                                                                                                      +    }
                                                                                                                                                                                                                                                                                                                                                                      +}
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Now the Api_Factory class can be injected by injecting a mocked Context_Adapter class, modifying the return value of the Context_Adapter::is_admin method.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Due to the supposed requirement of the API instance being a singleton, this solution will also require some container or service-locator to ensure at most only one instance of the Api_Factory exists at any given time in the context of a request.

                                                                                                                                                                                                                                                                                                                                                                      + + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + + + + + \ No newline at end of file diff --git a/docs/v3/codeception-4-support/index.html b/docs/v3/codeception-4-support/index.html new file mode 100644 index 000000000..8b4fce803 --- /dev/null +++ b/docs/v3/codeception-4-support/index.html @@ -0,0 +1,2179 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Using wp-browser with Codeception 4.0 - wp-browser docs + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      + + +
                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + + + +

                                                                                                                                                                                                                                                                                                                                                                      Using wp-browser with Codeception 4.0

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      This is the documentation for version 3 of the project. +The current version is version 4 and the documentation can be found here.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Using wp-browser with Codeception 4.0

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Codeception version 4.0 introduced a number of new features to the framework and it's the version of wp-browser that will be maintained from now on.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      I've made an effort to keep wp-browser compatible with PHP 5.6 and Codeception versions from 2.5 up.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      One the biggest changes of Codeception version 4.0 is that modules have been broken out into separate packages.
                                                                                                                                                                                                                                                                                                                                                                      +To use wp-browser with Codeception 4.0 all you need to do is to add this to your project composer.json file:

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      {
                                                                                                                                                                                                                                                                                                                                                                      +  "require-dev": {
                                                                                                                                                                                                                                                                                                                                                                      +    "lucatume/wp-browser": "^2.4",
                                                                                                                                                                                                                                                                                                                                                                      +    "codeception/module-asserts": "^1.0",
                                                                                                                                                                                                                                                                                                                                                                      +    "codeception/module-phpbrowser": "^1.0",
                                                                                                                                                                                                                                                                                                                                                                      +    "codeception/module-webdriver": "^1.0",
                                                                                                                                                                                                                                                                                                                                                                      +    "codeception/module-db": "^1.0",
                                                                                                                                                                                                                                                                                                                                                                      +    "codeception/module-filesystem": "^1.0",
                                                                                                                                                                                                                                                                                                                                                                      +    "codeception/module-cli": "^1.0",
                                                                                                                                                                                                                                                                                                                                                                      +    "codeception/util-universalframework": "^1.0"
                                                                                                                                                                                                                                                                                                                                                                      +  }
                                                                                                                                                                                                                                                                                                                                                                      +}
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      You might not need all the modules listed here, depending on the wp-browser modules you use in your test suites.
                                                                                                                                                                                                                                                                                                                                                                      +This is a scheme of what Codeception modules you will need for which wp-browser module to help you choose only the required modules:

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • "codeception/module-asserts" - Required for Codeception 4.0 compatibility.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • "codeception/module-phpbrowser" - Required by the WPBrowser module.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • "codeception/module-webdriver" - Required by the WPWebDriver module.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • "codeception/module-db" - Required by the WPDb module.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • "codeception/module-filesystem" - Required by the WPFilesystem module.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • "codeception/module-cli" - Required by the WPCLI module.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • "codeception/util-universalframework" - Required by the WordPress framework module.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + + + + + \ No newline at end of file diff --git a/docs/v3/codeception-phpunit-and-wpbrowser/index.html b/docs/v3/codeception-phpunit-and-wpbrowser/index.html new file mode 100644 index 000000000..cfcdc3510 --- /dev/null +++ b/docs/v3/codeception-phpunit-and-wpbrowser/index.html @@ -0,0 +1,2245 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Codeception, PHPUnit and wp-browser - wp-browser docs + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      + + +
                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + + + +

                                                                                                                                                                                                                                                                                                                                                                      Codeception, PHPUnit and wp-browser

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      This is the documentation for version 3 of the project. +The current version is version 4 and the documentation can be found here.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      The wp-browser stack

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      The wp-browser project is built leveraging the power of a number of open-source projects.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      While I'm not listing all of them here it's worth mentioning those that will come up, again and again, in the documentation.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      WordPress

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      WordPress is open source software you can use to create a beautiful website, blog, or app.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      The line is taken directly from WordPress.org site.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      In the context of this documentation WordPress is the PHP and JavaScript framework websites and web applications can be built on, the one anyone can download from here.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Codeception

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Codeception (home) is a modern, powerful PHP testing framework written in PHP.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      It comes with a number of modules and extensions that are comparable to WordPress plugins and themes.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Modules and extensions are combined in suites to be able to run a specific type of test. Each suite will handle a specific type of test for a specific set of code.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      wp-browser is none other than a collection of modules and extensions for Codeception made specifically to test WordPress applications.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      PHPUnit

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      PHPUnit is the most widely known PHP testing framework. As the name implies it was born to make unit testing of PHP code easier but its scope and power has grown well below that.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Codeception is based, and uses, PhpUnit to wrap some of its functionalities into an easy-to-use API.
                                                                                                                                                                                                                                                                                                                                                                      +The two are so compatible one with the other that Codeception can run PHPUnit tests with little to no changes.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      This documentation will not cover this subject and will only deal with Codeception-native test methods but you can find more information here.

                                                                                                                                                                                                                                                                                                                                                                      + + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + + + + + \ No newline at end of file diff --git a/docs/v3/commands/index.html b/docs/v3/commands/index.html new file mode 100644 index 000000000..a9fe2c148 --- /dev/null +++ b/docs/v3/commands/index.html @@ -0,0 +1,2544 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Commands - wp-browser docs + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      + + +
                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      This is the documentation for version 3 of the project. +The current version is version 4 and the documentation can be found here.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Custom commands provided by wp-browser

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      The project comes with its own set of custom Codeception commands.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      The commands provide functionalities to quickly scaffold different types of tests. +Any other codecept command remains intact and available.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Adding the commands to an existing project

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      The commands are added to the main Codeception configuration file, codeception.yml, when scaffolding a project via the codecept init wp-browser command.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      They can be added to any existing project adding, or editing, the commands section of the configuration file:

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      extensions:
                                                                                                                                                                                                                                                                                                                                                                      +    commands:
                                                                                                                                                                                                                                                                                                                                                                      +        - "Codeception\\Command\\GenerateWPUnit"
                                                                                                                                                                                                                                                                                                                                                                      +        - "Codeception\\Command\\GenerateWPRestApi"
                                                                                                                                                                                                                                                                                                                                                                      +        - "Codeception\\Command\\GenerateWPRestController"
                                                                                                                                                                                                                                                                                                                                                                      +        - "Codeception\\Command\\GenerateWPRestPostTypeController"
                                                                                                                                                                                                                                                                                                                                                                      +        - "Codeception\\Command\\GenerateWPAjax"
                                                                                                                                                                                                                                                                                                                                                                      +        - "Codeception\\Command\\GenerateWPCanonical"
                                                                                                                                                                                                                                                                                                                                                                      +        - "Codeception\\Command\\GenerateWPXMLRPC"
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Generation commands

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      The library provides commands to quickly scaffold integration test cases for specific types of WordPress components, see levels of testing for more information.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      The tests are almost identical to the ones you could write in a PHPUnit based Core suite with the exception of extending the Codeception\TestCase\WPTestCase test case.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      generate:wpunit

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Generates a test case extending the \Codeception\TestCase\WPTestCase class using the

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        codecept generate:wpunit suite SomeClass
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      The command will generate a skeleton test case like

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      <?php
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +class SomeClassTest extends \Codeception\TestCase\WPTestCase
                                                                                                                                                                                                                                                                                                                                                                      +{
                                                                                                                                                                                                                                                                                                                                                                      +    public function setUp()
                                                                                                                                                                                                                                                                                                                                                                      +    {
                                                                                                                                                                                                                                                                                                                                                                      +      parent::setUp();
                                                                                                                                                                                                                                                                                                                                                                      +    }
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +    public function tearDown()
                                                                                                                                                                                                                                                                                                                                                                      +    {
                                                                                                                                                                                                                                                                                                                                                                      +      parent::tearDown();
                                                                                                                                                                                                                                                                                                                                                                      +    }
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +    // tests
                                                                                                                                                                                                                                                                                                                                                                      +    public function testMe()
                                                                                                                                                                                                                                                                                                                                                                      +    {
                                                                                                                                                                                                                                                                                                                                                                      +    }
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +}
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      generate:wprest

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Generates a test case extending the \Codeception\TestCase\WPRestApiTestCase class using the

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        codecept generate:wprest suite SomeClass
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      The command will generate a skeleton test case like

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      <?php
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +class SomeClassTest extends \Codeception\TestCase\WPRestApiTestCase
                                                                                                                                                                                                                                                                                                                                                                      +{
                                                                                                                                                                                                                                                                                                                                                                      +    public function setUp()
                                                                                                                                                                                                                                                                                                                                                                      +    {
                                                                                                                                                                                                                                                                                                                                                                      +      parent::setUp();
                                                                                                                                                                                                                                                                                                                                                                      +    }
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +    public function tearDown()
                                                                                                                                                                                                                                                                                                                                                                      +    {
                                                                                                                                                                                                                                                                                                                                                                      +      parent::tearDown();
                                                                                                                                                                                                                                                                                                                                                                      +    }
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +    // tests
                                                                                                                                                                                                                                                                                                                                                                      +    public function testMe()
                                                                                                                                                                                                                                                                                                                                                                      +    {
                                                                                                                                                                                                                                                                                                                                                                      +    }
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +}
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      generate:wprestcontroller

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Generates a test case extending the \Codeception\TestCase\WPRestControllerTestCase class using the

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        codecept generate:wprest suite SomeClass
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      The command will generate a skeleton test case like

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      <?php
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +class SomeClassTest extends \Codeception\TestCase\WPRestControllerTestCase
                                                                                                                                                                                                                                                                                                                                                                      +{
                                                                                                                                                                                                                                                                                                                                                                      +    public function setUp()
                                                                                                                                                                                                                                                                                                                                                                      +    {
                                                                                                                                                                                                                                                                                                                                                                      +      parent::setUp();
                                                                                                                                                                                                                                                                                                                                                                      +    }
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +    public function tearDown()
                                                                                                                                                                                                                                                                                                                                                                      +    {
                                                                                                                                                                                                                                                                                                                                                                      +      parent::tearDown();
                                                                                                                                                                                                                                                                                                                                                                      +    }
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +    // tests
                                                                                                                                                                                                                                                                                                                                                                      +    public function testMe()
                                                                                                                                                                                                                                                                                                                                                                      +    {
                                                                                                                                                                                                                                                                                                                                                                      +    }
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +}
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      generate:wprestposttypecontroller

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Generates a test case extending the \Codeception\TestCase\WPRestPostTypeControllerTestCase class using the

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        codecept generate:wprest suite SomeClass
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      The command will generate a skeleton test case like

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      <?php
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +class SomeClassTest extends \Codeception\TestCase\WPRestPostTypeControllerTestCase
                                                                                                                                                                                                                                                                                                                                                                      +{
                                                                                                                                                                                                                                                                                                                                                                      +    public function setUp()
                                                                                                                                                                                                                                                                                                                                                                      +    {
                                                                                                                                                                                                                                                                                                                                                                      +      parent::setUp();
                                                                                                                                                                                                                                                                                                                                                                      +    }
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +    public function tearDown()
                                                                                                                                                                                                                                                                                                                                                                      +    {
                                                                                                                                                                                                                                                                                                                                                                      +      parent::tearDown();
                                                                                                                                                                                                                                                                                                                                                                      +    }
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +    // tests
                                                                                                                                                                                                                                                                                                                                                                      +    public function testMe()
                                                                                                                                                                                                                                                                                                                                                                      +    {
                                                                                                                                                                                                                                                                                                                                                                      +    }
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +}
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      generate:wpajax

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Generates a test case extending the \Codeception\TestCase\WPAjaxTestCase class using the

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        codecept generate:wpajax suite SomeClass
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      The command will generate a skeleton test case like

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      <?php
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +class SomeClassTest extends \Codeception\TestCase\WPAjaxTestCase
                                                                                                                                                                                                                                                                                                                                                                      +{
                                                                                                                                                                                                                                                                                                                                                                      +    public function setUp()
                                                                                                                                                                                                                                                                                                                                                                      +    {
                                                                                                                                                                                                                                                                                                                                                                      +      parent::setUp();
                                                                                                                                                                                                                                                                                                                                                                      +    }
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +    public function tearDown()
                                                                                                                                                                                                                                                                                                                                                                      +    {
                                                                                                                                                                                                                                                                                                                                                                      +      parent::tearDown();
                                                                                                                                                                                                                                                                                                                                                                      +    }
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +    // tests
                                                                                                                                                                                                                                                                                                                                                                      +    public function testMe()
                                                                                                                                                                                                                                                                                                                                                                      +    {
                                                                                                                                                                                                                                                                                                                                                                      +    }
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +}
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      generate:wpxmlrpc

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Generates a test case extending the \Codeception\TestCase\WPXMLRPCTestCase class using the

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        codecept generate:wpxmlrpc suite SomeClass
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      The command will generate a skeleton test case like

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      <?php
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +class SomeClassTest extends \Codeception\TestCase\WPXMLRPCTestCase
                                                                                                                                                                                                                                                                                                                                                                      +{
                                                                                                                                                                                                                                                                                                                                                                      +    public function setUp()
                                                                                                                                                                                                                                                                                                                                                                      +    {
                                                                                                                                                                                                                                                                                                                                                                      +      parent::setUp();
                                                                                                                                                                                                                                                                                                                                                                      +    }
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +    public function tearDown()
                                                                                                                                                                                                                                                                                                                                                                      +    {
                                                                                                                                                                                                                                                                                                                                                                      +      parent::tearDown();
                                                                                                                                                                                                                                                                                                                                                                      +    }
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +    // tests
                                                                                                                                                                                                                                                                                                                                                                      +    public function testMe()
                                                                                                                                                                                                                                                                                                                                                                      +    {
                                                                                                                                                                                                                                                                                                                                                                      +    }
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +}
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      generate:wpcanonical

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Generates a test case extending the \Codeception\TestCase\WPCanonicalTestCase class using the

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        codecept generate:wpcanonical suite SomeClass
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      The command will generate a skeleton test case like

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      <?php
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +class SomeClassTest extends \Codeception\TestCase\WPCanonicalTestCase
                                                                                                                                                                                                                                                                                                                                                                      +{
                                                                                                                                                                                                                                                                                                                                                                      +    public function setUp()
                                                                                                                                                                                                                                                                                                                                                                      +    {
                                                                                                                                                                                                                                                                                                                                                                      +      parent::setUp();
                                                                                                                                                                                                                                                                                                                                                                      +    }
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +    public function tearDown()
                                                                                                                                                                                                                                                                                                                                                                      +    {
                                                                                                                                                                                                                                                                                                                                                                      +      parent::tearDown();
                                                                                                                                                                                                                                                                                                                                                                      +    }
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +    // tests
                                                                                                                                                                                                                                                                                                                                                                      +    public function testMe()
                                                                                                                                                                                                                                                                                                                                                                      +    {
                                                                                                                                                                                                                                                                                                                                                                      +    }
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +}
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + + + + + \ No newline at end of file diff --git a/docs/v3/configuration/index.html b/docs/v3/configuration/index.html new file mode 100644 index 000000000..bda7ef48d --- /dev/null +++ b/docs/v3/configuration/index.html @@ -0,0 +1,3126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Configuration - wp-browser docs + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      + + +
                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + + + +

                                                                                                                                                                                                                                                                                                                                                                      Configuration

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      This is the documentation for version 3 of the project. +The current version is version 4 and the documentation can be found here.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Initializing wp-browser

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      While wp-browser can be configured manually creating each file the fastest way to bootstrap its configuration is by using its initialization template.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Throughout the steps below I will use the WordPress setup I've prepared before +From the root folder of the project, /Users/luca/Sites/wordpress/wp-content/plugins/acme-plugin in the example, run the command:

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      vendor/bin/codecept init wpbrowser
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Composer installed Codeception binary (codecept) in the vendor folder of my project.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      With the command above I'm telling Codeception to initialize a wp-browser project in the current folder.
                                                                                                                                                                                                                                                                                                                                                                      +When I click enter I'm presented with a list of questions, each answer will be used to configure the wp-browser project for me; one by one.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      In the screenshot the answers I've provided to each question, with reference to the setup above:

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      codecept init wpbrowser 1

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      codecept init wpbrowser 2

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      wp-browser will try to provide a brief explanation of what each question is but below is the long version.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Long question explanation

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      I've tried to condense as much clarity as possible in the questions the codecept init wpbrowser command will ask but, for sake of brevity and space, there's no way I could provide inline a deeper explanation of each.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Below is a longer explanation of each question:

                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      How would you like the acceptance suite to be called?

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      With reference to the testing levels definition this question provides you with the possibility to change the name of the acceptance-like test suite.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Common, alternative, names are ui, rest and user.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      How would you like the functional suite to be called?

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      With reference to the testing levels definition this question provides you with the possibility to change the name of the functional-like test suite.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      A common alternative name is service.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      How would you like the WordPress unit and integration suite to be called?

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      With reference to the testing levels definition this question provides you with the possibility to change the name of the suite dedicated to integration and "WordPress unit" tests.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      A common alternative name is integration.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      How would you like to call the env configuration file?

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Instead of configuring each module in each suite with the same parameters over and over Codeception supports dynamic configuration via environment files.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      wp-browser will scaffold such a configuration for you and will use, by default, a file called .env to store the configuration parameters.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      The file name might not suit all setups especially and this question allows changing that file name; common, alternative, file names are .env.tests, .env.codeception and similar.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Where is WordPress installed?

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      During tests the test code will need to access WordPress code, precisely wp-browser requires being pointed to the folder that contains the wp-load.php file.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      The answer can be an absolute path, like /Users/luca/Sites/wordrpress, or a path relative to the folder where Codeception is installed like vendor/wordpress.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      This path should be accessible by the machine that is running the tests; if you're running the tests from your machine (e.g. your laptop) that's just the path to the folder where WordPress is installed, /Users/luca/Sites/wordpress in the example configuration above.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      If you are, instead, running the tests from within a virtualized machine (e.g. Vagrant or Docker) then the path should be the one used by the virtualized machine.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      To make an example:

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • on my machine WordPress is installed at /Users/luca/Sites/wordpress
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • I've created a Docker container using the official WordPress image and bound the above folder into the container
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • internally the container will put WordPress in the /var/www/html folder
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      If I run the tests from my host machine then WordPress root directory will be /Users/luca/Sites/wordpress, if I run the tests from within the Docker container then WordPress root folder will be /var/www/html.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Another example is Local by Flywheel:

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • in the host machine the path to the WordPress root folder will be /Users/luca/Local\ Sites/wordpress/app/public
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • from within the Docker container managed by Local the path will be /app/public
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      If you need a solution that will work in both instances use a relative path: wp-browser will accept paths like ./../../../wordpress and will attempt to resolve them.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      What is the path, relative to WordPress root URL, of the admin area of the test site?

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      This is usually /wp-admin but you might have the web-server, or a plugin, redirect or hide requests for the administration area to another path.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Some examples are /admin, /login and the like.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Mind that this is not the path to the login page but the path to the administrationo area; this will be used by wp-browser to find to the administration area in acceptance and functional tests.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      What is the name of the test database used by the test site?

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      In my example setup it's wordpress.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      This is the name of the database that is storing the information used by the site I can reach at http://localhost:8080.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      I want to underline the word "test". Any site and any database you use and expose to wp-browser should be intended for tests; this means that it does not contain any data you care about as it will be lost.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      What is the host of the test database used by the test site?

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      In my example setup it's 127.0.0.1:3306.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Here the same principle valid for Where is WordPress installed? applies: the database host is relative to the machine that is running the tests.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      In my example I'm hosting the database locally, on my laptop, and my machine can reach it at the localhost address (127.0.0.1) on MySQL default port (3306).

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      If I am using the database of a Local by Flywheel site from my host machine then it might be something like 192.168.92.100:4050 (from the site "Database" tab); the same principle applies if I am using a Vagrant-based or Docker-based solution.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      If I am running the tests from within a virtualized machine (a Docker container, a Vagrant box et cetera) then it would probably be localhost or 1270.0.0.1.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      This detail will be used in the context of acceptance and functional tests by the WPDb module.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      What is the user of the test database used by the test site?

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      In my example setup it's root as I'm using MySQL server root user to access the database during tests.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Depending on your setup it might be different; since wp-browser will need to not only read but write too to the database make sure to use a user that has full access to the database specified in the answer to the What is the host of the test database used by the test site? question.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      This detail will be used in the context of acceptance and functional tests by the WPDb module.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      What is the password of the test database used by the test site?

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      In my example setup it's empty as I've not set any password for the root account.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      In your case it might be different and it should be the password associated with the user specified in the answer to the What is the user of the test database used by the test site? question.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      This detail will be used in the context of acceptance and functional tests by the WPDb module.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      What is the table prefix of the test database used by the test site?

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      In my example setup it's wp_; that value is taken from the WordPress installation configuration file.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      To have any influence on the site wp-browser will need to modify the same database tables WordPress is using; as I did you can take this value from the wp-config.php file directly: it's the value of the $table_prefix variable.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      This detail will be used in the context of acceptance and functional tests by the WPDb module.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      What is the name of the test database WPLoader should use?

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      In my example setup it's tests.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      During integration, or WordPress "unit" tests, wp-loader will need to load WordPress code.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Since WordPress code is not meant to be "modular" it does not support auto-loading or loading just parts of it; it's either almost all or nothing.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      One of the first things WordPress does, when loading, is trying to connect to a database: if that database is not available then WordPress will not load.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      In the answer to the question Where is WordPress installed? I've told wp-browser where to find WordPress code, in this answer I'm telling wp-browser what database it should use to bootstrap WordPress.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      This detail will be used by the WPLoader module to bootstrap WordPress. +It's highly recommended to use a different database from the one used for functional and acceptance tests.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      What is the host of the test database WPLoader should use?

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      In my example setup it's 127.0.0.1:3306.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      As in the answer to the question What is the name of the test database WPLoader should use? we're providing connection details about the database that should be used to bootstrap WordPress during integration and WordPress "unit" tests.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Again the database host is in relation to the machine running the tests, all the considerations done for What is the host of the test database used by the test site? apply.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      This detail will be used by the WPLoader module to bootstrap WordPress.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      What is the user of the test database WPLoader should use?

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      In my example it's root.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Similar to the question What is the user of the test database used by the test site? but in relation to the database specified in the question What is the name of the test database WPLoader should use?.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      This detail will be used by the WPLoader module to bootstrap WordPress.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      What is the password of the test database WPLoader should use?

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      In my example setup it's empty as I've not set any password for the root account.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Similar to the question What is the password of the test database used by the test site? but in relation to the database specified in the question What is the name of the test database WPLoader should use?.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      This detail will be used by the WPLoader module to bootstrap WordPress.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      What is the table prefix of the test database WPLoader should use?

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      In my example setup it's wp_.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Similar to the question What is the table prefix of the test database used by the test site? but in relation to the database specified in the question What is the name of the test database WPLoader should use?.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      This detail will be used by the WPLoader module to bootstrap WordPress.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      What is the URL the test site?

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      In my example setup it's http://localhost:8080.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      This is the full URL you would have to enter in the browser, on the machine that is running the tests, to reach the test WordPress site homepage.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      What is the email of the test site WordPress administrator?

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      In my example setup it's admin@wp.localhost.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      This detail will be used by the WPLoader module to bootstrap WordPress and, while required, it's usually not relevant unless you're testing email communications.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      What is the title of the test site?

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      In my example setup it's Acme Plugin Test Site.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      This detail will be used by the WPLoader module to bootstrap WordPress and, while required, it's usually not relevant unless you're testing around the site title.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      What is the login of the administrator user of the test site?

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      In my example setup it's admin.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      This detail will be used by the WPBrowser or WPWebDriver modules to fill in the login details for the administrator user.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      It should be the same as the one that allows you to access the site administration area in the WordPress test site, http://localhost:8080/wp-admin in my example.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      What is the password of the administrator user of the test site?

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      In my example setup it's password.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      This detail will be used by the WPBrowser or WPWebDriver modules to fill in the login details for the administrator user.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      It should be the same as the one that allows you to access the site administration area in the WordPress test site, http://localhost:8080/wp-admin in my example.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Are you testing a plugin, a theme or a combination of both?

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Depending on the answer the WPLoader module will load, during integration or WordPress "unit" tests, your WordPress plugin or theme.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      If you replied with both (for "a combination of both") then you'll be able to choose the plugins and theme to load in integration and WordPress "unit" tests in the following questions.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      What is the folder/plugin.php name of the plugin?

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      This question will be asked only if you replied plugin to the question Are you testing a plugin, a theme or a combination of both?.
                                                                                                                                                                                                                                                                                                                                                                      +In my example setup it's acme-plugin/plugin.php.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      This is the <folder>/<main-plugin-file>.php path, relative to the WordPress installation plugins folder, to the plugin you are testing.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      The main plugin file is the one that contains the plugin header.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      This detail will be used by the WPLoader module to bootstrap WordPress and load your plugin or theme in integration and WordPress "unit" tests.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Are you developing a child theme?

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      This question will be asked only if you replied theme to the question Are you testing a plugin, a theme or a combination of both?.
                                                                                                                                                                                                                                                                                                                                                                      +Enter yes if you are developing a child theme.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      This detail will be used by the WPLoader module to bootstrap WordPress and load a parent theme along with your theme in integration and WordPress "unit" tests.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Please note that wp-browser will not download and install the parent theme in the WordPress installation for you.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Are you using a child theme?

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      This question will be asked only if you replied both to the question Are you testing a plugin, a theme or a combination of both?.
                                                                                                                                                                                                                                                                                                                                                                      +Enter yes if you are using a child theme.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      This detail will be used by the WPLoader module to bootstrap WordPress and load a parent theme along with your theme in integration and WordPress "unit" tests.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Please note that wp-browser will not download and install the parent theme in the WordPress installation for you.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      What is the slug of the parent theme?

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      This question will be asked only if you replied yes to the question Are you developing a child theme?.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Reply with the slug of the parent theme, that's usually the name of the folder the parent theme lives in, e.g. twentyseventeen.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      This detail will be used by the WPLoader module to bootstrap WordPress and load a parent theme along with your theme in integration and WordPress "unit" tests.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Please note that wp-browser will not download and install the parent theme in the WordPress installation for you.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      What is the slug of the theme?

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      This question will be asked only if you replied theme to the question Are you testing a plugin, a theme or a combination of both?.
                                                                                                                                                                                                                                                                                                                                                                      +Reply with the slug of the theme, that's usually the name of the folder the theme lives in, e.g. twentyseventeen.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      This detail will be used by the WPLoader module to bootstrap WordPress and load your theme in integration and WordPress "unit" tests.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      What is the slug of the theme you are using?

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      This question will be asked only if you replied both to the question Are you testing a plugin, a theme or a combination of both?.
                                                                                                                                                                                                                                                                                                                                                                      +Reply with the slug of the theme you are using, that's usually the name of the folder the theme lives in, e.g. twentyseventeen.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      This detail will be used by the WPLoader module to bootstrap WordPress and load the theme integration and WordPress "unit" tests.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Does your project needs additional plugins to be activated to work?

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Whether you're testing a plugin, a theme or a combination of both you might need some additional plugins to run your tests.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      As an example if I'm testing a WooCommerce extension I need the WooCommerce plugin to test it; this is the place where I can define it.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      The required plugins follow the same format as the one used in the question What is the folder/plugin.php name of the plugin?: <plugin-folder>/<plugin-main-file>.php; in the case of WooCommerce it would be woocommerce/woocommerce.php.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      This detail will be used by the WPLoader module to bootstrap WordPress and load the required plugins in integration and WordPress "unit" tests.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Please note that wp-browser will not download and install the required plugins in the WordPress installation for you.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      If you entered a wrong value

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      No worries, just correct the value in the environment file or in the suites configuration files.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      The environment file will have the name you specified in the answer the question How would you like to call the env configuration file?.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      The suites configuration files can be found in tests/<suite>.suite.yml; e.g. the wpunit suite configuration file will be tests/wpunit.suite.yml file.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Final steps

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      To complete the setup I have removed any demo content from the site and activated my plugin in the plugins administration page.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      In the tests/acceptance.suite.yml file and in the tests/functional.suite.yml file, the configuration file for the acceptance and functional suites respectively, the WPDb module configuration contains a dump configuration parameter:

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      class_name: AcceptanceTester
                                                                                                                                                                                                                                                                                                                                                                      +modules:
                                                                                                                                                                                                                                                                                                                                                                      +    enabled:
                                                                                                                                                                                                                                                                                                                                                                      +        - WPDb
                                                                                                                                                                                                                                                                                                                                                                      +    config:
                                                                                                                                                                                                                                                                                                                                                                      +        WPDb:
                                                                                                                                                                                                                                                                                                                                                                      +            dump: 'tests/_data/dump.sql'
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      The dump parameter is inherited by the WPDb module from the Codeception Db module and defines the SQL dump file that should be loaded before, and between, tests to reset the testing environment to a base known state.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      As for any other database-related operation wp-browser will not create the dump for me. +I use MySQL binary to export the database state (a dump) with the command:

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      mysqldump -u root -h 127.0.0.1 -P 3306 wordpress > /Users/luca/Sites/wordpress/wp-content/plugins/acme-plugin/tests/_data/dump.sql
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      I could use any other combination of tools to produce the dump; using mysql binary is not a requirement.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Graphic interfaces like SequelPro, Adminer and the like would be perfectly fine.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Pre-flight check

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      There is one last check I need to make before jumping into the creation of tests: making sure all the paths and credentials I've configured wp-browser with are correct.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      The bootstrap process generated four suites for me: acceptance, functional, integration and unit. If you have modified the default suite names during the setup your suites names might differ though.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      To test the setup I will run each suite and make sure it can run correctly empty of any test. To run a suite of tests I will use the codecept run command:

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      codecept run acceptance
                                                                                                                                                                                                                                                                                                                                                                      +codecept run functional
                                                                                                                                                                                                                                                                                                                                                                      +codecept run integration
                                                                                                                                                                                                                                                                                                                                                                      +codecept run unit
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      How comes I'm not using the command codecept run (without specifying the suite names)? See the FAQ entry.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Pre-flight check

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      If you cannot run all the suites without issues then check your configuration settings again, read the errors and see If you entered a wrong value

                                                                                                                                                                                                                                                                                                                                                                      + + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + + + + + \ No newline at end of file diff --git a/docs/v3/events-api/index.html b/docs/v3/events-api/index.html new file mode 100644 index 000000000..98a1eaa37 --- /dev/null +++ b/docs/v3/events-api/index.html @@ -0,0 +1,2251 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Events API - wp-browser docs + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      + + +
                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + + + +

                                                                                                                                                                                                                                                                                                                                                                      Events API

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      This is the documentation for version 3 of the project. +The current version is version 4 and the documentation can be found here.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Events API

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Codeception comes with a set of events modules and extensions can subscribe to.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Codeception Events API is, but, only available to Modules and Extensions, and while that might be good for most cases, it might not cover a number of edge cases.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Similarly to WordPress add_action function, wp-browser provides the tad\WPBrowser\addListener function:

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      function addListener($eventName, callable $listener, $priority = 0);
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      The priority works the reverse way as it does in WordPress: highest number will be processed first!

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Again similarly to WordPress do_action function, the tad\WPBrowser\dispatch function:

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      function dispatch($eventName, $origin = null, array $context = []);
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      This is the kind of API that is better shown with an example, though.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Example

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      In this example I'm writing acceptance tests and would like to avoid the performance hit that the cleanup configuration parameter of the Db, or WPDb, module implies.
                                                                                                                                                                                                                                                                                                                                                                      +The cleanup parameter will trigger the drop of all tables in the test database and the re-import of the SQL dump file, or files, between each test.
                                                                                                                                                                                                                                                                                                                                                                      +This will ensure a clean starting fixture between tests, but for larger setup fixtures this might be a long operation that wastes precious seconds when, say, the only change is the addition of 3 posts, as in this example.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      The Events API allows implementing a tailored clean-up procedure that can avoid costly clean ups between tests.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      In the suite bootstrap file, e.g. tests/acceptance/_bootstrap.php, I add a listener on the my-plugin-test/setup-posts event.
                                                                                                                                                                                                                                                                                                                                                                      +The event will contain information about what post IDs I've set up in the tests and will provide an instance of the tester object to handle database manipulation.
                                                                                                                                                                                                                                                                                                                                                                      +With that information, the costly cleanup procedure can be avoided.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      <?php
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +$registerPostsCleanup = static function (tad\WPBrowser\Events\WpbrowserEvent $event) {
                                                                                                                                                                                                                                                                                                                                                                      +    $ids = $event->get('ids', []);
                                                                                                                                                                                                                                                                                                                                                                      +    /** @var \EventsTester $db */
                                                                                                                                                                                                                                                                                                                                                                      +    $db = $event->get('db');
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +    // When tests are done, then remove all the posts we've created at the start of the test, if any.
                                                                                                                                                                                                                                                                                                                                                                      +    tad\WPBrowser\addListener(
                                                                                                                                                                                                                                                                                                                                                                      +        Codeception\Events::TEST_AFTER,
                                                                                                                                                                                                                                                                                                                                                                      +        static function () use ($ids, $db) {
                                                                                                                                                                                                                                                                                                                                                                      +            foreach ($ids as $id) {
                                                                                                                                                                                                                                                                                                                                                                      +                $db->dontHavePostInDatabase([ 'ID' => $id ], true);
                                                                                                                                                                                                                                                                                                                                                                      +                // Ensure the clean up did happen correctly.
                                                                                                                                                                                                                                                                                                                                                                      +                $db->dontSeePostInDatabase([ 'ID' => $id ]);
                                                                                                                                                                                                                                                                                                                                                                      +                $db->dontSeePostMetaInDatabase([ 'post_id' => $id ]);
                                                                                                                                                                                                                                                                                                                                                                      +            }
                                                                                                                                                                                                                                                                                                                                                                      +        }
                                                                                                                                                                                                                                                                                                                                                                      +    );
                                                                                                                                                                                                                                                                                                                                                                      +};
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +// Listen for this event to register the posts to remove, along with their custom fields, after the test.
                                                                                                                                                                                                                                                                                                                                                                      +tad\WPBrowser\addListener('test-event-1/setup-posts', $registerPostsCleanup);
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      In this simple test I'm adding 3 posts [using the factory provided by the WPLoader module in loadOnly mode][2] and want to make sure those, and the relative meta, are removed at the end of the tests. +The WPDb module, extending the Db module from Codeception, will remove the inserted rows, but will not take care of modified rows, or rows not inserted by the WPDb module.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Mirroring the requirement of the clean up function I've defined above, I'm passing the post IDs of the posts I've created and the current tester to provide the clean up function with database handling capabilities.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      <?php
                                                                                                                                                                                                                                                                                                                                                                      +/** @var Codeception\Scenario $scenario */
                                                                                                                                                                                                                                                                                                                                                                      +$I = new AcceptanceTester($scenario);
                                                                                                                                                                                                                                                                                                                                                                      +$I->wantTo('add posts and clean them up using the Events API');
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +/*
                                                                                                                                                                                                                                                                                                                                                                      + * Use WordPress methods, thanks to the `WPLoader` module, to use WordPress, or our own, API to insert posts.
                                                                                                                                                                                                                                                                                                                                                                      + * This will prevent, but, `WPDb` from removing the inserted rows and clean up, so we remove the posts and meta
                                                                                                                                                                                                                                                                                                                                                                      + * with an event and our custom clean-up function.
                                                                                                                                                                                                                                                                                                                                                                      + */
                                                                                                                                                                                                                                                                                                                                                                      +$ids = $I->factory()->post->create_many(3, [ 'post_type' => 'some_post_type' ]);
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +tad\WPBrowser\dispatch('test-event-1/setup-posts', __FILE__, [
                                                                                                                                                                                                                                                                                                                                                                      +    'ids' => $ids,
                                                                                                                                                                                                                                                                                                                                                                      +    'db'  => $I
                                                                                                                                                                                                                                                                                                                                                                      +]);
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + + + + + \ No newline at end of file diff --git a/docs/v3/extensions/index.html b/docs/v3/extensions/index.html new file mode 100644 index 000000000..f318394bc --- /dev/null +++ b/docs/v3/extensions/index.html @@ -0,0 +1,2367 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Extensions - wp-browser docs + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      + + +
                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      This is the documentation for version 3 of the project. +The current version is version 4 and the documentation can be found here.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Extensions

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      The Codeception testing framework can be extended in a number of ways.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      The one this project leverages the most are modules but [extensions are another way].

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Modules extend the functionality of Codeception in the context of the tests, while extensions extend its interaction capacities; this is by no means a strict rule but that's usually the case.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      The package contains two additional extensions to facilitate testers' life.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Symlinker

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      The tad\WPBrowser\Extension\Symlinker extension provides an automation to have the Codeception root directory symbolically linked in a WordPress local installation.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Since version 3.9 WordPress supports this feature (with some precautions) and the extension takes charge of:

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • symbolically linking a plugin or theme folder in the specified destination before any suite boots up
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • unlinking that symbolic link after all of the suites did run
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      It's the equivalent of doing something like this from the command line (on a Mac):

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      ln -s /my/central/plugin/folder/my-plugin /my/local/wordpress/installation/wp-content/plugins/my-plugin
                                                                                                                                                                                                                                                                                                                                                                      +/my/central/plugin/folder/my-plugin/vendor/bin/codecept run
                                                                                                                                                                                                                                                                                                                                                                      +rm -rf /my/local/wordpress/installation/wp-content/plugins/my-plugin
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      The extension needs small configuration in the codeception.yml file:

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      extensions:
                                                                                                                                                                                                                                                                                                                                                                      +    enabled:
                                                                                                                                                                                                                                                                                                                                                                      +        - tad\WPBrowser\Extension\Symlinker
                                                                                                                                                                                                                                                                                                                                                                      +    config:
                                                                                                                                                                                                                                                                                                                                                                      +        tad\WPBrowser\Extension\Symlinker:
                                                                                                                                                                                                                                                                                                                                                                      +            mode: plugin
                                                                                                                                                                                                                                                                                                                                                                      +            destination: /my/local/wordpress/installation/wp-content/plugins
                                                                                                                                                                                                                                                                                                                                                                      +            rootFolder: /some/plugin/folder
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      The arguments are:

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • mode - can be plugin or theme and indicates whether the current Codeception root folder being symlinked is a plugin or a theme one
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • destination - the absolute path to the WordPress local installation plugins or themes folder; to take the never ending variety of possible setups into account the extension will make no checks on the nature of the destination: could be any folder.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • rootFolder - optional absolute path to the WordPress plugin or theme to be symlinked root folder; will default to the Codeception root folder
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Copier

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      The tad\WPBrowser\Extension\Copier extension provides an automation to have specific files and folders copied to specified destination files and folders before the suites run.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      While WordPress handles symbolic linking pretty well there are some cases, like themes and drop-ins, where there is a need for "real" files to be put in place.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      One of such cases is, currently, one where Docker is used to to host and serve the code under test: symbolically linked files cannot be bound inside a container and Docker containers will fail to start in this case.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      The extension follows the standard Codeception extension activation and has one configuration parameter only:

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      extensions:
                                                                                                                                                                                                                                                                                                                                                                      +    enabled:
                                                                                                                                                                                                                                                                                                                                                                      +        - tad\WPBrowser\Extension\Copier
                                                                                                                                                                                                                                                                                                                                                                      +    config:
                                                                                                                                                                                                                                                                                                                                                                      +        tad\WPBrowser\Extension\Copier:
                                                                                                                                                                                                                                                                                                                                                                      +            files:
                                                                                                                                                                                                                                                                                                                                                                      +                tests/_data/required-drop-in.php: /var/www/wordpress/wp-content/drop-in.php
                                                                                                                                                                                                                                                                                                                                                                      +                tests/_data/themes/dummy: /var/www/wordpress/wp-content/themes/dummy
                                                                                                                                                                                                                                                                                                                                                                      +                /Users/Me/Repos/required-plugin: /var/www/wordpress/wp-content/plugins/required-plugin.php
                                                                                                                                                                                                                                                                                                                                                                      +                /Users/Me/Repos/mu-plugin.php: ../../../../wp-content/mu-plugins/mu-plugin.php
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      The extension will handle absolute and relative paths for sources and destinations and will resolve relative paths from the project root folder.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      When copying directories the extension will only create the destination folder and not the folder tree required; in the example configuration above the last entry specifies that a mu-plugin.php file should be copied to the mu-plugins folder: that mu-plugins folder must be there already.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Environments support

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Being able to symlink a plugin or theme folder into a WordPress installation for testing purposes could make sense when trying to test, as an example, a plugin in a single site and in multi site environment.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Codeception supports environments and the extension does as well specifying a destination for each.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      As an example the acceptance.suite.yml file might be configured to support single and multisite environments:

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      env:
                                                                                                                                                                                                                                                                                                                                                                      +    single:
                                                                                                                                                                                                                                                                                                                                                                      +        modules:
                                                                                                                                                                                                                                                                                                                                                                      +            config:
                                                                                                                                                                                                                                                                                                                                                                      +                WPBrowser:
                                                                                                                                                                                                                                                                                                                                                                      +                    url: 'http://wp.dev'
                                                                                                                                                                                                                                                                                                                                                                      +                WPDb:
                                                                                                                                                                                                                                                                                                                                                                      +                    dsn: 'mysql:host=127.0.0.1;dbname=wp'
                                                                                                                                                                                                                                                                                                                                                                      +    multisite:
                                                                                                                                                                                                                                                                                                                                                                      +        modules:
                                                                                                                                                                                                                                                                                                                                                                      +            config:
                                                                                                                                                                                                                                                                                                                                                                      +                WPBrowser:
                                                                                                                                                                                                                                                                                                                                                                      +                    url: 'http://mu.dev'
                                                                                                                                                                                                                                                                                                                                                                      +                WPDb:
                                                                                                                                                                                                                                                                                                                                                                      +                    dsn: 'mysql:host=127.0.0.1;dbname=mu'
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      In the codeception.yml file specifying a destination for each supported environment will tell the extension to symbolically link the plugin or theme file to different locations according to the current environment:

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      extensions:
                                                                                                                                                                                                                                                                                                                                                                      +    enabled:
                                                                                                                                                                                                                                                                                                                                                                      +        - tad\WPBrowser\Extension\Symlinker
                                                                                                                                                                                                                                                                                                                                                                      +    config:
                                                                                                                                                                                                                                                                                                                                                                      +        tad\WPBrowser\Extension\Symlinker:
                                                                                                                                                                                                                                                                                                                                                                      +            mode: plugin
                                                                                                                                                                                                                                                                                                                                                                      +            destination:
                                                                                                                                                                                                                                                                                                                                                                      +                single: /var/www/wp/wp-content/plugins
                                                                                                                                                                                                                                                                                                                                                                      +                multisite: /var/www/mu/wp-content/plugins
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      If no destination is specified for the current environment the extension will fallback to the first specified one.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      A default destination can be specified to override this behaviour.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      extensions:
                                                                                                                                                                                                                                                                                                                                                                      +    enabled:
                                                                                                                                                                                                                                                                                                                                                                      +        - tad\WPBrowser\Extension\Symlinker
                                                                                                                                                                                                                                                                                                                                                                      +    config:
                                                                                                                                                                                                                                                                                                                                                                      +        tad\WPBrowser\Extension\Symlinker:
                                                                                                                                                                                                                                                                                                                                                                      +            mode: plugin
                                                                                                                                                                                                                                                                                                                                                                      +            destination:
                                                                                                                                                                                                                                                                                                                                                                      +                default: /var/www/default/wp-content/plugins
                                                                                                                                                                                                                                                                                                                                                                      +                single: /var/www/wp/wp-content/plugins
                                                                                                                                                                                                                                                                                                                                                                      +                multisite: /var/www/mu/wp-content/plugins
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      When running a suite specifying more than one environment like

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      codecept run acceptance --env foo,baz,multisite
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Then the extension will use the first matched one, in the case above the multisite destination will be used.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      The rootFolder parameter too can be set to be environment-aware and it will follow the same logic as the destination:

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      extensions:
                                                                                                                                                                                                                                                                                                                                                                      +    enabled:
                                                                                                                                                                                                                                                                                                                                                                      +        - tad\WPBrowser\Extension\Symlinker
                                                                                                                                                                                                                                                                                                                                                                      +    config:
                                                                                                                                                                                                                                                                                                                                                                      +        tad\WPBrowser\Extension\Symlinker:
                                                                                                                                                                                                                                                                                                                                                                      +            mode: plugin
                                                                                                                                                                                                                                                                                                                                                                      +            rootFolder:
                                                                                                                                                                                                                                                                                                                                                                      +                dev: /
                                                                                                                                                                                                                                                                                                                                                                      +                dist: /dist
                                                                                                                                                                                                                                                                                                                                                                      +                default: /
                                                                                                                                                                                                                                                                                                                                                                      +            destination:
                                                                                                                                                                                                                                                                                                                                                                      +                default: /var/www/dev/wp-content/plugins
                                                                                                                                                                                                                                                                                                                                                                      +                dev: /var/www/dev/wp-content/plugins
                                                                                                                                                                                                                                                                                                                                                                      +                dist: /var/www/dist/wp-content/plugins
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      When running a suite specifying more than one environment like

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      codecept run acceptance --env dist
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Then the extension will symlink the files from /dist into the /var/www/dist/wp-content/plugins folder.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Events

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Due to some internal changes in Codeception 4.0, the internal API (really a collection of low-level hacks on my part) that allowed wp-browser to dispatch, and listen for, events in the modules has been removed.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      If you want to leverage [the event system wp-browser provides] with Codeception default events (e.g. suite.init or test.before), then you will need to use this extension.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      You will not need this extension if you're not using Codeception version 4.0.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      You will need to enable it in your Codeception main configuration file (e.g. codeception.dist.yml).

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      extensions:
                                                                                                                                                                                                                                                                                                                                                                      +    enabled:
                                                                                                                                                                                                                                                                                                                                                                      +        - tad\WPBrowser\Extension\Events
                                                                                                                                                                                                                                                                                                                                                                      +    config:
                                                                                                                                                                                                                                                                                                                                                                      +      tad\WPBrowser\Extension\Events:
                                                                                                                                                                                                                                                                                                                                                                      +        suites: ['acceptance']
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      The extension only configuration is the suites parameter that allows specifying the suites the extension should apply to.
                                                                                                                                                                                                                                                                                                                                                                      +If the suites parameter is not specified, then the extension will apply to all suites.

                                                                                                                                                                                                                                                                                                                                                                      + + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + + + + + \ No newline at end of file diff --git a/docs/v3/faq/index.html b/docs/v3/faq/index.html new file mode 100644 index 000000000..cb8f4eecd --- /dev/null +++ b/docs/v3/faq/index.html @@ -0,0 +1,2529 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Frequently asked questions - wp-browser docs + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      + + +
                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + + + +

                                                                                                                                                                                                                                                                                                                                                                      Frequently asked questions

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      This is the documentation for version 3 of the project. +The current version is version 4 and the documentation can be found here.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Some common questions

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      There are questions I keep receiving via email, GitHub or in person at conferences.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      I tried to address some of them here.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Is Codeception/wp-browser PHP 5.2 compatible?

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      No, Codeception, and wp-browser by extension, will require PHP 5.6 minimum.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      This does not mean your code cannot be PHP 5.2 compatible: you can test your code using all the possibilities of newer PHP versions and still keep it PHP 5.2 compatible.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Just because you can doesn't mean you should though: this documentation will assume a minimum PHP version, for the example and test code, of PHP 5.6.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Can I run unit tests with wp-browser/Codeception?

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Yes, with some distinctions.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      In the WordPress ecosystem there's a tendency to call any kind of test a "unit test". Under that definition will fall tests that are not "unit" tests at all.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Without drowning into a long and painful battle for definitions this guide will use the following definitions for different levels of testing.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      The next section will detail the conventions this documentation uses to define different levels of testing in more detail.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Isn't WordPress untestable?

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      No; it's sometimes difficult to test and not as straightforward as other PHP frameworks but it's definitely not untestable.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      You are writing code that runs on WordPress, not the Core code for WordPress so the question should really be: will you write testable code?

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      It's up to you to decide at what level you want to make your code testable and how much you want to test it.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Do I need to use a specific local development environment to use wp-browser?

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      No. I've started using wp-browser on a vanilla PHP built-in server to, then, move to MAMP (or XAMP) and, from there, to other solutions.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      I've configured and used wp-browser on Docker, Vagrant, VVV, Valet and various CI solutions.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      To this day I keep using different setups on different machines and personally prefer Docker for its portability.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Can I only test plugins with wp-browser?

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      No, you can test any kind of WordPress application.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      With "application" I mean any PHP software built on top of WordPress: plugins, themes, whole sites.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      If I'm testing a site do I have to use the default WordPress file structure?

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      No, you can use any file structure you want.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Some wp-browser modules will need a little help to find your code but, so far, I've never been unable to set it up.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Can I use wp-browser even if my WordPress application doesn't use Composer?

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Yes, although wp-browser, as a development tool, cannot be installed without Composer.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Should I use wp-browser to test my production servers?

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      No. Unless you know very well what you're doing that's a dangerous idea that might leave you with a broken site and an empty database.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      As almost any testing tool, wp-browser should be used locally on local installations of WordPress that do not contain any valuable information.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      How can I avoid the WPDb module from replacing the contents of my database?

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      You should always backup any database that contains any information you care about before running any test.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      You can read the answer to this question in the WPDb module documentation.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Can I run all my tests with one command?

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Theoretically: yes, in practice: no.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      When you use codecept run Codeception will run all the tests from all the suites.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      This, done in the context of other frameworks, will generally not create any problem but, in the context of WordPress it will.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      While handling a single HTTP request WordPress will set, and use, a number of constants and globals and, likewise, will do plugins and themes that follow WordPress standards.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      This means that the global context (variable scope) will be left "dirty" and contain "left-over" constants and globals from the previous tests.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      An example is one where a test for the handling of Ajax requests sets the DOING_AJAX constant: this will be now set for any test after the one that set it thus breaking, or worse altering, all the following ones.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      So, in short, run each suite separately.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Can I have more than one suite of one kind?

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Yes, you should.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      As an example you might have a frontend suite running acceptance tests on the site frontend and a backend suite running acceptance tests on the site backend.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Think of suites as a tool to organize your tests: there's a good measure between too organized and not organized at all.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      I've used PHPUnit before for my unit tests, can I reuse that knowledge and code with wp-browser?

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Yes.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Codeception uses PHPUnit as one of its main components and can run PHPUnit tests with little or no modification.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      As such you can just move your existing PHPUnit tests in a dedicated suite and be ready to run in minutes.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      I've already set up my tests to run using the Core PHPUnit-based test suite, can I keep using my tests?

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Yes.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Codeception uses PHPUnit as one of its main components and can run PHPUnit tests with little or no modification.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      One of the goals of wp-browser was to make it easier to test WordPress application at an integration level (or "WordPress unit" level).

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      As such migrating those tests could be a matter of minutes requiring no modification to the tests if not for moving some files and creating a dedicated suite.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Why is the project called wp-browser?

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      When I started working with Codeception to run my acceptance tests I kept creating steps that I would reuse over and over in my projects.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      I packed them in a module extending the PHPBrowser module.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Being a natural talent in naming things I've called the module WPBrowser and published it. As I started relying on Codeception more and more I kept adding modules but the name remained.

                                                                                                                                                                                                                                                                                                                                                                      + + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + + + + + \ No newline at end of file diff --git a/docs/public/v3/images/codecept-init-wpbrowser-01.png b/docs/v3/images/codecept-init-wpbrowser-01.png similarity index 100% rename from docs/public/v3/images/codecept-init-wpbrowser-01.png rename to docs/v3/images/codecept-init-wpbrowser-01.png diff --git a/docs/public/v3/images/codecept-init-wpbrowser-02.png b/docs/v3/images/codecept-init-wpbrowser-02.png similarity index 100% rename from docs/public/v3/images/codecept-init-wpbrowser-02.png rename to docs/v3/images/codecept-init-wpbrowser-02.png diff --git a/docs/public/v3/images/codecept-run.png b/docs/v3/images/codecept-run.png similarity index 100% rename from docs/public/v3/images/codecept-run.png rename to docs/v3/images/codecept-run.png diff --git a/docs/public/v3/images/initial-setup.png b/docs/v3/images/initial-setup.png similarity index 100% rename from docs/public/v3/images/initial-setup.png rename to docs/v3/images/initial-setup.png diff --git a/docs/v3/index.html b/docs/v3/index.html new file mode 100644 index 000000000..4985f32ba --- /dev/null +++ b/docs/v3/index.html @@ -0,0 +1,2085 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Welcome - wp-browser docs + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      + + +
                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + + + +

                                                                                                                                                                                                                                                                                                                                                                      Welcome

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      This is the documentation for version 3 of the project. +The current version is version 4 and the documentation can be found here.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      The wp-browser project provides a Codeception based solution to test WordPress plugins, themes and whole sites at all levels of testing.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      The purpose of this documentation is to help you set up, run and iterate over your project and test code using the powerful APIs provided by Codeception while trying to alleviate the pains of setting it up for WordPress projects.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Throughout the documentation you will find references to test terminology: I've tried to condense those into small, digestable chunks to provide a rough idea without and a limited context; where required I tried to provide links to dive deeper into the subjects.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Happy testing!

                                                                                                                                                                                                                                                                                                                                                                      + + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + + + + + \ No newline at end of file diff --git a/docs/v3/installation/index.html b/docs/v3/installation/index.html new file mode 100644 index 000000000..a055568df --- /dev/null +++ b/docs/v3/installation/index.html @@ -0,0 +1,2255 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Installation - wp-browser docs + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      + + +
                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + + + +

                                                                                                                                                                                                                                                                                                                                                                      Installation

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      This is the documentation for version 3 of the project. +The current version is version 4 and the documentation can be found here.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Installation

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Where should I install wp-browser?

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      As a rule-of-thumb wp-browser should be installed in the root folder of your +project.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      If your project is a plugin then it should be installed in the root folder of your plugin; if your project is a theme it should be installed in the root folder of your theme.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      If your project is a site I'd, personally install it in the site root folder.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      The purpose of installing wp-browser in the root folder of a project is to keep the code and its tests under version control together.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Exceptions apply but, for most projects, that's what I would do.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Initializing the Composer project

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Since Composer is a requirement of wp-browser and the only way to install it you should, first thing, initialize the Composer project.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      If you've already initialized the Composer project you can skip this section.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Once you've decided where to install wp-browser navigate to that folder using the terminal and type:

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      composer init
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Composer will take you through a number of questions to setup some meta information about your project.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Do not install any dependency yet when asked (unless you know what you're doing) and, as a suggestion, set wordpress-plugin as "Package Type".

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Also, since WordPress is licensed under the GPL-2.0+ you might want to set the "License" of your project to GPL-2.0-or-later.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Installing wp-browser as a development dependency

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Once you've initialized the Composer project it's time to require wp-browser ; you can read more about the usage of the require command on the Composer documentation.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      wp-browser is a testing tool and, as such, should be installed as a project development dependency, not as a normal (production) one.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      From the terminal type:

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      composer require --dev lucatume/wp-browser
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      This will install the latest stable version of wp-browser and, along with it, Codeception and PHPUnit in the vendor folder of your project.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Once that's done it's time to move to the setup and configuration of wp-browser.

                                                                                                                                                                                                                                                                                                                                                                      + + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + + + + + \ No newline at end of file diff --git a/docs/v3/levels-of-testing/index.html b/docs/v3/levels-of-testing/index.html new file mode 100644 index 000000000..890a03ff3 --- /dev/null +++ b/docs/v3/levels-of-testing/index.html @@ -0,0 +1,2525 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Levels of testing - wp-browser docs + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      + + +
                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + + + +

                                                                                                                                                                                                                                                                                                                                                                      Levels of testing

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      This is the documentation for version 3 of the project. +The current version is version 4 and the documentation can be found here.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      What is a unit test? An acceptance test?

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      This page has no pretense to be THE source of truth about what is called how in the context of tests; the purpose of this page is to lay out the terminology that I'll use in the documentation to define the levels and component of testing. Wikipedia, forums and other documents online will offer alternate, and equally valid, definitions.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      The signup page example

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Let's assume I'm testing a WordPress plugin that adds mailing list management and subscription functionalities to a site.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      The plugin provides a number of functions and, among them, it will add a sign-up page to receive users applications.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Acceptance tests

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      In brief: make assertions as a user would.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      The user might be tech-savvy as much as I want her to be but still make assertions only on what feedback the site provides.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      The code below tests a user can subscribe to the mailing list:

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      <?php
                                                                                                                                                                                                                                                                                                                                                                      +// UserSuccessfulSignupTest.php
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +// Add a page that contains the shortcode that will render the signup form.
                                                                                                                                                                                                                                                                                                                                                                      +$I->havePageInDatabase( [
                                                                                                                                                                                                                                                                                                                                                                      +    'post_name' => 'signup',
                                                                                                                                                                                                                                                                                                                                                                      +    'post_content'=> 'Sign-up for our awesome thing! [signup]',
                                                                                                                                                                                                                                                                                                                                                                      +] );
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +// Go to the page.
                                                                                                                                                                                                                                                                                                                                                                      +$I->amOnPage( '/signup' );
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +// Submit the form as a user would submit it. 
                                                                                                                                                                                                                                                                                                                                                                      +$I->submitForm( '#signup-form', [
                                                                                                                                                                                                                                                                                                                                                                      +  'name' => 'Luca',
                                                                                                                                                                                                                                                                                                                                                                      +  'email' => 'luca@theAverageDev.com',
                                                                                                                                                                                                                                                                                                                                                                      +] );
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +// Make sure I see a confirmation message. 
                                                                                                                                                                                                                                                                                                                                                                      +$I->waitForElement( '#signup-confirmation' );
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Functional tests

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      In brief: make assertions as a developer would.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      The test code below asserts front-end submissions are correctly processed from the developer perspective:

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      <?php
                                                                                                                                                                                                                                                                                                                                                                      +// file tests/functional/SignupSubmissionCest.php
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +class SignupSubmissionCest {
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +    public function _before( FunctionalTester $I ) {
                                                                                                                                                                                                                                                                                                                                                                      +        // Add a page that contains the shortcode that will render the signup form.
                                                                                                                                                                                                                                                                                                                                                                      +        $I->havePageInDatabase( [
                                                                                                                                                                                                                                                                                                                                                                      +            'post_name' => 'signup',
                                                                                                                                                                                                                                                                                                                                                                      +            'post_content'=> 'Sign-up for our awesome thing! [signup]',
                                                                                                                                                                                                                                                                                                                                                                      +        ] );
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +        $I->amOnPage( '/signup' );
                                                                                                                                                                                                                                                                                                                                                                      +    }
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +    public function test_good_signup( FunctionalTester $I ) {
                                                                                                                                                                                                                                                                                                                                                                      +        $I->sendAjaxPostRequest( '/wp-json/acme/v1/signup', [
                                                                                                                                                                                                                                                                                                                                                                      +          '_wpnonce' => $I->grabAttributeFrom( '#signup-nonce', 'value' ),
                                                                                                                                                                                                                                                                                                                                                                      +          'name' => 'Luca',
                                                                                                                                                                                                                                                                                                                                                                      +          'email' => 'luca@theAverageDev.com',
                                                                                                                                                                                                                                                                                                                                                                      +        ] );
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +        $I->seeResponseCodeIsSuccessful();
                                                                                                                                                                                                                                                                                                                                                                      +        $I->seeUserInDatabase( [ 'user_login' => 'luca', 'user_email' => 'luca@theaveragedev.com' ] );
                                                                                                                                                                                                                                                                                                                                                                      +    }
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +    public function test_bad_email_signup( FunctionalTester $I ) {
                                                                                                                                                                                                                                                                                                                                                                      +        $I->sendAjaxPostRequest( '/wp-json/acme/v1/signup', [
                                                                                                                                                                                                                                                                                                                                                                      +          '_wpnonce' => $I->grabAttributeFrom( '#signup-nonce', 'value' ),
                                                                                                                                                                                                                                                                                                                                                                      +          'name' => 'Luca',
                                                                                                                                                                                                                                                                                                                                                                      +          'email' => 'not-really-an-email',
                                                                                                                                                                                                                                                                                                                                                                      +        ] );
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +        $I->seeResponseCodeIs( 400 );
                                                                                                                                                                                                                                                                                                                                                                      +        $I->dontSeeUserInDatabase( [ 'user_login' => 'luca', 'user_email' => 'not-really-an-email' ] );
                                                                                                                                                                                                                                                                                                                                                                      +    }
                                                                                                                                                                                                                                                                                                                                                                      +}
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      The code looks, initially, like an acceptance test, but differs in its action and assertion phase: in place of filling a form and clicking "Submit" it sends a POST request to a REST API endpoint and checks the effect of the submission in the database.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      All of these actions fall squarely into what a developer would do, not into what a user could/should be able to do.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Furthermore, the format of the test is not the same as the one used in the acceptance test.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      The acceptance test is written in the most eloquent testing format supported by Codeception, the Cept format, this test uses a more PHPUnit-like format, the Cest format.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      While the first is easier to skim for non-developers the second harnesses the power of a re-using pieces of code, the page creation and navigation in the example, to optimize the test code.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Integration tests

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      In brief: test code modules in the context of a WordPress website.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      In this type of test the WordPress, and additional plugins code, is loaded in the same variable scope as the tests; this is why in the example below I'm using classes (WP_REST_Request, WP_REST_Response) and methods (register_rest_route) defined by WordPress, not the plugin code.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      The REST API request sent by the application form will be handled by a class, Acme\Signup\SubmissionHandler, that's been attached to the /wp-json/acme/v1/signup path:

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      <?php
                                                                                                                                                                                                                                                                                                                                                                      +// file src/rest.php
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +add_action( 'rest_api_init', function () {
                                                                                                                                                                                                                                                                                                                                                                      +    register_rest_route( 'acme/v1', '/signup', array(
                                                                                                                                                                                                                                                                                                                                                                      +        'methods' => 'POST',
                                                                                                                                                                                                                                                                                                                                                                      +        'callback' => function( WP_Rest_Request $request ) {
                                                                                                                                                                                                                                                                                                                                                                      +            $email_validator = new Acme\Signup\EmailValidator();
                                                                                                                                                                                                                                                                                                                                                                      +            $handler = new Acme\Signup\SubmissionHandler( $email_validator );
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +            return $handler->handle( $request );
                                                                                                                                                                                                                                                                                                                                                                      +        },
                                                                                                                                                                                                                                                                                                                                                                      +    ) );
                                                                                                                                                                                                                                                                                                                                                                      +} );
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      I want to test the chain of classes and methods that's handling such a request in the context of a WordPress installation.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Integration is usually about testing "modules" of code: groups of classes and functions working together to provide a service or complete a task.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      In the context of integration testing the class dependencies and/or the context are not mocked.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      <?php
                                                                                                                                                                                                                                                                                                                                                                      +// file tests/integration/SubmissionHandlingTest.php
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +class SubmissionHandlingTest extends \Codeception\TestCase\WPTestCase {
                                                                                                                                                                                                                                                                                                                                                                      +    public function test_good_request() {
                                                                                                                                                                                                                                                                                                                                                                      +        $request = new WP_Rest_Request();
                                                                                                                                                                                                                                                                                                                                                                      +        $request->set_body_params( [ 'name' => 'luca', 'email' => 'luca@theaveragedev.com' ] );
                                                                                                                                                                                                                                                                                                                                                                      +        $handler = new  Acme\Signup\SubmissionHandler();
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +        $response = $handler->handle( $request );
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +        $this->assertIntsanceOf( WP_REST_Response::class, $response );
                                                                                                                                                                                                                                                                                                                                                                      +        $this->assertEquals( 200, $response->get_status() );
                                                                                                                                                                                                                                                                                                                                                                      +        $this->assertInstanceOf( Acme\Signup\Submission_Good::class, $handler->last_submission() );
                                                                                                                                                                                                                                                                                                                                                                      +        $this->assertEquals( 'luca', $handler->last_submission()->name() );
                                                                                                                                                                                                                                                                                                                                                                      +        $this->assertEquals( 'luca@theaveragedev.com', $handler->last_submission()->email() );
                                                                                                                                                                                                                                                                                                                                                                      +    }
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +    public function test_bad_email_request() {
                                                                                                                                                                                                                                                                                                                                                                      +        $request = new WP_Rest_Request();
                                                                                                                                                                                                                                                                                                                                                                      +        $request->set_body_params( [ 'name' => 'luca', 'email' => 'not-a-valid-email' ] );
                                                                                                                                                                                                                                                                                                                                                                      +        $handler = new  Acme\Signup\SubmissionHandler();
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +        $response = $handler->handle( $request );
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +        $this->assertIntsanceOf( WP_REST_Response::class, $response );
                                                                                                                                                                                                                                                                                                                                                                      +        $this->assertEquals( 400, $response->get_status() );
                                                                                                                                                                                                                                                                                                                                                                      +        $this->assertInstanceOf( Acme\Signup\Submission_Bad::class, $handler->last_submission() );
                                                                                                                                                                                                                                                                                                                                                                      +        $this->assertEquals( 'luca', $handler->last_submission()->name() );
                                                                                                                                                                                                                                                                                                                                                                      +        $this->assertEquals( 'not-a-valid-email', $handler->last_submission()->email() );
                                                                                                                                                                                                                                                                                                                                                                      +    }
                                                                                                                                                                                                                                                                                                                                                                      +}
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      The test format used is the familiar PhpUnit one; the only difference is the base test class that's being extended (\Codeception\TestCase\WPTestCase) is one provided by wp-browser.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      In the context of WordPress "integration" might also mean testing that filters used by the code have the expected effect.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Unit tests

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      In brief: test single classes or functions in isolation.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      The email address is validated by the Acme\Signup\EmailValidator class.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      In the test code below I want to make sure the validation works as intended.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      <?php
                                                                                                                                                                                                                                                                                                                                                                      +// file tests/unit/EmailValidatorTest.php
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +class EmailValidatorTest extends Codeception\Test\Test {
                                                                                                                                                                                                                                                                                                                                                                      +    public function test_good_email_validation() {
                                                                                                                                                                                                                                                                                                                                                                      +        $validator = new Acme\Signup\EmailValidator();
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +        $this->assertTrue( $validator->validate( 'luca@theaveragedev.com' ) ); 
                                                                                                                                                                                                                                                                                                                                                                      +    }
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +    public function test_bad_email_validation(){
                                                                                                                                                                                                                                                                                                                                                                      +        $validator = new Acme\Signup\EmailValidator();
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +        $this->assertTrue( $validator->validate( 'not-an-email' ) );
                                                                                                                                                                                                                                                                                                                                                                      +    }
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +    public function test_tricky_email_validation() {
                                                                                                                                                                                                                                                                                                                                                                      +        $validator = new Acme\Signup\EmailValidator();
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +        $this->assertTrue( $validator->validate( 'luca+signup@theaveragedev.com' ) ); 
                                                                                                                                                                                                                                                                                                                                                                      +    }
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +    public function test_validation_with_service(){
                                                                                                                                                                                                                                                                                                                                                                      +        // Stub the validation service.
                                                                                                                                                                                                                                                                                                                                                                      +        $validation_service = $this->prophesize( Acme\Signup\ValidationService::class );
                                                                                                                                                                                                                                                                                                                                                                      +        $validation_service->validate( 'luca@theaveragedev.com' )->willReturn( true );
                                                                                                                                                                                                                                                                                                                                                                      +        $validation_service->validate( 'lucas@theaveragedev.com' )->willReturn( false );
                                                                                                                                                                                                                                                                                                                                                                      +        // Build the validator and set it to use the mock validation service.
                                                                                                                                                                                                                                                                                                                                                                      +        $validator = new Acme\Signup\EmailValidator();
                                                                                                                                                                                                                                                                                                                                                                      +        $validator->use_service( $validation_service->reveal() );
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +        $this->assertTrue( $validator->validate( 'luca@theaveragedev.com' ) );
                                                                                                                                                                                                                                                                                                                                                                      +        $this->assertFalse( $validator->validate( 'lucas@theaveragedev.com' ) );
                                                                                                                                                                                                                                                                                                                                                                      +    }
                                                                                                                                                                                                                                                                                                                                                                      +}
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Unit tests is where stubbing/mocking/spying of dependencies is used to gain total control over the input and context the class is using.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      In the last test method I'm doing exactly that testing the email validator with an external validation service.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      In the example I'm using the Prophecy mock engine that comes with PHPUnit along with its own mocking/stubbing/spying solutions.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      There are other mocking engines (e.g Mockery) that could be used.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      WordPress "unit" tests

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      In brief: test single classes or functions that require WordPress code in as much isolation as possible.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      This is what most people referring to "unit tests" in the context of WordPress is talking about.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      The purpose of this kind of tests is to test one class of a WordPress application, or one function, that requires a WordPress-defined function or class with a unit testing approach.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      In the example below I'm testing the Acme\Signup\SubmissionHandler class on a "unit" level making sure it will mark a request as bad if the email is not a valid one.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      <?php
                                                                                                                                                                                                                                                                                                                                                                      +// file tests/unit/SubmissionHandlerTest.php
                                                                                                                                                                                                                                                                                                                                                                      +class SubmissionHandlerTest extends Codeception\Test\Test {
                                                                                                                                                                                                                                                                                                                                                                      +    protected  $request;
                                                                                                                                                                                                                                                                                                                                                                      +    protected $validator;
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +    public function setUp() {
                                                                                                                                                                                                                                                                                                                                                                      +        // Mock the request.
                                                                                                                                                                                                                                                                                                                                                                      +        $this->request = $this->prophesize( WP_REST_Request::class );
                                                                                                                                                                                                                                                                                                                                                                      +        // Spy on the validator.
                                                                                                                                                                                                                                                                                                                                                                      +        $this->validator = $this->prophesize( Acme\Signup\EmailValidator::class );
                                                                                                                                                                                                                                                                                                                                                                      +    }
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +    public function test_email_is_validated_by_default() {
                                                                                                                                                                                                                                                                                                                                                                      +        $this->request->get_param( 'name' )->willReturn( 'luca' );
                                                                                                                                                                                                                                                                                                                                                                      +        $this->request->get_param( 'email' )->willReturn( 'luca@theaveragedev.com' );
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +        $handler = new Acme\Signup\SubmissionHandler( $this->validator->reveal() );
                                                                                                                                                                                                                                                                                                                                                                      +        $handler->set_validator( $this->validator );
                                                                                                                                                                                                                                                                                                                                                                      +        $response = $handler->handle( $this->request->reveal() );
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +        $this->assertInstanceOf( WP_REST_Response::class, $response );
                                                                                                                                                                                                                                                                                                                                                                      +        // Verify on the validator spy.
                                                                                                                                                                                                                                                                                                                                                                      +        $this->validator->validate( 'luca@theaveragedev.com' )->shouldHaveBeenCalled();
                                                                                                                                                                                                                                                                                                                                                                      +    }
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +    public function test_will_not_validate_email_if_missing() {
                                                                                                                                                                                                                                                                                                                                                                      +        $this->request->get_param( 'name' )->willReturn( 'luca' );
                                                                                                                                                                                                                                                                                                                                                                      +        $this->request->get_param( 'email' )->willReturn( '' );
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +        $handler = new Acme\Signup\SubmissionHandler( $this->validator->reveal() );
                                                                                                                                                                                                                                                                                                                                                                      +        $handler->set_validator( $this->validator );
                                                                                                                                                                                                                                                                                                                                                                      +        $response = $handler->handle( $this->request->reveal() );
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +        $this->assertInstanceOf( WP_REST_Response::class, $response );
                                                                                                                                                                                                                                                                                                                                                                      +        // Verify on the validator spy.
                                                                                                                                                                                                                                                                                                                                                                      +        $this->validator->validate( Argument::any() )->shouldNotHaveBeenCalled();
                                                                                                                                                                                                                                                                                                                                                                      +    }
                                                                                                                                                                                                                                                                                                                                                                      +}
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      The class uses the WP_REST_Request and WP_Rest_Response classes as input and output and will probably, internally, use more functions defined by WordPress.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      One solution to avoid loading WordPress, could be to rewrite test versions of each and all the WordPress functions and classes needed by all the classes I want to unit test; this would require updating each time the classes requirements change.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Furthermore internationalization (e.g. __()) and filtering (e.g apply_filters) functions would not need to be mocked if not in specific cases and would pretty much be copy and paste versions of the WordPres ones.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Loading single pieces of WordPress is a dangerous and brittle endeavour and it's not supported by the +framework.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      To avoid all this WordPress "unit tests" pay the price of having to bootstrap WordPress, thus requiring a database connection.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      This kind of test setup and level is the one you can see in the PHPUnit Core suite of WordPress itself.

                                                                                                                                                                                                                                                                                                                                                                      + + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + + + + + \ No newline at end of file diff --git a/docs/v3/migration/from-version-2-to-version-3/index.html b/docs/v3/migration/from-version-2-to-version-3/index.html new file mode 100644 index 000000000..4687ae641 --- /dev/null +++ b/docs/v3/migration/from-version-2-to-version-3/index.html @@ -0,0 +1,2170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Version 2 to version 3 - wp-browser docs + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      + + +
                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + + + +

                                                                                                                                                                                                                                                                                                                                                                      Version 2 to version 3

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      This is the documentation for version 3 of the project. +The current version is version 4 and the documentation can be found here.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Migrating projects from version 2 of wp-browser to version 3

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Version 3 of wp-browser removed, to allow for broader compatibility with PHP and Composer versions, some of its +dependencies and modified some of its methods.
                                                                                                                                                                                                                                                                                                                                                                      +Here is a list of changes and the suggested courses of action:

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • Removed symfony/process to launch and manage external processes; re-add it your project development +requirements using composer require --dev symfony/process.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • Removed the wp-cli/wp-cli-bundle dependency; if you were relying on non-core + packages, then re-add it to your project development requirements using composer require --dev wp-cli/wp-cli-bundle.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • Removed the WithWpCli::executeBackgroundWpCliCommand trait method, and, as a consequence, the +WPCLI::executeBackgroundWpCliCommand module method; you could have used the latter, if this was the case, then +require the symfony/process as explained above and launch processes in background using its API; find out more.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • Refactored the WPCLI module to build and escape string command lines differently; the handling of command-line arguments +for the WPCLI module has been modified to make it a bit more consistent and robust; as a consequence, you might experience +some breakages in string commands that used to work correctly before; should this be the case then either modify +your code to provide the command in array format (taking care of the correct escaping in your code), or make sure to +pass a correctly structured command string to the WPCLI module.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + + + + + \ No newline at end of file diff --git a/docs/v3/modules/WPBrowser/index.html b/docs/v3/modules/WPBrowser/index.html new file mode 100644 index 000000000..38992fe8d --- /dev/null +++ b/docs/v3/modules/WPBrowser/index.html @@ -0,0 +1,2598 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + WPBrowser - wp-browser docs + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      + + +
                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      This is the documentation for version 3 of the project. +The current version is version 4 and the documentation can be found here.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      WPBrowser module

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      This module should be used in acceptance and functional tests, see levels of testing for more information.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      This module extends the PHPBrowser module adding WordPress-specific configuration parameters and methods.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      The module simulates a user interaction with the site without Javascript support; if you need to test your project with Javascript support use the WPWebDriver module.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Module requirements for Codeception 4.0+

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      This module requires the codeception/module-phpbrowser Composer package to work when wp-browser is used with Codeception 4.0.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      To install the package run:

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      composer require --dev codeception/module-phpbrowser:^1.0
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Configuration

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Since this module extends the PHPBrowser module provided by Codeception, please refer to the PHPBrowser configuration section for more information about the base configuration parameters.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • url required - Start URL of your WordPress project, e.g. http://wp.test.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • headers - Default headers are set before each test; this might be useful to simulate a specific user agent during the tests or to identify the request source. Note that the headers defined in the config should be prefaced with HTTP_ in your wp-config.php file. This can be used to select which database to use.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • handler (default: curl) - The Guzzle handler to use. By default curl is used, also possible to pass stream, or any valid class name as Handler.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • middleware - The Guzzle middlewares to add. An array of valid callables is required; see here for more information.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • curl - curl options; only applied if using the curl handler; more options are available.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • adminUsername required - This is the login name, not the "nice" name, of the administrator user of the WordPress test site. This will be used to fill the username field in WordPress login page.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • adminPassword required - This is the the password of the administrator use of the WordPress test site. This will be used to fill the password in WordPress login page.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • adminPath required - The path, relative to the WordPress test site home URL, to the administration area, usually /wp-admin.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Example configuration

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        modules:
                                                                                                                                                                                                                                                                                                                                                                      +      enabled:
                                                                                                                                                                                                                                                                                                                                                                      +          - WPBrowser
                                                                                                                                                                                                                                                                                                                                                                      +      config:
                                                                                                                                                                                                                                                                                                                                                                      +          WPBrowser:
                                                                                                                                                                                                                                                                                                                                                                      +              url: 'http://wordpress.localhost'
                                                                                                                                                                                                                                                                                                                                                                      +              adminUsername: 'admin'
                                                                                                                                                                                                                                                                                                                                                                      +              adminPassword: 'password'
                                                                                                                                                                                                                                                                                                                                                                      +              adminPath: '/wp-admin'
                                                                                                                                                                                                                                                                                                                                                                      +              headers:
                                                                                                                                                                                                                                                                                                                                                                      +                X_TEST_REQUEST: 1
                                                                                                                                                                                                                                                                                                                                                                      +                X_WPBROWSER_REQUEST: 1
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Read here how to use the headers information to automatically change the database during acceptance and functional tests.

                                                                                                                                                                                                                                                                                                                                                                      + + +

                                                                                                                                                                                                                                                                                                                                                                      Public API

                                                                                                                                                                                                                                                                                                                                                                      + + +

                                                                                                                                                                                                                                                                                                                                                                      activatePlugin

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      In the plugin administration screen activates a plugin clicking the "Activate" link. The method will not handle authentication to the admin area.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      // Activate a plugin.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->loginAsAdmin();
                                                                                                                                                                                                                                                                                                                                                                      +  $I->amOnPluginsPage();
                                                                                                                                                                                                                                                                                                                                                                      +  $I->activatePlugin('hello-dolly');
                                                                                                                                                                                                                                                                                                                                                                      +  // Activate a list of plugins.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->loginAsAdmin();
                                                                                                                                                                                                                                                                                                                                                                      +  $I->amOnPluginsPage();
                                                                                                                                                                                                                                                                                                                                                                      +  $I->activatePlugin(['hello-dolly','another-plugin']);
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string/\Codeception\Module\array $pluginSlug - The plugin slug, like "hello-dolly" or a list of plugin slugs.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      amEditingPostWithId

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Go to the admin page to edit the post with the specified ID. The method will not handle authentication the admin area.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $I->loginAsAdmin();
                                                                                                                                                                                                                                                                                                                                                                      +  $postId = $I->havePostInDatabase();
                                                                                                                                                                                                                                                                                                                                                                      +  $I->amEditingPostWithId($postId);
                                                                                                                                                                                                                                                                                                                                                                      +  $I->fillField('post_title', 'Post title');
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • int $id - The post ID.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      amOnAdminAjaxPage

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Go to the admin-ajax.php page to start a synchronous, and blocking, GET AJAX request. The method will not handle authentication, nonces or authorization.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $I->amOnAdminAjaxPage(['action' => 'my-action', 'data' => ['id' => 23], 'nonce' => $nonce]);
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string/\Codeception\Module\array $queryVars - A string or array of query variables to append to the AJAX path.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      amOnAdminPage

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Go to a page in the admininstration area of the site. This method will not handle authentication to the administration area.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $I->loginAs('user', 'password');
                                                                                                                                                                                                                                                                                                                                                                      +  // Go to the plugins management screen.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->amOnAdminPage('/plugins.php');
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string $page - The path, relative to the admin area URL, to the page.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      amOnCronPage

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Go to the cron page to start a synchronous, and blocking, GET request to the cron script.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      // Triggers the cron job with an optional query argument.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->amOnCronPage('/?some-query-var=some-value');
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string/\Codeception\Module\array $queryVars - A string or array of query variables to append to the AJAX path.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      amOnPagesPage

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Go the "Pages" administration screen. The method will not handle authentication.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $I->loginAsAdmin();
                                                                                                                                                                                                                                                                                                                                                                      +  $I->amOnPagesPage();
                                                                                                                                                                                                                                                                                                                                                                      +  $I->see('Add New');
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      amOnPluginsPage

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Go to the plugins administration screen. The method will not handle authentication.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $I->loginAsAdmin();
                                                                                                                                                                                                                                                                                                                                                                      +  $I->amOnPluginsPage();
                                                                                                                                                                                                                                                                                                                                                                      +  $I->activatePlugin('hello-dolly');
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      deactivatePlugin

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      In the plugin administration screen deactivate a plugin clicking the "Deactivate" link. The method will not handle authentication and navigation to the plugins administration page.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      // Deactivate one plugin.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->loginAsAdmin();
                                                                                                                                                                                                                                                                                                                                                                      +  $I->amOnPluginsPage();
                                                                                                                                                                                                                                                                                                                                                                      +  $I->deactivatePlugin('hello-dolly');
                                                                                                                                                                                                                                                                                                                                                                      +  // Deactivate a list of plugins.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->loginAsAdmin();
                                                                                                                                                                                                                                                                                                                                                                      +  $I->amOnPluginsPage();
                                                                                                                                                                                                                                                                                                                                                                      +  $I->deactivatePlugin(['hello-dolly', 'my-plugin']);
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string/\Codeception\Module\array $pluginSlug - The plugin slug, like "hello-dolly", or a list of plugin slugs.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      dontSeePluginInstalled

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Assert a plugin is not installed in the plugins administration screen. The method will not handle authentication and navigation to the plugin administration screen.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $I->loginAsAdmin();
                                                                                                                                                                                                                                                                                                                                                                      +  $I->amOnPluginsPage();
                                                                                                                                                                                                                                                                                                                                                                      +  $I->dontSeePluginInstalled('my-plugin');
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string $pluginSlug - The plugin slug, like "hello-dolly".
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      grabCookiesWithPattern

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Returns all the cookies whose name matches a regex pattern.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $I->loginAs('customer','password');
                                                                                                                                                                                                                                                                                                                                                                      +  $I->amOnPage('/shop');
                                                                                                                                                                                                                                                                                                                                                                      +  $cartCookies = $I->grabCookiesWithPattern("#^shop_cart\\.*#");
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string $cookiePattern - The regular expression pattern to use for the matching.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      grabWordPressTestCookie

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Returns WordPress default test cookie object if present.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      // Grab the default WordPress test cookie.
                                                                                                                                                                                                                                                                                                                                                                      +  $wpTestCookie = $I->grabWordPressTestCookie();
                                                                                                                                                                                                                                                                                                                                                                      +  // Grab a customized version of the test cookie.
                                                                                                                                                                                                                                                                                                                                                                      +  $myTestCookie = $I->grabWordPressTestCookie('my_test_cookie');
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string $name - Optional, overrides the default cookie name.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      logOut

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Navigate to the default WordPress logout page and click the logout link.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      // Log out using the `wp-login.php` form and return to the current page.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->logOut(true);
                                                                                                                                                                                                                                                                                                                                                                      +  // Log out using the `wp-login.php` form and remain there.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->logOut(false);
                                                                                                                                                                                                                                                                                                                                                                      +  // Log out using the `wp-login.php` form and move to another page.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->logOut('/some-other-page');
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • bool/bool/string $redirectTo - Whether to redirect to another (optionally specified) page after the logout.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      loginAs

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Login as the specified user. The method will not follow redirection, after the login, to any page.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $I->loginAs('user', 'password');
                                                                                                                                                                                                                                                                                                                                                                      +  $I->amOnAdminPage('/');
                                                                                                                                                                                                                                                                                                                                                                      +  $I->see('Dashboard');
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string $username - The user login name.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • string $password - The user password in plain text.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      loginAsAdmin

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Login as the administrator user using the credentials specified in the module configuration. The method will not follow redirection, after the login, to any page.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $I->loginAsAdmin();
                                                                                                                                                                                                                                                                                                                                                                      +  $I->amOnAdminPage('/');
                                                                                                                                                                                                                                                                                                                                                                      +  $I->see('Dashboard');
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      seeErrorMessage

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      In an administration screen look for an error admin notice. The check is class-based to decouple from internationalization. The method will not handle authentication and navigation the administration area. .notice.notice-error ones.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $I->loginAsAdmin()
                                                                                                                                                                                                                                                                                                                                                                      +  $I->amOnAdminPage('/');
                                                                                                                                                                                                                                                                                                                                                                      +  $I->seeErrorMessage('.my-plugin');
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string/string/\Codeception\Module\array $classes - A list of classes the notice should have other than the
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      seeMessage

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      In an administration screen look for an admin notice. The check is class-based to decouple from internationalization. The method will not handle authentication and navigation the administration area.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $I->loginAsAdmin()
                                                                                                                                                                                                                                                                                                                                                                      +  $I->amOnAdminPage('/');
                                                                                                                                                                                                                                                                                                                                                                      +  $I->seeMessage('.missing-api-token.my-plugin');
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string/\Codeception\Module\array/string $classes - A list of classes the message should have in addition to the .notice one.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      seePluginActivated

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Assert a plugin is activated in the plugin administration screen. The method will not handle authentication and navigation to the plugin administration screen.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $I->loginAsAdmin();
                                                                                                                                                                                                                                                                                                                                                                      +  $I->amOnPluginsPage();
                                                                                                                                                                                                                                                                                                                                                                      +  $I->seePluginActivated('my-plugin');
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string $pluginSlug - The plugin slug, like "hello-dolly".
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      seePluginDeactivated

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Assert a plugin is not activated in the plugins administration screen. The method will not handle authentication and navigation to the plugin administration screen.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $I->loginAsAdmin();
                                                                                                                                                                                                                                                                                                                                                                      +  $I->amOnPluginsPage();
                                                                                                                                                                                                                                                                                                                                                                      +  $I->seePluginDeactivated('my-plugin');
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string $pluginSlug - The plugin slug, like "hello-dolly".
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      seePluginInstalled

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Assert a plugin is installed, no matter its activation status, in the plugin administration screen. The method will not handle authentication and navigation to the plugin administration screen.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $I->loginAsAdmin();
                                                                                                                                                                                                                                                                                                                                                                      +  $I->amOnPluginsPage();
                                                                                                                                                                                                                                                                                                                                                                      +  $I->seePluginInstalled('my-plugin');
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string $pluginSlug - The plugin slug, like "hello-dolly".
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      seeWpDiePage

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Checks that the current page is one generated by the wp_die function. The method will try to identify the page based on the default WordPress die page HTML attributes.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $I->loginAs('user', 'password');
                                                                                                                                                                                                                                                                                                                                                                      +  $I->amOnAdminPage('/forbidden');
                                                                                                                                                                                                                                                                                                                                                                      +  $I->seeWpDiePage();
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      This class extends \Codeception\Module\PhpBrowser

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      This class implements \Codeception\Lib\Interfaces\MultiSession, \Codeception\Lib\Interfaces\Remote, \Codeception\Lib\Interfaces\Web, \Codeception\Lib\Interfaces\PageSourceSaver, \Codeception\Lib\Interfaces\ElementLocator, \Codeception\Lib\Interfaces\ConflictsWithModule

                                                                                                                                                                                                                                                                                                                                                                      + + + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + + + + + \ No newline at end of file diff --git a/docs/v3/modules/WPCLI/index.html b/docs/v3/modules/WPCLI/index.html new file mode 100644 index 000000000..3beb1f47d --- /dev/null +++ b/docs/v3/modules/WPCLI/index.html @@ -0,0 +1,2557 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + WPCLI - wp-browser docs + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      + + +
                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      This is the documentation for version 3 of the project. +The current version is version 4 and the documentation can be found here.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      WPCLI module

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      This module should be used in acceptance and functional tests to setup, or verify, tests pre and post conditions using WP-CLI commands.
                                                                                                                                                                                                                                                                                                                                                                      +This module allows invoking WP-CLI commands, refer to the official site for more information.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      The module will use its own version of WP-CLI, not the one installed in the machine running the tests!

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      By default, wp-browser will only include the wp-cli/wp-cli package; this package contains the basic files to run WP-CLI and does not contain all the commands that come with a typical wp-cli installation.
                                                                                                                                                                                                                                                                                                                                                                      +If, in your tests, you require all the commands that usually come installed with WP-CLI, then you should require the wp-cli/wp-cli-bundle package as a development dependency of your project, see below.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Fixing "not a registered command" issue

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      To keep the conflicts at a manageable level, the wp-browser project does not include all the commands WP-CLI usually comes bundled with.
                                                                                                                                                                                                                                                                                                                                                                      +Running, in the context of an automated test, a WP-CLI command that would work on your machine, e.g. wp plugin list --status=active, will not work on a default installation of wp-browser and you will get the following error message:

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      [ModuleException] WPCLI: wp-cli terminated with status [1] and output [Error: 'plugin' is not a registered wp command. See 'wp help' for available commands.]
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      To resolve the message just add the package you require as a development dependency or add the whole WP-CLI bundle:

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      composer require --dev wp-cli/wp-cli-bundle
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      The package will make all the default WP-CLI commands available to the WP-CLI version used in tests.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Module requirements for Codeception 4.0+

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      This module requires the codeception/module-cli Composer package to work when wp-browser is used with Codeception 4.0.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      To install the package run:

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      composer require --dev codeception/module-cli:^1.0
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Detecting requests coming from this module

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      When it runs this module will set the WPBROWSER_HOST_REQUEST environment variable.
                                                                                                                                                                                                                                                                                                                                                                      +You can detect and use that information to, as an example, use the correct database in your test site wp-config.php file: +

                                                                                                                                                                                                                                                                                                                                                                      <?php
                                                                                                                                                                                                                                                                                                                                                                      +if ( 
                                                                                                                                                                                                                                                                                                                                                                      +    // Custom header.
                                                                                                                                                                                                                                                                                                                                                                      +    isset( $_SERVER['HTTP_X_TESTING'] )
                                                                                                                                                                                                                                                                                                                                                                      +    // Custom user agent.
                                                                                                                                                                                                                                                                                                                                                                      +    || ( isset( $_SERVER['HTTP_USER_AGENT'] ) && $_SERVER['HTTP_USER_AGENT'] === 'wp-browser' )
                                                                                                                                                                                                                                                                                                                                                                      +    // The env var set by the WPClIr or WordPress modules.
                                                                                                                                                                                                                                                                                                                                                                      +    || getenv( 'WPBROWSER_HOST_REQUEST' )
                                                                                                                                                                                                                                                                                                                                                                      +) {
                                                                                                                                                                                                                                                                                                                                                                      +    // Use the test database if the request comes from a test.
                                                                                                                                                                                                                                                                                                                                                                      +    define( 'DB_NAME', 'wordpress_test' );
                                                                                                                                                                                                                                                                                                                                                                      +} else {
                                                                                                                                                                                                                                                                                                                                                                      +    // Else use the default one.
                                                                                                                                                                                                                                                                                                                                                                      +    define( 'DB_NAME', 'wordpress' );
                                                                                                                                                                                                                                                                                                                                                                      +}
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Configuration

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • path required - the absolute, or relative, path to the WordPress root folder. This will be mapped to the --path argument of the wp-cli binary.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • throw - defaults to true to throw an exception when a wp-cli command does not return an exit status of 0; if set to false then the exit status of the commands will be returned as is.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • timeout - defaults to 60 (seconds) to set each process execution timeout to a certain value; set to null, false or 0 to disable timeout completely.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Additionally the module configuration will forward any configuration parameter to wp-cli as a flag or option. +In the example configuration below the allow-root flag and the some-option option will be passed to wp-cli directly and prepended to the command as global options.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Note: these extract configuration flags and options will be prepended to all commands executed by wp-cli!

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Environment configuration

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      The wp-cli binary supports a set of environment variables to modify its behavior.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      These environment variables can be set on the commands ran by the WPCLI module using the optional env array in the module configuration.
                                                                                                                                                                                                                                                                                                                                                                      +The example configuration below shows all of them with some example values.
                                                                                                                                                                                                                                                                                                                                                                      +Most of the times you won't need any of these, but they are there for more fine-grained control over the module operations.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      The module is not validating the environment variables in any way! Those values will be evaluated by wp-cli at runtime and might generate errors if not correctly configured.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Example configuration

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      modules:
                                                                                                                                                                                                                                                                                                                                                                      +    enabled:
                                                                                                                                                                                                                                                                                                                                                                      +        - WPCLI
                                                                                                                                                                                                                                                                                                                                                                      +    config:
                                                                                                                                                                                                                                                                                                                                                                      +        WPCLI:
                                                                                                                                                                                                                                                                                                                                                                      +            path: /Users/Luca/Sites/wp
                                                                                                                                                                                                                                                                                                                                                                      +            throw: true
                                                                                                                                                                                                                                                                                                                                                                      +            timeout: 60
                                                                                                                                                                                                                                                                                                                                                                      +            # This will be prepended to the command, `wp --allow-root <command>`.
                                                                                                                                                                                                                                                                                                                                                                      +            allow-root: true
                                                                                                                                                                                                                                                                                                                                                                      +            # This will be prepended to the command, `wp --some-option=some-value <command>`.
                                                                                                                                                                                                                                                                                                                                                                      +            some-option: some-value
                                                                                                                                                                                                                                                                                                                                                                      +            env:
                                                                                                                                                                                                                                                                                                                                                                      +                # Any one of these, if provided, will be set as environment variable for the the cli command process. 
                                                                                                                                                                                                                                                                                                                                                                      +                # See https://make.wordpress.org/cli/handbook/config/#environment-variables for information.
                                                                                                                                                                                                                                                                                                                                                                      +                # Equivalent to `WP_CLI_STRICT_ARGS_MODE=1 wp <command>'.
                                                                                                                                                                                                                                                                                                                                                                      +                strict-args: true
                                                                                                                                                                                                                                                                                                                                                                      +                # Equivalent to `WP_CLI_CACHE_DIR=/tmp/wp-cli-cache wp <command>'.
                                                                                                                                                                                                                                                                                                                                                                      +                cache-dir: '/tmp/wp-cli-cache'
                                                                                                                                                                                                                                                                                                                                                                      +                # Equivalent to `WP_CLI_CONFIG_PATH=/app/public wp <command>'.
                                                                                                                                                                                                                                                                                                                                                                      +                config-path: '/app/public'
                                                                                                                                                                                                                                                                                                                                                                      +                # Equivalent to `WP_CLI_CUSTOM_SHELL=/bin/zsh wp <command>'.
                                                                                                                                                                                                                                                                                                                                                                      +                custom-shell: '/bin/zsh'
                                                                                                                                                                                                                                                                                                                                                                      +                # Equivalent to `WP_CLI_DISABLE_AUTO_CHECK_UPDATE=1 wp <command>'.
                                                                                                                                                                                                                                                                                                                                                                      +                disable-auto-update: true
                                                                                                                                                                                                                                                                                                                                                                      +                # Equivalent to `WP_CLI_PACKAGES_DIR=/wp-cli/packages wp <command>'.
                                                                                                                                                                                                                                                                                                                                                                      +                packages-dir: '/wp-cli/packages'
                                                                                                                                                                                                                                                                                                                                                                      +                # Equivalent to `WP_CLI_PHP=/usr/local/bin/php/7.2/php wp <command>'.
                                                                                                                                                                                                                                                                                                                                                                      +                php: '/usr/local/bin/php/7.2/php'
                                                                                                                                                                                                                                                                                                                                                                      +                # Equivalent to `WP_CLI_PHP_ARGS='foo=bar some=23' wp <command>'.
                                                                                                                                                                                                                                                                                                                                                                      +                php-args: 'foo=bar some=23'
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + +

                                                                                                                                                                                                                                                                                                                                                                      Public API

                                                                                                                                                                                                                                                                                                                                                                      + + +

                                                                                                                                                                                                                                                                                                                                                                      buildFullCommand

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Builds the full command to run including the PHP binary and the wp-cli boot file path.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      // This method is defined in the WithWpCli trait.
                                                                                                                                                                                                                                                                                                                                                                      +  // Set the wp-cli path, `$this` is a test case.
                                                                                                                                                                                                                                                                                                                                                                      +  $this->setUpWpCli( '/var/www/html' );
                                                                                                                                                                                                                                                                                                                                                                      +  // Builds the full wp-cli command, including the `path` variable.
                                                                                                                                                                                                                                                                                                                                                                      +  $fullCommand =  $this->buildFullCommand(['core', 'version']);
                                                                                                                                                                                                                                                                                                                                                                      +  // The full command can then be used to run it with another process handler.
                                                                                                                                                                                                                                                                                                                                                                      +  $wpCliProcess = new Process($fullCommand);
                                                                                                                                                                                                                                                                                                                                                                      +  $wpCliProcess->run();
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • \Codeception\Module\array/string $command - The command to run.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      cli

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Executes a wp-cli command targeting the test WordPress installation. minus wp. For back-compatibility purposes you can still pass the commandline as a string, but the array format is the preferred and supported method.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      // Activate a plugin via wp-cli in the test WordPress site.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->cli(['plugin', 'activate', 'my-plugin']);
                                                                                                                                                                                                                                                                                                                                                                      +  // Change a user password.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->cli(['user', 'update', 'luca', '--user_pass=newpassword']);
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string/string/\Codeception\Module\array $userCommand - The string of command and parameters as it would be passed to wp-cli
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      cliToArray

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Returns the output of a wp-cli command as an array optionally allowing a callback to process the output. minus wp. For back-compatibility purposes you can still pass the commandline as a string, but the array format is the preferred and supported method.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      // Return a list of inactive themes, like ['twentyfourteen', 'twentyfifteen'].
                                                                                                                                                                                                                                                                                                                                                                      +  $inactiveThemes = $I->cliToArray(['theme', 'list', '--status=inactive', '--field=name']);
                                                                                                                                                                                                                                                                                                                                                                      +  // Get the list of installed plugins and only keep the ones starting with "foo".
                                                                                                                                                                                                                                                                                                                                                                      +  $fooPlugins = $I->cliToArray(['plugin', 'list', '--field=name'], function($output){
                                                                                                                                                                                                                                                                                                                                                                      +  return array_filter(explode(PHP_EOL, $output), function($name){
                                                                                                                                                                                                                                                                                                                                                                      +  return strpos(trim($name), 'foo') === 0;
                                                                                                                                                                                                                                                                                                                                                                      +  });
                                                                                                                                                                                                                                                                                                                                                                      +  });
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string/string/\Codeception\Module\array $userCommand - The string of command and parameters as it would be passed to wp-cli
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • \callable $splitCallback - An optional callback function to split the results array.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      cliToString

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Returns the output of a wp-cli command as a string. minus wp. For back-compatibility purposes you can still pass the commandline as a string, but the array format is the preferred and supported method.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      // Return the current site administrator email, using string command format.
                                                                                                                                                                                                                                                                                                                                                                      +  $adminEmail = $I->cliToString('option get admin_email');
                                                                                                                                                                                                                                                                                                                                                                      +  // Get the list of active plugins in JSON format, two ways.
                                                                                                                                                                                                                                                                                                                                                                      +  $activePlugins = $I->cliToString(['plugin', 'list','--status=active', '--format=json']);
                                                                                                                                                                                                                                                                                                                                                                      +  $activePlugins = $I->cliToString(['option', 'get', 'active_plugins' ,'--format=json']);
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string/\Codeception\Module\array $userCommand - The string of command and parameters as it would be passed to wp-cli
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      dontSeeInShellOutput

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Checks that output from last command doesn't contain text.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      // Return the current site administrator email, using string command format.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->cli('plugin list --status=active');
                                                                                                                                                                                                                                                                                                                                                                      +  $I->dontSeeInShellOutput('my-inactive/plugin.php');
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string $text - The text to assert is not in the output.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      seeInShellOutput

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Checks that output from last command contains text.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      // Return the current site administrator email, using string command format.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->cli('option get admin_email');
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string $text - The text to assert is in the output.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      seeResultCodeIs

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Checks the result code from the last command.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      // Return the current site administrator email, using string command format.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->cli('option get admin_email');
                                                                                                                                                                                                                                                                                                                                                                      +  $I->seeResultCodeIs(0);
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • int $code - The desired result code.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      seeResultCodeIsNot

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Checks the result code from the last command.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      // Return the current site administrator email, using string command format.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->cli('invalid command');
                                                                                                                                                                                                                                                                                                                                                                      +  $I->seeResultCodeIsNot(0);
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • int $code - The result code the command should not have exited with.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      seeShellOutputMatches

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Checks that output from the last command matches a given regular expression.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      // Return the current site administrator email, using string command format.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->cli('option get admin_email');
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string $regex - The regex pattern, including delimiters, to assert the output matches against.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      This class extends \Codeception\Module

                                                                                                                                                                                                                                                                                                                                                                      + + + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + + + + + \ No newline at end of file diff --git a/docs/v3/modules/WPDb/index.html b/docs/v3/modules/WPDb/index.html new file mode 100644 index 000000000..827e4737d --- /dev/null +++ b/docs/v3/modules/WPDb/index.html @@ -0,0 +1,4722 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + WPDb - wp-browser docs + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      + + +
                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      This is the documentation for version 3 of the project. +The current version is version 4 and the documentation can be found here.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      WPDb module

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      This module should be used in acceptance and functional tests, see levels of testing for more information.
                                                                                                                                                                                                                                                                                                                                                                      +This module extends the Db module adding WordPress-specific configuration parameters and methods.
                                                                                                                                                                                                                                                                                                                                                                      +The module provides methods to read, write and update the WordPress database directly, without relying on WordPress methods, using WordPress functions or triggering WordPress filters.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Module requirements for Codeception 4.0+

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      This module requires the codeception/module-db Composer package to work when wp-browser is used with Codeception 4.0.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      To install the package run:

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      composer require --dev codeception/module-db:^1.0
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Backup your content

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      This module, like the Codeception Db one it extends, by default will load a database dump in the database it's using.
                                                                                                                                                                                                                                                                                                                                                                      +This means that the database contents will be replaced by the dump contents on each run of a suite using the module.
                                                                                                                                                                                                                                                                                                                                                                      +You can set the populate and cleanup parameters to false to prevent this default behavior but it's usually not what you need in an automated test.
                                                                                                                                                                                                                                                                                                                                                                      +Make a backup of any database you're using in tests that contains any information you care about before you run any test!

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Change the database used depending on whether you're running tests or not

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      The chore of having to plug different databases, or backup them, depending on whether you're manually testing the site or automatically testing can be mitigated switching them automatically depending on the browser user agent or request headers.
                                                                                                                                                                                                                                                                                                                                                                      +This module was born to be used in acceptance and functional tests (see levels of testing for more information) and will often be coupled with modules like the WPBrowser one or the WPWebDriver one.
                                                                                                                                                                                                                                                                                                                                                                      +Depending on which of the two modules is being used in the suite there are different ways to automate the "database switching".

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Automatically changing database based on the browser user agent

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      If you would like to automate the "switching above" below you will find an example setup.
                                                                                                                                                                                                                                                                                                                                                                      +Update the test site wp-config.php file from this: +

                                                                                                                                                                                                                                                                                                                                                                      define( 'DB_NAME', 'wordpress' );
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + to this: +
                                                                                                                                                                                                                                                                                                                                                                      <?php
                                                                                                                                                                                                                                                                                                                                                                      +if ( 
                                                                                                                                                                                                                                                                                                                                                                      +    // Custom header.
                                                                                                                                                                                                                                                                                                                                                                      +    isset( $_SERVER['HTTP_X_TESTING'] )
                                                                                                                                                                                                                                                                                                                                                                      +    // Custom user agent.
                                                                                                                                                                                                                                                                                                                                                                      +    || ( isset( $_SERVER['HTTP_USER_AGENT'] ) && $_SERVER['HTTP_USER_AGENT'] === 'wp-browser' )
                                                                                                                                                                                                                                                                                                                                                                      +    // The env var set by the WPClIr or WordPress modules.
                                                                                                                                                                                                                                                                                                                                                                      +    || getenv( 'WPBROWSER_HOST_REQUEST' )
                                                                                                                                                                                                                                                                                                                                                                      +) {
                                                                                                                                                                                                                                                                                                                                                                      +    // Use the test database if the request comes from a test.
                                                                                                                                                                                                                                                                                                                                                                      +    define( 'DB_NAME', 'wordpress_test' );
                                                                                                                                                                                                                                                                                                                                                                      +} else {
                                                                                                                                                                                                                                                                                                                                                                      +    // Else use the default one.
                                                                                                                                                                                                                                                                                                                                                                      +    define( 'DB_NAME', 'wordpress' );
                                                                                                                                                                                                                                                                                                                                                                      +}
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      If you're using the WPWebDriver module set the user agent in the browser, in this example I'm setting the user agent in Chromedriver: +

                                                                                                                                                                                                                                                                                                                                                                      class_name: AcceptanceTester
                                                                                                                                                                                                                                                                                                                                                                      +modules:
                                                                                                                                                                                                                                                                                                                                                                      +    enabled:
                                                                                                                                                                                                                                                                                                                                                                      +        - \Helper\Acceptance
                                                                                                                                                                                                                                                                                                                                                                      +        - WPDb
                                                                                                                                                                                                                                                                                                                                                                      +        - WPWebDriver
                                                                                                                                                                                                                                                                                                                                                                      +    config:
                                                                                                                                                                                                                                                                                                                                                                      +        WPDb:
                                                                                                                                                                                                                                                                                                                                                                      +            dsn: 'mysql:host=%WP_DB_HOST%;dbname=%WP_DB_NAME%'
                                                                                                                                                                                                                                                                                                                                                                      +            user: %WP_DB_USER%
                                                                                                                                                                                                                                                                                                                                                                      +            password: %WP_DB_PASSWORD%
                                                                                                                                                                                                                                                                                                                                                                      +            dump: tests/_data/dump.sql
                                                                                                                                                                                                                                                                                                                                                                      +            populate: true
                                                                                                                                                                                                                                                                                                                                                                      +            cleanup: false
                                                                                                                                                                                                                                                                                                                                                                      +            url: '%WP_URL%'
                                                                                                                                                                                                                                                                                                                                                                      +            tablePrefix: %WP_TABLE_PREFIX%
                                                                                                                                                                                                                                                                                                                                                                      +            urlReplacement: true
                                                                                                                                                                                                                                                                                                                                                                      +        WPWebDriver:
                                                                                                                                                                                                                                                                                                                                                                      +            url: '%WP_URL%'
                                                                                                                                                                                                                                                                                                                                                                      +            adminUsername: '%WP_ADMIN_USERNAME%'
                                                                                                                                                                                                                                                                                                                                                                      +            adminPassword: '%WP_ADMIN_PASSWORD%'
                                                                                                                                                                                                                                                                                                                                                                      +            adminPath: '%WP_ADMIN_PATH%'
                                                                                                                                                                                                                                                                                                                                                                      +            browser: chrome
                                                                                                                                                                                                                                                                                                                                                                      +            host: localhost
                                                                                                                                                                                                                                                                                                                                                                      +            port: 4444
                                                                                                                                                                                                                                                                                                                                                                      +            window_size: false
                                                                                                                                                                                                                                                                                                                                                                      +            wait: 5
                                                                                                                                                                                                                                                                                                                                                                      +            capabilities:
                                                                                                                                                                                                                                                                                                                                                                      +                # Used in more recent releases of Selenium.
                                                                                                                                                                                                                                                                                                                                                                      +                "goog:chromeOptions":
                                                                                                                                                                                                                                                                                                                                                                      +                    args: ["--no-sandbox", "--headless", "--disable-gpu", "--user-agent=wp-browser"]
                                                                                                                                                                                                                                                                                                                                                                      +                # Support the old format for back-compatibility purposes. 
                                                                                                                                                                                                                                                                                                                                                                      +                "chromeOptions":
                                                                                                                                                                                                                                                                                                                                                                      +                    args: ["--no-sandbox", "--headless", "--disable-gpu", "--user-agent=wp-browser"]
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      If you're using the WPBrowser module send a specific header in the context of test requests: +

                                                                                                                                                                                                                                                                                                                                                                      class_name: AcceptanceTester
                                                                                                                                                                                                                                                                                                                                                                      +modules:
                                                                                                                                                                                                                                                                                                                                                                      +    enabled:
                                                                                                                                                                                                                                                                                                                                                                      +        - \Helper\Acceptance
                                                                                                                                                                                                                                                                                                                                                                      +        - WPDb
                                                                                                                                                                                                                                                                                                                                                                      +        - WPBrowser
                                                                                                                                                                                                                                                                                                                                                                      +    config:
                                                                                                                                                                                                                                                                                                                                                                      +        WPDb:
                                                                                                                                                                                                                                                                                                                                                                      +              dsn: 'mysql:host=%DB_HOST%;dbname=%WP_DB_NAME%'
                                                                                                                                                                                                                                                                                                                                                                      +              user: %WP_DB_USER%
                                                                                                                                                                                                                                                                                                                                                                      +              password: %WP_DB_PASSWORD%
                                                                                                                                                                                                                                                                                                                                                                      +              dump: 'tests/_data/dump.sql'
                                                                                                                                                                                                                                                                                                                                                                      +              populate: true
                                                                                                                                                                                                                                                                                                                                                                      +              cleanup: true
                                                                                                                                                                                                                                                                                                                                                                      +              reconnect: false
                                                                                                                                                                                                                                                                                                                                                                      +              url: '%WP_URL%'
                                                                                                                                                                                                                                                                                                                                                                      +              tablePrefix: 'wp_'
                                                                                                                                                                                                                                                                                                                                                                      +        WPBrowser:
                                                                                                                                                                                                                                                                                                                                                                      +              url: '%WP_URL%'
                                                                                                                                                                                                                                                                                                                                                                      +              adminUsername: 'admin'
                                                                                                                                                                                                                                                                                                                                                                      +              adminPassword: 'admin'
                                                                                                                                                                                                                                                                                                                                                                      +              adminPath: '/wp-admin'
                                                                                                                                                                                                                                                                                                                                                                      +              headers: 
                                                                                                                                                                                                                                                                                                                                                                      +                X-Testing: 'wp-browser'
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Configuration

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • dsn required - the database POD DSN connection details; read more on PHP PDO documentation. If the database is accessible (as is the case on the latest version of [Local by Flywheel][http://localwp.com]) via unix socket, then the string to insert here should look like this mysql:unix_socket=/path/to/the/mysql.sock;dbname=wordpress.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • user required - the database user.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • password required - the database password.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • url required - the full URL, including the HTTP scheme, of the website whose database is being accessed. WordPress uses hard-codece URLs in the database, that URL will be set by this module when applying the SQL dump file during population or cleanup.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • dump required - defaults to null; sets the path, relative to the project root folder, or absolute to the SQL dump file that will be used to set the tests initial database fixture. If set to null then the populate, cleanup and populator parameters will be ignored.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • populate - defaults to true to empty the target database and import the SQL dump(s) specified in the dump argument before the test suite is started.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • cleanup - defaults to true empty the target database and import the SQL dump(s) specified in the dump argument before each test.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • urlReplacement - defaults to true to replace, while using the built-in, PHP-based, dump import solution the hard-coded WordPress URL in the database with the specified one.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • originalUrl - specifies the original URL hard-coded into the version controlled SQL dump files. This can help prevent some URL replacement issues when the urlReplacement configuration parameter is set to true.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • populator - defaults to null, if set to an executable shell command then that command will be used to populate the database in place of the built-in PHP solution; URL replacement will not apply in this case. Read more about this on Codeception documentation.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • reconnect - defaults to true to force the module to reconnect to the database before each test in place of only connecting at the start of the tests.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • waitlock - defaults to 10; wait lock (in seconds) that the database session should use for DDL statements.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • tablePrefix - defaults to wp_; sets the prefix of the tables that the module will manipulate.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • letAdminEmailVerification - defaults to an empty value to remove the Administrator Email Verification screen introduced in WordPress 5.3. Set to true to not remove the screen and show it when an administrator user first logs in.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • letCron - defaults to an empty value to avoid wp-cron from being spawned during tests. Setting this to true will let wp-cron requests to fire during tests.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Example configuration

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      modules:
                                                                                                                                                                                                                                                                                                                                                                      +  enabled:
                                                                                                                                                                                                                                                                                                                                                                      +      - WPDb
                                                                                                                                                                                                                                                                                                                                                                      +  config:
                                                                                                                                                                                                                                                                                                                                                                      +      WPDb:
                                                                                                                                                                                                                                                                                                                                                                      +          dsn: 'mysql:host=localhost;dbname=wordpress'
                                                                                                                                                                                                                                                                                                                                                                      +          user: 'root'
                                                                                                                                                                                                                                                                                                                                                                      +          password: 'password'
                                                                                                                                                                                                                                                                                                                                                                      +          dump: 'tests/_data/dump.sql'
                                                                                                                                                                                                                                                                                                                                                                      +          populate: true
                                                                                                                                                                                                                                                                                                                                                                      +          cleanup: true
                                                                                                                                                                                                                                                                                                                                                                      +          waitlock: 10
                                                                                                                                                                                                                                                                                                                                                                      +          url: 'http://wordpress.localhost'
                                                                                                                                                                                                                                                                                                                                                                      +          urlReplacement: true
                                                                                                                                                                                                                                                                                                                                                                      +          tablePrefix: 'wp_'
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Using the module with the WPLoader one

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      This module is often used in conjunction with the WPLoader one to use WordPress-defined functions, classes and methods in acceptance or functional tests.
                                                                                                                                                                                                                                                                                                                                                                      +The WPLoader module should be set to only load WordPress and this module should be listed, in the modules.enabled section of the suite configuration file before the WPLoader one:

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      modules:
                                                                                                                                                                                                                                                                                                                                                                      +  enabled:
                                                                                                                                                                                                                                                                                                                                                                      +      - WPDb # this before...
                                                                                                                                                                                                                                                                                                                                                                      +      - WPLoader # ...this one.
                                                                                                                                                                                                                                                                                                                                                                      +  config:
                                                                                                                                                                                                                                                                                                                                                                      +      WPDb:
                                                                                                                                                                                                                                                                                                                                                                      +        # ...
                                                                                                                                                                                                                                                                                                                                                                      +      WPLoader:
                                                                                                                                                                                                                                                                                                                                                                      +        loadOnly: true
                                                                                                                                                                                                                                                                                                                                                                      +        # ... 
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +This will avoid issues where the WPLoader module could exit, terminating the test run, due to an inconsistent database state.

                                                                                                                                                                                                                                                                                                                                                                      + + +

                                                                                                                                                                                                                                                                                                                                                                      Public API

                                                                                                                                                                                                                                                                                                                                                                      + + +

                                                                                                                                                                                                                                                                                                                                                                      countRowsInDatabase

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Returns the number of table rows matching a criteria.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $I->haveManyPostsInDatabase(3, ['post_status' => 'draft' ]);
                                                                                                                                                                                                                                                                                                                                                                      +  $I->haveManyPostsInDatabase(3, ['post_status' => 'private' ]);
                                                                                                                                                                                                                                                                                                                                                                      +  // Make sure there are now the expected number of draft posts.
                                                                                                                                                                                                                                                                                                                                                                      +  $postsTable = $I->grabPostsTableName();
                                                                                                                                                                                                                                                                                                                                                                      +  $draftsCount = $I->countRowsInDatabase($postsTable, ['post_status' => 'draft']);
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string $table - The table to count the rows in.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • array/\Codeception\Module\array/array $criteria - Search criteria, if empty all table rows will be counted.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      dontHaveAttachmentFilesInDatabase

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Removes all the files attached with an attachment post, it will not remove the database entries. Requires the WPFilesystem module to be loaded in the suite.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $posts = $I->grabPostsTableName();
                                                                                                                                                                                                                                                                                                                                                                      +  $attachmentIds = $I->grabColumnFromDatabase($posts, 'ID', ['post_type' => 'attachment']);
                                                                                                                                                                                                                                                                                                                                                                      +  // This will only remove the files, not the database entries.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->dontHaveAttachmentFilesInDatabase($attachmentIds);
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • \Codeception\Module\array/int $attachmentIds - An attachment post ID or an array of attachment post IDs.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      dontHaveAttachmentInDatabase

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Removes an attachment from the posts table. table. the suite.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $postmeta = $I->grabpostmetatablename();
                                                                                                                                                                                                                                                                                                                                                                      +  $thumbnailId = $I->grabFromDatabase($postmeta, 'meta_value', [
                                                                                                                                                                                                                                                                                                                                                                      +  'post_id' => $id,
                                                                                                                                                                                                                                                                                                                                                                      +  'meta_key'=>'thumbnail_id'
                                                                                                                                                                                                                                                                                                                                                                      +  ]);
                                                                                                                                                                                                                                                                                                                                                                      +  // Remove only the database entry (including postmeta) but not the files.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->dontHaveAttachmentInDatabase($thumbnailId);
                                                                                                                                                                                                                                                                                                                                                                      +  // Remove the database entry (including postmeta) and the files.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->dontHaveAttachmentInDatabase($thumbnailId, true, true);
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • \Codeception\Module\array/array $criteria - An array of search criteria to find the attachment post in the posts
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • bool $purgeMeta - If set to true then the meta for the attachment will be purged too.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • bool $removeFiles - Remove all files too, requires the WPFilesystem module to be loaded in
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      dontHaveBlogInDatabase

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Removes one ore more blogs from the database.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      // Remove the blog, all its tables and files.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->dontHaveBlogInDatabase(['path' => 'test/one']);
                                                                                                                                                                                                                                                                                                                                                                      +  // Remove the blog entry, not the tables though.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->dontHaveBlogInDatabase(['blog_id' => $blogId]);
                                                                                                                                                                                                                                                                                                                                                                      +  // Remove multiple blogs.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->dontHaveBlogInDatabase(['domain' => 'test']);
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • \Codeception\Module\array/array $criteria - An array of search criteria to find the blog rows in the blogs table.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • bool $removeTables - Remove the blog tables.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • bool $removeUploads - Remove the blog uploads; requires the WPFilesystem module.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      dontHaveCommentInDatabase

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Removes an entry from the comments table.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $I->dontHaveCommentInDatabase(['comment_post_ID' => 23, 'comment_url' => 'http://example.copm']);
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • \Codeception\Module\array/array $criteria - An array of search criteria.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • bool $purgeMeta - If set to true then the meta for the comment will be purged too.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      dontHaveCommentMetaInDatabase

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Removes a post comment meta from the database

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      // Remove all meta for the comment with an ID of 23.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->dontHaveCommentMetaInDatabase(['comment_id' => 23]);
                                                                                                                                                                                                                                                                                                                                                                      +  // Remove the `count` comment meta for the comment with an ID of 23.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->dontHaveCommentMetaInDatabase(['comment_id' => 23, 'meta_key' => 'count']);
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • \Codeception\Module\array/array $criteria - An array of search criteria.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      dontHaveInDatabase

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Deletes a database entry. criteria.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $I->dontHaveInDatabase('custom_table', ['book_ID' => 23, 'book_genre' => 'fiction']);
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string $table - The table name.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • \Codeception\Module\array/array $criteria - An associative array of the column names and values to use as deletion
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      dontHaveLinkInDatabase

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Removes a link from the database.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $I->dontHaveLinkInDatabase(['link_url' => 'http://example.com']);
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • \Codeception\Module\array/array $criteria - An array of search criteria.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      dontHaveOptionInDatabase

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Removes an entry from the options table.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      // Remove the `foo` option.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->dontHaveOptionInDatabase('foo');
                                                                                                                                                                                                                                                                                                                                                                      +  // Remove the 'bar' option only if it has the `baz` value.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->dontHaveOptionInDatabase('bar', 'baz');
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string $key - The option name.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • mixed/null $value - If set the option will only be removed if its value matches the passed one.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      dontHavePostInDatabase

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Removes an entry from the posts table.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $posts = $I->haveManyPostsInDatabase(3, ['post_title' => 'Test {{n}}']);
                                                                                                                                                                                                                                                                                                                                                                      +  $I->dontHavePostInDatabase(['post_title' => 'Test 2']);
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • \Codeception\Module\array/array $criteria - An array of search criteria.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • bool $purgeMeta - If set to true then the meta for the post will be purged too.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      dontHavePostMetaInDatabase

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Removes an entry from the postmeta table.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $postId = $I->havePostInDatabase(['meta_input' => ['rating' => 23]]);
                                                                                                                                                                                                                                                                                                                                                                      +  $I->dontHavePostMetaInDatabase(['post_id' => $postId, 'meta_key' => 'rating']);
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • \Codeception\Module\array/array $criteria - An array of search criteria.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      dontHavePostThumbnailInDatabase

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Remove the thumbnail (featured image) from a post, if any. Please note: the method will NOT remove the attachment post, post meta and file.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $attachmentId = $I->haveAttachmentInDatabase(codecept_data_dir('some-image.png'));
                                                                                                                                                                                                                                                                                                                                                                      +  $postId = $I->havePostInDatabase();
                                                                                                                                                                                                                                                                                                                                                                      +  // Attach the thumbnail to the post.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->havePostThumbnailInDatabase($postId, $attachmentId);
                                                                                                                                                                                                                                                                                                                                                                      +  // Remove the thumbnail from the post.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->dontHavePostThumbnailInDatabase($postId);
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • int $postId - The post ID to remove the thumbnail (featured image) from.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      dontHaveSiteOptionInDatabase

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Removes a site option from the database.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      // Remove the `foo_count` option.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->dontHaveSiteOptionInDatabase('foo_count');
                                                                                                                                                                                                                                                                                                                                                                      +  // Remove the `foo_count` option only if its value is `23`.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->dontHaveSiteOptionInDatabase('foo_count', 23);
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string $key - The option name.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • mixed/null $value - If set the option will only be removed it its value matches the specified one.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      dontHaveSiteTransientInDatabase

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Removes a site transient from the database.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $I->dontHaveSiteTransientInDatabase(['my_plugin_site_buffer']);
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string $key - The name of the transient to delete.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      dontHaveTableInDatabase

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Removes a table from the database. The case where a table does not exist is handled without raising an error.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $ordersTable = $I->grabPrefixedTableNameFor('orders');
                                                                                                                                                                                                                                                                                                                                                                      +  $I->dontHaveTableInDatabase($ordersTable);
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string $fullTableName - The full table name, including the table prefix.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      dontHaveTermInDatabase

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Removes a term from the database.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $I->dontHaveTermInDatabase(['name' => 'romance']);
                                                                                                                                                                                                                                                                                                                                                                      +  $I->dontHaveTermInDatabase(['slug' => 'genre--romance']);
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • \Codeception\Module\array/array $criteria - An array of search criteria.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • bool $purgeMeta - Whether the terms meta should be purged along side with the meta or not.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      dontHaveTermMetaInDatabase

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Removes a term meta from the database.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      // Remove the "karma" key.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->dontHaveTermMetaInDatabase(['term_id' => $termId, 'meta_key' => 'karma']);
                                                                                                                                                                                                                                                                                                                                                                      +  // Remove all meta for the term.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->dontHaveTermMetaInDatabase(['term_id' => $termId]);
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • \Codeception\Module\array/array $criteria - An array of search criteria.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      dontHaveTermRelationshipInDatabase

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Removes an entry from the term_relationships table.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      // Remove the relation between a post and a category.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->dontHaveTermRelationshipInDatabase(['object_id' => $postId, 'term_taxonomy_id' => $ttaxId]);
                                                                                                                                                                                                                                                                                                                                                                      +  // Remove all terms for a post.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->dontHaveTermMetaInDatabase(['object_id' => $postId]);
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • \Codeception\Module\array/array $criteria - An array of search criteria.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      dontHaveTermTaxonomyInDatabase

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Removes an entry from the term_taxonomy table.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      // Remove a specific term from the genre taxonomy.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->dontHaveTermTaxonomyInDatabase(['term_id' => $postId, 'taxonomy' => 'genre']);
                                                                                                                                                                                                                                                                                                                                                                      +  // Remove all terms for a taxonomy.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->dontHaveTermTaxonomyInDatabase(['taxonomy' => 'genre']);
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • \Codeception\Module\array/array $criteria - An array of search criteria.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      dontHaveTransientInDatabase

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Removes a transient from the database.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      // Removes the `tweets` transient from the database, if set.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->dontHaveTransientInDatabase('tweets');
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string $transient - The name of the transient to delete.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      dontHaveUserInDatabase

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Removes a user from the database.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $bob = $I->haveUserInDatabase('bob');
                                                                                                                                                                                                                                                                                                                                                                      +  $alice = $I->haveUserInDatabase('alice');
                                                                                                                                                                                                                                                                                                                                                                      +  // Remove Bob's user and meta.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->dontHaveUserInDatabase('bob');
                                                                                                                                                                                                                                                                                                                                                                      +  // Remove Alice's user but not meta.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->dontHaveUserInDatabase($alice);
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • int/string $userIdOrLogin - The user ID or login name.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • bool $purgeMeta - Whether the user meta should be purged alongside the user or not.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      dontHaveUserInDatabaseWithEmail

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Removes a user(s) from the database using the user email address.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $luca = $I->haveUserInDatabase('luca', 'editor', ['user_email' => 'luca@example.org']);
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string $userEmail - The email of the user to remove.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • bool $purgeMeta - Whether the user meta should be purged alongside the user or not.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      dontHaveUserMetaInDatabase

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Removes an entry from the usermeta table.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      // Remove the `karma` user meta for a user.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->dontHaveUserMetaInDatabase(['user_id' => 23, 'meta_key' => 'karma']);
                                                                                                                                                                                                                                                                                                                                                                      +  // Remove all the user meta for a user.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->dontHaveUserMetaInDatabase(['user_id' => 23]);
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • \Codeception\Module\array/array $criteria - An array of search criteria.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      dontSeeAttachmentInDatabase

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Checks that an attachment is not in the database.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $url = 'https://example.org/images/foo.png';
                                                                                                                                                                                                                                                                                                                                                                      +  $I->dontSeeAttachmentInDatabase(['guid' => $url]);
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • \Codeception\Module\array/array $criteria - An array of search criteria.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      dontSeeBlogInDatabase

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Checks that a row is not present in the blogs table.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $I->haveManyBlogsInDatabase(2, ['path' => 'test-{{n}}'], false)
                                                                                                                                                                                                                                                                                                                                                                      +  $I->dontSeeBlogInDatabase(['path' => '/test-3/'])
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • \Codeception\Module\array/array $criteria - An array of search criteria.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      dontSeeCommentInDatabase

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Checks that a comment is not in the database. Will look up the "comments" table.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      // Checks for one comment.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->dontSeeCommentInDatabase(['comment_ID' => 23]);
                                                                                                                                                                                                                                                                                                                                                                      +  // Checks for comments from a user.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->dontSeeCommentInDatabase(['user_id' => 89]);
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • \Codeception\Module\array/array $criteria - The search criteria.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      dontSeeCommentMetaInDatabase

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Checks that a comment meta value is not in the database. Will look up the "commentmeta" table.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      // Delete a comment `karma` meta.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->dontSeeCommentMetaInDatabase(['comment_id' => 23, 'meta_key' => 'karma']);
                                                                                                                                                                                                                                                                                                                                                                      +  // Delete all meta for a comment.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->dontSeeCommentMetaInDatabase(['comment_id' => 23]);
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • \Codeception\Module\array/array $criteria - An array of search criteria.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      dontSeeLinkInDatabase

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Checks that a link is not in the links database table.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $I->dontSeeLinkInDatabase(['link_url' => 'http://example.com']);
                                                                                                                                                                                                                                                                                                                                                                      +  $I->dontSeeLinkInDatabase(['link_url' => 'http://example.com', 'link_name' => 'example']);
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • \Codeception\Module\array/array $criteria - An array of search criteria.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      dontSeeOptionInDatabase

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Checks that an option is not in the database for the current blog. If the value is an object or an array then the serialized option will be checked.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $I->dontHaveOptionInDatabase('posts_per_page');
                                                                                                                                                                                                                                                                                                                                                                      +  $I->dontSeeOptionInDatabase('posts_per_page');
                                                                                                                                                                                                                                                                                                                                                                      +  $I->dontSeeOptionInDatabase('posts_per_page', 23);
                                                                                                                                                                                                                                                                                                                                                                      +  $I->dontSeeOptionInDatabase(['option_name' => 'posts_per_page']);
                                                                                                                                                                                                                                                                                                                                                                      +  $I->dontSeeOptionInDatabase(['option_name' => 'posts_per_page', 'option_value' => 23]);
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • \Codeception\Module\array/string $criteriaOrName - An array of search criteria or the option name.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • mixed/null $value - The optional value to try and match, only used if the option name is provided.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      dontSeePageInDatabase

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Checks that a page is not in the database.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      // Assert a page with an ID does not exist.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->dontSeePageInDatabase(['ID' => 23]);
                                                                                                                                                                                                                                                                                                                                                                      +  // Assert a page with a slug and ID.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->dontSeePageInDatabase(['post_name' => 'test', 'ID' => 23]);
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • \Codeception\Module\array/array $criteria - An array of search criteria.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      dontSeePostInDatabase

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Checks that a post is not in the database.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      // Asserts a post with title 'Test' is not in the database.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->dontSeePostInDatabase(['post_title' => 'Test']);
                                                                                                                                                                                                                                                                                                                                                                      +  // Asserts a post with title 'Test' and content 'Test content' is not in the database.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->dontSeePostInDatabase(['post_title' => 'Test', 'post_content' => 'Test content']);
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • \Codeception\Module\array/array $criteria - An array of search criteria.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      dontSeePostMetaInDatabase

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Checks that a post meta value does not exist. If the meta value is an object or an array then the check will be made on its serialized version.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $postId = $I->havePostInDatabase(['meta_input' => ['foo' => 'bar']]);
                                                                                                                                                                                                                                                                                                                                                                      +  $I->dontSeePostMetaInDatabase(['post_id' => $postId, 'meta_key' => 'woot']);
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • \Codeception\Module\array/array $criteria - An array of search criteria.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      dontSeePostWithTermInDatabase

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Checks that a post to term relation does not exist in the database. The method will check the "term_relationships" table.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $fiction = $I->haveTermInDatabase('fiction', 'genre');
                                                                                                                                                                                                                                                                                                                                                                      +  $nonFiction = $I->haveTermInDatabase('non-fiction', 'genre');
                                                                                                                                                                                                                                                                                                                                                                      +  $postId = $I->havePostInDatabase(['tax_input' => ['genre' => ['fiction']]]);
                                                                                                                                                                                                                                                                                                                                                                      +  $I->dontSeePostWithTermInDatabase($postId, $nonFiction['term_taxonomy_id], );
                                                                                                                                                                                                                                                                                                                                                                      +  passed this parameter will be interpreted as a `term_id`, else as a
                                                                                                                                                                                                                                                                                                                                                                      +  the
                                                                                                                                                                                                                                                                                                                                                                      +  term order.
                                                                                                                                                                                                                                                                                                                                                                      +  to build a `taxonomy_term_id` from the `term_id`.
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • int $post_id - The post ID.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • int $term_taxonomy_id - The term term_id or term_taxonomy_id; if the $taxonomy argument is
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • int/null $term_order - The order the term applies to the post, defaults to null to not use
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • string/null $taxonomy - The taxonomy the term_id is for; if passed this parameter will be used
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      dontSeeSiteOptionInDatabase

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Checks that a site option is not in the database.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      // Check that the option is not set in the database.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->dontSeeSiteOptionInDatabase('foo_count');
                                                                                                                                                                                                                                                                                                                                                                      +  // Check that the option is not set with a specific value.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->dontSeeSiteOptionInDatabase('foo_count', 23);
                                                                                                                                                                                                                                                                                                                                                                      +  $I->dontSeeSiteOptionInDatabase(['option_name => 'foo_count', 'option_value' => 23]);
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • \Codeception\Module\array/string $criteriaOrName - An array of search criteria or the option name.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • mixed/null $value - The optional value to try and match, only used if the option name is provided.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      dontSeeTableInDatabase

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Checks that a table is not in the database.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $options = $I->grabPrefixedTableNameFor('options');
                                                                                                                                                                                                                                                                                                                                                                      +  $I->dontHaveTableInDatabase($options)
                                                                                                                                                                                                                                                                                                                                                                      +  $I->dontSeeTableInDatabase($options);
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string $table - The full table name, including the table prefix.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      dontSeeTermInDatabase

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Makes sure a term is not in the database. Looks up both the terms table and the term_taxonomy tables. and the term_taxonomy tables.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      // Asserts a 'fiction' term is not in the database.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->dontSeeTermInDatabase(['name' => 'fiction']);
                                                                                                                                                                                                                                                                                                                                                                      +  // Asserts a 'fiction' term with slug 'genre--fiction' is not in the database.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->dontSeeTermInDatabase(['name' => 'fiction', 'slug' => 'genre--fiction']);
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • \Codeception\Module\array/array $criteria - An array of criteria to search for the term, can be columns from the terms
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      dontSeeTermMetaInDatabase

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Checks that a term meta is not in the database.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      list($termId, $termTaxonomyId) = $I->haveTermInDatabase('fiction', 'genre');
                                                                                                                                                                                                                                                                                                                                                                      +  $I->haveTermMetaInDatabase($termId, 'rating', 4);
                                                                                                                                                                                                                                                                                                                                                                      +  $I->dontSeeTermMetaInDatabase(['term_id' => $termId,'meta_key' => 'average_review']);
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • \Codeception\Module\array/array $criteria - An array of search criteria.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      dontSeeTermTaxonomyInDatabase

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Checks that a term taxonomy is not in the database.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      list($termId, $termTaxonomyId) = $I->haveTermInDatabase('fiction', 'genre');
                                                                                                                                                                                                                                                                                                                                                                      +  $I->dontSeeTermTaxonomyInDatabase(['term_id' => $termId, 'taxonomy' => 'country']);
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • \Codeception\Module\array/array $criteria - An array of search criteria.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      dontSeeUserInDatabase

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Checks that a user is not in the database.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      // Asserts a user does not exist in the database.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->dontSeeUserInDatabase(['user_login' => 'luca']);
                                                                                                                                                                                                                                                                                                                                                                      +  // Asserts a user with email and login is not in the database.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->dontSeeUserInDatabase(['user_login' => 'luca', 'user_email' => 'luca@theaveragedev.com']);
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • \Codeception\Module\array/array $criteria - An array of search criteria.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      dontSeeUserMetaInDatabase

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Check that a user meta value is not in the database.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      // Asserts a user does not have a 'karma' meta assigned.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->dontSeeUserMetaInDatabase(['user_id' => 23, 'meta_key' => 'karma']);
                                                                                                                                                                                                                                                                                                                                                                      +  // Asserts no user has any 'karma' meta assigned.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->dontSeeUserMetaInDatabase(['meta_key' => 'karma']);
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • \Codeception\Module\array/array $criteria - An array of search criteria.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      getSiteDomain

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Returns the site domain inferred from the url set in the config.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $domain = $I->getSiteDomain();
                                                                                                                                                                                                                                                                                                                                                                      +  // We should be redirected to the HTTPS version when visiting the HTTP version.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->amOnPage('http://' . $domain);
                                                                                                                                                                                                                                                                                                                                                                      +  $I->seeCurrentUrlEquals('https://' . $domain);
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      getUsersTableName

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Returns the prefixed users table name.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      // Given a `wp_` table prefix returns `wp_users`.
                                                                                                                                                                                                                                                                                                                                                                      +  $usersTable = $I->getUsersTableName();
                                                                                                                                                                                                                                                                                                                                                                      +  // Given a `wp_` table prefix returns `wp_users`.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->useBlog(23);
                                                                                                                                                                                                                                                                                                                                                                      +  $usersTable = $I->getUsersTableName();
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      grabAllFromDatabase

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Returns all entries matching a criteria from the database.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $books = $I->grabPrefixedTableNameFor('books');
                                                                                                                                                                                                                                                                                                                                                                      +  $I->grabAllFromDatabase($books, 'title', ['genre' => 'fiction']);
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string $table - The table to grab the values from.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • string $column - The column to fetch.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • \Codeception\Module\array $criteria - The search criteria.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      grabAttachmentAttachedFile

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Returns the path, as stored in the database, of an attachment _wp_attached_file meta. The attached file is, usually, an attachment origal file.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $file = $I->grabAttachmentAttachedFile($attachmentId);
                                                                                                                                                                                                                                                                                                                                                                      +  $fileInfo = new SplFileInfo($file);
                                                                                                                                                                                                                                                                                                                                                                      +  $I->assertEquals('jpg', $fileInfo->getExtension());
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • int $attachmentPostId - The attachment post ID.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      grabAttachmentMetadata

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Returns the metadata array for an attachment post. This is the value of the _wp_attachment_metadata meta.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $metadata = $I->grabAttachmentMetadata($attachmentId);
                                                                                                                                                                                                                                                                                                                                                                      +  $I->assertEquals(['thumbnail', 'medium', 'medium_large'], array_keys($metadata['sizes']);
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • int $attachmentPostId - The attachment post ID.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      grabBlogDomain

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Returns a blog domain given its ID.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $blogIds = $I->haveManyBlogsInDatabase(3);
                                                                                                                                                                                                                                                                                                                                                                      +  $domains = array_map(function($blogId){
                                                                                                                                                                                                                                                                                                                                                                      +  return $I->grabBlogDomain($blogId);
                                                                                                                                                                                                                                                                                                                                                                      +  }, $blogIds);
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • int $blogId - The blog ID.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      grabBlogPath

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Grabs a blog domain from the blogs table.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $blogId = $I->haveBlogInDatabase('test');
                                                                                                                                                                                                                                                                                                                                                                      +  $path = $I->grabBlogDomain($blogId);
                                                                                                                                                                                                                                                                                                                                                                      +  $I->amOnSubdomain($path);
                                                                                                                                                                                                                                                                                                                                                                      +  $I->amOnPage('/');
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • int $blogId - The blog ID.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      grabBlogTableName

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Returns the full name of a table for a blog from a multisite installation database.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $blogOptionTable = $I->grabBlogTableName($blogId, 'option');
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • int $blogId - The blog ID.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • string $table - The table name, without table prefix.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      grabBlogTableNames

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Returns a list of tables for a blog ID.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $blogId = $I->haveBlogInDatabase('test');
                                                                                                                                                                                                                                                                                                                                                                      +  $tables = $I->grabBlogTableNames($blogId);
                                                                                                                                                                                                                                                                                                                                                                      +  $options = array_filter($tables, function($tableName){
                                                                                                                                                                                                                                                                                                                                                                      +  return str_pos($tableName, 'options') !== false;
                                                                                                                                                                                                                                                                                                                                                                      +  });
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • int $blogId - The ID of the blog to fetch the tables for.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      grabBlogTablePrefix

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Returns the table prefix for a blog.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $blogId = $I->haveBlogInDatabase('test');
                                                                                                                                                                                                                                                                                                                                                                      +  $blogTablePrefix = $I->getBlogTablePrefix($blogId);
                                                                                                                                                                                                                                                                                                                                                                      +  $blogOrders = $I->blogTablePrefix . 'orders';
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • int $blogId - The blog ID.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      grabBlogVersionsTableName

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Gets the prefixed blog_versions table name.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      // Assuming a `wp_` table prefix it will return `wp_blog_versions`.
                                                                                                                                                                                                                                                                                                                                                                      +  $blogVersionsTable = $I->grabBlogVersionsTableName();
                                                                                                                                                                                                                                                                                                                                                                      +  $I->useBlog(23);
                                                                                                                                                                                                                                                                                                                                                                      +  // Assuming a `wp_` table prefix it will return `wp_blog_versions`.
                                                                                                                                                                                                                                                                                                                                                                      +  $blogVersionsTable = $I->grabBlogVersionsTableName();
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      grabBlogsTableName

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Gets the prefixed blogs table name.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      // Assuming a `wp_` table prefix it will return `wp_blogs`.
                                                                                                                                                                                                                                                                                                                                                                      +  $blogVersionsTable = $I->grabBlogsTableName();
                                                                                                                                                                                                                                                                                                                                                                      +  $I->useBlog(23);
                                                                                                                                                                                                                                                                                                                                                                      +  // Assuming a `wp_` table prefix it will return `wp_blogs`.
                                                                                                                                                                                                                                                                                                                                                                      +  $blogVersionsTable = $I->grabBlogsTableName();
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      grabCommentmetaTableName

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Returns the prefixed comment meta table name.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      // Get all the values of 'karma' for all comments.
                                                                                                                                                                                                                                                                                                                                                                      +  $commentMeta = $I->grabCommentmetaTableName();
                                                                                                                                                                                                                                                                                                                                                                      +  $I->grabAllFromDatabase($commentMeta, 'meta_value', ['meta_key' => 'karma']);
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      grabCommentsTableName

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Gets the comments table name.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      // Will be `wp_comments`.
                                                                                                                                                                                                                                                                                                                                                                      +  $comments = $I->grabCommentsTableName();
                                                                                                                                                                                                                                                                                                                                                                      +  // Will be `wp_23_comments`.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->useBlog(23);
                                                                                                                                                                                                                                                                                                                                                                      +  $comments = $I->grabCommentsTableName();
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      grabLatestEntryByFromDatabase

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Returns the id value of the last table entry.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $I->haveManyPostsInDatabase();
                                                                                                                                                                                                                                                                                                                                                                      +  $postsTable = $I->grabPostsTableName();
                                                                                                                                                                                                                                                                                                                                                                      +  $last = $I->grabLatestEntryByFromDatabase($postsTable, 'ID');
                                                                                                                                                                                                                                                                                                                                                                      +  items.
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string $tableName - The table to fetch the last insertion for.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • string $idColumn - The column that is used, in the table, to uniquely identify
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      grabLinksTableName

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Returns the prefixed links table name.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      // Given a `wp_` table prefix returns `wp_links`.
                                                                                                                                                                                                                                                                                                                                                                      +  $linksTable = $I->grabLinksTableName();
                                                                                                                                                                                                                                                                                                                                                                      +  // Given a `wp_` table prefix returns `wp_23_links`.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->useBlog(23);
                                                                                                                                                                                                                                                                                                                                                                      +  $linksTable = $I->grabLinksTableName();
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      grabOptionFromDatabase

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Gets an option value from the database.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $count = $I->grabOptionFromDatabase('foo_count');
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string $option_name - The name of the option to grab from the database.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      grabPostMetaFromDatabase

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Gets the value of one or more post meta values from the database.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $thumbnail_id = $I->grabPostMetaFromDatabase($postId, '_thumbnail_id', true);
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • int $postId - The post ID.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • string $metaKey - The key of the meta to retrieve.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • bool $single - Whether to return a single meta value or an array of all available meta values.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      grabPostmetaTableName

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Returns the prefixed post meta table name.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      // Returns 'wp_postmeta'.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->grabPostmetaTableName();
                                                                                                                                                                                                                                                                                                                                                                      +  // Returns 'wp_23_postmeta'.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->useBlog(23);
                                                                                                                                                                                                                                                                                                                                                                      +  $I->grabPostmetaTableName();
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      grabPostsTableName

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Gets the posts prefixed table name.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      // Given a `wp_` table prefix returns `wp_posts`.
                                                                                                                                                                                                                                                                                                                                                                      +  $postsTable = $I->grabPostsTableName();
                                                                                                                                                                                                                                                                                                                                                                      +  // Given a `wp_` table prefix returns `wp_23_posts`.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->useBlog(23);
                                                                                                                                                                                                                                                                                                                                                                      +  $postsTable = $I->grabPostsTableName();
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      grabPrefixedTableNameFor

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Returns a prefixed table name for the current blog. If the table is not one to be prefixed (e.g. users) then the proper table name will be returned.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      // Will return wp_users.
                                                                                                                                                                                                                                                                                                                                                                      +  $usersTable = $I->grabPrefixedTableNameFor('users');
                                                                                                                                                                                                                                                                                                                                                                      +  // Will return wp_options.
                                                                                                                                                                                                                                                                                                                                                                      +  $optionsTable = $I->grabPrefixedTableNameFor('options');
                                                                                                                                                                                                                                                                                                                                                                      +  // Use a different blog and get its options table.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->useBlog(2);
                                                                                                                                                                                                                                                                                                                                                                      +  $blogOptionsTable = $I->grabPrefixedTableNameFor('options');
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string $tableName - The table name, e.g. options.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      grabRegistrationLogTableName

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Gets the prefixed registration_log table name.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      // Assuming a `wp_` table prefix it will return `wp_registration_log`.
                                                                                                                                                                                                                                                                                                                                                                      +  $blogVersionsTable = $I->grabRegistrationLogTableName();
                                                                                                                                                                                                                                                                                                                                                                      +  $I->useBlog(23);
                                                                                                                                                                                                                                                                                                                                                                      +  // Assuming a `wp_` table prefix it will return `wp_registration_log`.
                                                                                                                                                                                                                                                                                                                                                                      +  $blogVersionsTable = $I->grabRegistrationLogTableName();
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      grabSignupsTableName

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Gets the prefixed signups table name.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      // Assuming a `wp_` table prefix it will return `wp_signups`.
                                                                                                                                                                                                                                                                                                                                                                      +  $blogVersionsTable = $I->grabSignupsTableName();
                                                                                                                                                                                                                                                                                                                                                                      +  $I->useBlog(23);
                                                                                                                                                                                                                                                                                                                                                                      +  // Assuming a `wp_` table prefix it will return `wp_signups`.
                                                                                                                                                                                                                                                                                                                                                                      +  $blogVersionsTable = $I->grabSignupsTableName();
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      grabSiteMetaTableName

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Gets the prefixed sitemeta table name.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      // Assuming a `wp_` table prefix it will return `wp_sitemeta`.
                                                                                                                                                                                                                                                                                                                                                                      +  $blogVersionsTable = $I->grabSiteMetaTableName();
                                                                                                                                                                                                                                                                                                                                                                      +  $I->useBlog(23);
                                                                                                                                                                                                                                                                                                                                                                      +  // Assuming a `wp_` table prefix it will return `wp_sitemeta`.
                                                                                                                                                                                                                                                                                                                                                                      +  $blogVersionsTable = $I->grabSiteMetaTableName();
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      grabSiteOptionFromDatabase

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Gets a site option from the database.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $fooCountOptionId = $I->haveSiteOptionInDatabase('foo_count','23');
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string $key - The name of the option to read from the database.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      grabSiteTableName

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Gets the prefixed site table name.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      // Assuming a `wp_` table prefix it will return `wp_site`.
                                                                                                                                                                                                                                                                                                                                                                      +  $blogVersionsTable = $I->grabSiteTableName();
                                                                                                                                                                                                                                                                                                                                                                      +  $I->useBlog(23);
                                                                                                                                                                                                                                                                                                                                                                      +  // Assuming a `wp_` table prefix it will return `wp_site`.
                                                                                                                                                                                                                                                                                                                                                                      +  $blogVersionsTable = $I->grabSiteTableName();
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      grabSiteTransientFromDatabase

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Gets a site transient from the database.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $I->grabSiteTransientFromDatabase('total_comments');
                                                                                                                                                                                                                                                                                                                                                                      +  $I->grabSiteTransientFromDatabase('api_data');
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string $key - The site transient to fetch the value for, w/o the _site_transient_ prefix.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      grabSiteUrl

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Returns the current site URL as specified in the module configuration.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $shopPath = $I->grabSiteUrl('/shop');
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string $path - A path that should be appended to the site URL.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      grabTablePrefix

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Returns the table prefix, namespaced for secondary blogs if selected.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      // Assuming a table prefix of `wp_` it will return `wp_`;
                                                                                                                                                                                                                                                                                                                                                                      +  $tablePrefix = $I->grabTablePrefix();
                                                                                                                                                                                                                                                                                                                                                                      +  $I->useBlog(23);
                                                                                                                                                                                                                                                                                                                                                                      +  // Assuming a table prefix of `wp_` it will return `wp_23_`;
                                                                                                                                                                                                                                                                                                                                                                      +  $tablePrefix = $I->grabTablePrefix();
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      grabTermIdFromDatabase

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Gets a term ID from the database. Looks up the prefixed terms table, e.g. wp_terms.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      // Return the 'fiction' term 'term_id'.
                                                                                                                                                                                                                                                                                                                                                                      +  $termId = $I->grabTermIdFromDatabase(['name' => 'fiction']);
                                                                                                                                                                                                                                                                                                                                                                      +  // Get a term ID by more stringent criteria.
                                                                                                                                                                                                                                                                                                                                                                      +  $termId = $I->grabTermIdFromDatabase(['name' => 'fiction', 'slug' => 'genre--fiction']);
                                                                                                                                                                                                                                                                                                                                                                      +  // Return the 'term_id' of the first term for a group.
                                                                                                                                                                                                                                                                                                                                                                      +  $termId = $I->grabTermIdFromDatabase(['term_group' => 23]);
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • \Codeception\Module\array/array $criteria - An array of search criteria.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      grabTermMetaTableName

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Gets the terms meta table prefixed name.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      // Returns 'wp_termmeta'.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->grabTermMetaTableName();
                                                                                                                                                                                                                                                                                                                                                                      +  // Returns 'wp_23_termmeta'.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->useBlog(23);
                                                                                                                                                                                                                                                                                                                                                                      +  $I->grabTermMetaTableName();
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      grabTermRelationshipsTableName

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Gets the prefixed term relationships table name, e.g. wp_term_relationships.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $I->grabTermRelationshipsTableName();
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      grabTermTaxonomyIdFromDatabase

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Gets a term_taxonomy_id from the database. Looks up the prefixed terms_relationships table, e.g. wp_term_relationships.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      // Get the `term_taxonomy_id` for a term and a taxonomy.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->grabTermTaxonomyIdFromDatabase(['term_id' => $fictionId, 'taxonomy' => 'genre']);
                                                                                                                                                                                                                                                                                                                                                                      +  // Get the `term_taxonomy_id` for the first term with a count of 23.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->grabTermTaxonomyIdFromDatabase(['count' => 23]);
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • \Codeception\Module\array/array $criteria - An array of search criteria.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      grabTermTaxonomyTableName

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Gets the prefixed term and taxonomy table name, e.g. wp_term_taxonomy.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      // Returns 'wp_term_taxonomy'.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->grabTermTaxonomyTableName();
                                                                                                                                                                                                                                                                                                                                                                      +  // Returns 'wp_23_term_taxonomy'.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->useBlog(23);
                                                                                                                                                                                                                                                                                                                                                                      +  $I->grabTermTaxonomyTableName();
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      grabTermsTableName

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Gets the prefixed terms table name, e.g. wp_terms.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      // Returns 'wp_terms'.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->grabTermsTableName();
                                                                                                                                                                                                                                                                                                                                                                      +  // Returns 'wp_23_terms'.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->useBlog(23);
                                                                                                                                                                                                                                                                                                                                                                      +  $I->grabTermsTableName();
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      grabUserIdFromDatabase

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Gets the a user ID from the database using the user login.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $userId = $I->grabUserIdFromDatabase('luca');
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string $userLogin - The user login name.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      grabUserMetaFromDatabase

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Gets a user meta from the database.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      // Returns a user 'karma' value.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->grabUserMetaFromDatabase($userId, 'karma');
                                                                                                                                                                                                                                                                                                                                                                      +  // Returns an array, the unserialized version of the value stored in the database.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->grabUserMetaFromDatabase($userId, 'api_data');
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • int $userId - The ID of th user to get the meta for.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • string $meta_key - The meta key to fetch the value for.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      grabUsermetaTableName

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Returns the prefixed users meta table name.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      // Given a `wp_` table prefix returns `wp_usermeta`.
                                                                                                                                                                                                                                                                                                                                                                      +  $usermetaTable = $I->grabUsermetaTableName();
                                                                                                                                                                                                                                                                                                                                                                      +  // Given a `wp_` table prefix returns `wp_usermeta`.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->useBlog(23);
                                                                                                                                                                                                                                                                                                                                                                      +  $usermetaTable = $I->grabUsermetaTableName();
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      grabUsersTableName

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Returns the prefixed users table name.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      // Given a `wp_` table prefix returns `wp_users`.
                                                                                                                                                                                                                                                                                                                                                                      +  $usersTable = $I->grabUsersTableName();
                                                                                                                                                                                                                                                                                                                                                                      +  // Given a `wp_` table prefix returns `wp_users`.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->useBlog(23);
                                                                                                                                                                                                                                                                                                                                                                      +  $usersTable = $I->grabUsersTableName();
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      haveAttachmentInDatabase

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Creates the database entries representing an attachment and moves the attachment file to the right location. timestamp that should be used to build the "year/time" uploads sub-folder structure. override the image sizes created by default.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $file = codecept_data_dir('images/test.png');
                                                                                                                                                                                                                                                                                                                                                                      +  $attachmentId = $I->haveAttachmentInDatabase($file);
                                                                                                                                                                                                                                                                                                                                                                      +  $image = codecept_data_dir('images/test-2.png');
                                                                                                                                                                                                                                                                                                                                                                      +  $lastWeekAttachment = $I->haveAttachmentInDatabase($image, '-1 week');
                                                                                                                                                                                                                                                                                                                                                                      +  Requires the WPFilesystem module.
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string $file - The absolute path to the attachment file.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • string/string/int $date - Either a string supported by the strtotime function or a UNIX
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • array/\Codeception\Module\array/array $overrides - An associative array of values overriding the default ones.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • \Codeception\Module\array> $imageSizes - An associative array in the format [ => [,]] to
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      haveBlogInDatabase

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Inserts a blog in the blogs table.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      // Create the `test` subdomain blog.
                                                                                                                                                                                                                                                                                                                                                                      +  $blogId = $I->haveBlogInDatabase('test', ['administrator' => $userId]);
                                                                                                                                                                                                                                                                                                                                                                      +  // Create the `/test` subfolder blog.
                                                                                                                                                                                                                                                                                                                                                                      +  $blogId = $I->haveBlogInDatabase('test', ['administrator' => $userId], false);
                                                                                                                                                                                                                                                                                                                                                                      +  or subfolder (`true`)
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string $domainOrPath - The subdomain or the path to the be used for the blog.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • array/\Codeception\Module\array/array $overrides - An array of values to override the defaults.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • bool $subdomain - Whether the new blog should be created as a subdomain (true)
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      haveCommentInDatabase

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Inserts a comment in the database.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $I->haveCommentInDatabase($postId, ['comment_content' => 'Test Comment', 'comment_karma' => 23]);
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • int $comment_post_ID - The id of the post the comment refers to.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • array/\Codeception\Module\array/array $data - The comment data overriding default and random generated values.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      haveCommentMetaInDatabase

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Inserts a comment meta field in the database. Array and object meta values will be serialized.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $I->haveCommentMetaInDatabase($commentId, 'api_ID', 23);
                                                                                                                                                                                                                                                                                                                                                                      +  // The value will be serialized.
                                                                                                                                                                                                                                                                                                                                                                      +  $apiData = ['ID' => 23, 'user' => 89, 'origin' => 'twitter'];
                                                                                                                                                                                                                                                                                                                                                                      +  $I->haveCommentMetaInDatabase($commentId, 'api_data', $apiData);
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • int $comment_id - The ID of the comment to insert the meta for.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • string $meta_key - The key of the comment meta to insert.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • mixed $meta_value - The value of the meta to insert, if serializable it will be serialized.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      haveLinkInDatabase

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Inserts a link in the database.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $linkId = $I->haveLinkInDatabase(['link_url' => 'http://example.org']);
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • array/\Codeception\Module\array/array $overrides - The data to insert.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      haveManyBlogsInDatabase

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Inserts many blogs in the database. by the count.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $blogIds = $I->haveManyBlogsInDatabase(3, ['domain' =>'test-{{n}}']);
                                                                                                                                                                                                                                                                                                                                                                      +  foreach($blogIds as $blogId){
                                                                                                                                                                                                                                                                                                                                                                      +  $I->useBlog($blogId);
                                                                                                                                                                                                                                                                                                                                                                      +  $I->haveManuPostsInDatabase(3);
                                                                                                                                                                                                                                                                                                                                                                      +  }
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • int $count - The number of blogs to create.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • array/\Codeception\Module\array/array $overrides - An array of values to override the default ones; {{n}} will be replaced
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • bool $subdomain - Whether the new blogs should be created as a subdomain or subfolder.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      haveManyCommentsInDatabase

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Inserts many comments in the database.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      // Insert 3 random comments for a post.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->haveManyCommentsInDatabase(3, $postId);
                                                                                                                                                                                                                                                                                                                                                                      +  // Insert 3 random comments for a post.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->haveManyCommentsInDatabase(3, $postId, ['comment_content' => 'Comment {{n}}']);
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • int $count - The number of comments to insert.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • int $comment_post_ID - The comment parent post ID.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • array/\Codeception\Module\array/array $overrides - An associative array to override the defaults.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      haveManyLinksInDatabase

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Inserts many links in the database links table.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      // Insert 3 randomly generated links in the database.
                                                                                                                                                                                                                                                                                                                                                                      +  $linkIds = $I->haveManyLinksInDatabase(3);
                                                                                                                                                                                                                                                                                                                                                                      +  // Inserts links in the database replacing the `n` placeholder.
                                                                                                                                                                                                                                                                                                                                                                      +  $linkIds = $I->haveManyLinksInDatabase(3, ['link_url' => 'http://example.org/test-{{n}}']);
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • int $count - The number of links to insert.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • array/\Codeception\Module\array/array $overrides - Overrides for the default arguments.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      haveManyPostsInDatabase

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Inserts many posts in the database returning their IDs. An array of values to override the defaults. The {{n}} placeholder can be used to have the post count inserted in its place; e.g. Post Title - {{n}} will be set to Post Title - 0 for the first post, Post Title - 1 for the second one and so on. The same applies to meta values as well.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      // Insert 3 random posts.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->haveManyPostsInDatabase(3);
                                                                                                                                                                                                                                                                                                                                                                      +  // Insert 3 posts with generated titles.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->haveManyPostsInDatabase(3, ['post_title' => 'Test post {{n}}']);
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • int $count - The number of posts to insert.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • array/\Codeception\Module\array/array $overrides
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      haveManyTermsInDatabase

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Inserts many terms in the database.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $terms = $I->haveManyTermsInDatabase(3, 'genre-{{n}}', 'genre');
                                                                                                                                                                                                                                                                                                                                                                      +  $termIds = array_column($terms, 0);
                                                                                                                                                                                                                                                                                                                                                                      +  $termTaxonomyIds = array_column($terms, 1);
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • int $count - The number of terms to insert.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • string $name - The term name template, can include the {{n}} placeholder.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • string $taxonomy - The taxonomy to insert the terms for.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • array/\Codeception\Module\array/array $overrides - An associative array of default overrides.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      haveManyUsersInDatabase

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Inserts many users in the database.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $subscribers = $I->haveManyUsersInDatabase(5, 'user-{{n}}');
                                                                                                                                                                                                                                                                                                                                                                      +  $editors = $I->haveManyUsersInDatabase(
                                                                                                                                                                                                                                                                                                                                                                      +  5,
                                                                                                                                                                                                                                                                                                                                                                      +  'user-{{n}}',
                                                                                                                                                                                                                                                                                                                                                                      +  'editor',
                                                                                                                                                                                                                                                                                                                                                                      +  ['user_email' => 'user-{{n}}@example.org']
                                                                                                                                                                                                                                                                                                                                                                      +  );
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • int $count - The number of users to insert.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • string $user_login - The user login name.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • string $role - The user role.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • array/\Codeception\Module\array/array $overrides - An array of values to override the default ones.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      haveMenuInDatabase

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Creates and adds a menu to a theme location in the database.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      list($termId, $termTaxId) = $I->haveMenuInDatabase('test', 'sidebar');
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string $slug - The menu slug.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • string $location - The theme menu location the menu will be assigned to.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • array/\Codeception\Module\array/array $overrides - An array of values to override the defaults.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      haveMenuItemInDatabase

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Adds a menu element to a menu for the current theme. post meta.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $I->haveMenuInDatabase('test', 'sidebar');
                                                                                                                                                                                                                                                                                                                                                                      +  $I->haveMenuItemInDatabase('test', 'Test one', 0);
                                                                                                                                                                                                                                                                                                                                                                      +  $I->haveMenuItemInDatabase('test', 'Test two', 1);
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string $menuSlug - The menu slug the item should be added to.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • string $title - The menu item title.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • int/null $menuOrder - An optional menu order, 1 based.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • array/\Codeception\Module\array/array $meta - An associative array that will be prefixed with _menu_item_ for the item
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      haveOptionInDatabase

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Inserts an option in the database.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $I->haveOptionInDatabase('posts_per_page', 23);
                                                                                                                                                                                                                                                                                                                                                                      +  $I->haveOptionInDatabase('my_plugin_options', ['key_one' => 'value_one', 'key_two' => 89]);
                                                                                                                                                                                                                                                                                                                                                                      +  If the option value is an object or an array then the value will be serialized.
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string $option_name - The option name.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • mixed $option_value - The option value; if an array or object it will be serialized.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • string $autoload - Weather the option should be autoloaded by WordPress or not.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      havePageInDatabase

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Inserts a page in the database.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      // Creates a test page in the database with random values.
                                                                                                                                                                                                                                                                                                                                                                      +  $randomPageId = $I->havePageInDatabase();
                                                                                                                                                                                                                                                                                                                                                                      +  // Creates a test page in the database defining its title.
                                                                                                                                                                                                                                                                                                                                                                      +  $testPageId = $I->havePageInDatabase(['post_title' => 'Test page']);
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • array/\Codeception\Module\array/array $overrides - An array of values to override the default ones.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      havePostInDatabase

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Inserts a post in the database. values.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      // Insert a post with random values in the database.
                                                                                                                                                                                                                                                                                                                                                                      +  $randomPostId = $I->havePostInDatabase();
                                                                                                                                                                                                                                                                                                                                                                      +  // Insert a post with specific values in the database.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->havePostInDatabase([
                                                                                                                                                                                                                                                                                                                                                                      +  'post_type' => 'book',
                                                                                                                                                                                                                                                                                                                                                                      +  'post_title' => 'Alice in Wonderland',
                                                                                                                                                                                                                                                                                                                                                                      +  'meta_input' => [
                                                                                                                                                                                                                                                                                                                                                                      +  'readers_count' => 23
                                                                                                                                                                                                                                                                                                                                                                      +  ],
                                                                                                                                                                                                                                                                                                                                                                      +  'tax_input' => [
                                                                                                                                                                                                                                                                                                                                                                      +  ['genre' => 'fiction']
                                                                                                                                                                                                                                                                                                                                                                      +  ]
                                                                                                                                                                                                                                                                                                                                                                      +  ]);
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • array/\Codeception\Module\array/array $data - An associative array of post data to override default and random generated
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      havePostThumbnailInDatabase

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Assigns the specified attachment ID as thumbnail (featured image) to a post.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $attachmentId = $I->haveAttachmentInDatabase(codecept_data_dir('some-image.png'));
                                                                                                                                                                                                                                                                                                                                                                      +  $postId = $I->havePostInDatabase();
                                                                                                                                                                                                                                                                                                                                                                      +  $I->havePostThumbnailInDatabase($postId, $attachmentId);
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • int $postId - The post ID to assign the thumbnail (featured image) to.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • int $thumbnailId - The post ID of the attachment.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      havePostmetaInDatabase

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Adds one or more meta key and value couples in the database for a post.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      // Set the post-meta for a post.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->havePostmetaInDatabase($postId, 'karma', 23);
                                                                                                                                                                                                                                                                                                                                                                      +  // Set an array post-meta for a post, it will be serialized in the db.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->havePostmetaInDatabase($postId, 'data', ['one', 'two']);
                                                                                                                                                                                                                                                                                                                                                                      +  // Use a loop to insert one meta per row.
                                                                                                                                                                                                                                                                                                                                                                      +  foreach( ['one', 'two'] as $value){
                                                                                                                                                                                                                                                                                                                                                                      +  $I->havePostmetaInDatabase($postId, 'data', $value);
                                                                                                                                                                                                                                                                                                                                                                      +  }
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • int $postId - The post ID.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • string $meta_key - The meta key.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • mixed $meta_value - The value to insert in the database, objects and arrays will be serialized.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      haveSiteOptionInDatabase

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Inserts a site option in the database. If the value is an array or an object then the value will be serialized.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $fooCountOptionId = $I->haveSiteOptionInDatabase('foo_count','23');
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string $key - The name of the option to insert.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • mixed $value - The value to insert for the option.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      haveSiteTransientInDatabase

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Inserts a site transient in the database. If the value is an array or an object then the value will be serialized.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $I->haveSiteTransientInDatabase('total_comments_count', 23);
                                                                                                                                                                                                                                                                                                                                                                      +  // This value will be serialized.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->haveSiteTransientInDatabase('api_data', ['user' => 'luca', 'token' => '11ae3ijns-j83']);
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string $key - The key of the site transient to insert, w/o the _site_transient_ prefix.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • mixed $value - The value to insert; if serializable the value will be serialized.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      haveTermInDatabase

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Inserts a term in the database.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      // Insert a random 'genre' term in the database.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->haveTermInDatabase('non-fiction', 'genre');
                                                                                                                                                                                                                                                                                                                                                                      +  // Insert a term in the database with term meta.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->haveTermInDatabase('fiction', 'genre', [
                                                                                                                                                                                                                                                                                                                                                                      +  'slug' => 'genre--fiction',
                                                                                                                                                                                                                                                                                                                                                                      +  'meta' => [
                                                                                                                                                                                                                                                                                                                                                                      +  'readers_count' => 23
                                                                                                                                                                                                                                                                                                                                                                      +  ]
                                                                                                                                                                                                                                                                                                                                                                      +  ]);
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string $name - The term name, e.g. "Fuzzy".
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • string $taxonomy - The term taxonomy
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • array/\Codeception\Module\array/array $overrides - An array of values to override the default ones.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      haveTermMetaInDatabase

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Inserts a term meta row in the database. Objects and array meta values will be serialized.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $I->haveTermMetaInDatabase($fictionId, 'readers_count', 23);
                                                                                                                                                                                                                                                                                                                                                                      +  // Insert some meta that will be serialized.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->haveTermMetaInDatabase($fictionId, 'flags', [3, 4, 89]);
                                                                                                                                                                                                                                                                                                                                                                      +  // Use a loop to insert one meta per row.
                                                                                                                                                                                                                                                                                                                                                                      +  foreach([3, 4, 89] as $value) {
                                                                                                                                                                                                                                                                                                                                                                      +  $I->haveTermMetaInDatabase($fictionId, 'flag', $value);
                                                                                                                                                                                                                                                                                                                                                                      +  }
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • int $term_id - The ID of the term to insert the meta for.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • string $meta_key - The key of the meta to insert.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • mixed $meta_value - The value of the meta to insert, if serializable it will be serialized.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      haveTermRelationshipInDatabase

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Creates a term relationship in the database. No check about the consistency of the insertion is made. E.g. a post could be assigned a term from a taxonomy that's not registered for that post type.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      // Assign the `fiction` term to a book.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->haveTermRelationshipInDatabase($bookId, $fictionId);
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • int $object_id - A post ID, a user ID or anything that can be assigned a taxonomy term.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • int $term_taxonomy_id - The term_taxonomy_id of the term and taxonomy to create a relation with.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • int $term_order - Defaults to 0.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      haveTransientInDatabase

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Inserts a transient in the database. If the value is an array or an object then the value will be serialized. Since the transients are set in the context of tests it's not possible to set an expiration directly.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      // Store an array in the `tweets` transient.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->haveTransientInDatabase('tweets', $tweets);
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string $transient - The transient name.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • mixed $value - The transient value.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      haveUserCapabilitiesInDatabase

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Sets a user capabilities in the database.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      // Assign one user a role in a blog.
                                                                                                                                                                                                                                                                                                                                                                      +  $blogId = $I->haveBlogInDatabase('test');
                                                                                                                                                                                                                                                                                                                                                                      +  $editor = $I->haveUserInDatabase('luca', 'editor');
                                                                                                                                                                                                                                                                                                                                                                      +  $capsIds = $I->haveUserCapabilitiesInDatabase($editor, [$blogId => 'editor']);
                                                                                                                                                                                                                                                                                                                                                                      +  // Assign a user two roles in blog 1.
                                                                                                                                                                                                                                                                                                                                                                      +  $capsIds = $I->haveUserCapabilitiesInDatabase($userId, ['editor', 'subscriber']);
                                                                                                                                                                                                                                                                                                                                                                      +  // Assign one user different roles in different blogs.
                                                                                                                                                                                                                                                                                                                                                                      +  $capsIds = $I->haveUserCapabilitiesInDatabase($userId, [$blogId1 => 'editor', $blogId2 => 'author']);
                                                                                                                                                                                                                                                                                                                                                                      +  // Assign a user a role and an additional capability in blog 1.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->haveUserCapabilitiesInDatabase($userId, ['editor' => true, 'edit_themes' => true]);
                                                                                                                                                                                                                                                                                                                                                                      +  // Assign a user a mix of roles and capabilities in different blogs.
                                                                                                                                                                                                                                                                                                                                                                      +  $capsIds = $I->haveUserCapabilitiesInDatabase(
                                                                                                                                                                                                                                                                                                                                                                      +  $userId,
                                                                                                                                                                                                                                                                                                                                                                      +  [
                                                                                                                                                                                                                                                                                                                                                                      +  $blogId1 => ['editor' => true, 'edit_themes' => true],
                                                                                                                                                                                                                                                                                                                                                                      +  $blogId2 => ['administrator' => true, 'edit_themes' => false]
                                                                                                                                                                                                                                                                                                                                                                      +  ]
                                                                                                                                                                                                                                                                                                                                                                      +  );
                                                                                                                                                                                                                                                                                                                                                                      +  associative array of blog IDs/roles for a multisite
                                                                                                                                                                                                                                                                                                                                                                      +  installation (e.g. `[1 => 'administrator`, 2 =>
                                                                                                                                                                                                                                                                                                                                                                      +  'subscriber']`).
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • int $userId - The ID of the user to set the capabilities of.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • string/\Codeception\Module\array/\Codeception\Module\array $role - Either a role string (e.g. administrator),an
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      haveUserInDatabase

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Inserts a user and its meta in the database. defaults to subscriber. If more than one role is specified, then the first role in the list will be the user primary role and the wp_user_level will be set to that role. in the users and usermeta table.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      // Create an editor user in blog 1 w/ specific email.
                                                                                                                                                                                                                                                                                                                                                                      +  $userId = $I->haveUserInDatabase('luca', 'editor', ['user_email' => 'luca@example.org']);
                                                                                                                                                                                                                                                                                                                                                                      +  // Create a subscriber user in blog 1.
                                                                                                                                                                                                                                                                                                                                                                      +  $subscriberId = $I->haveUserInDatabase('subscriber');
                                                                                                                                                                                                                                                                                                                                                                      +  // Create a user editor in blog 1, author in blog 2, administrator in blog 3.
                                                                                                                                                                                                                                                                                                                                                                      +  $userWithMeta = $I->haveUserInDatabase('luca',
                                                                                                                                                                                                                                                                                                                                                                      +  [
                                                                                                                                                                                                                                                                                                                                                                      +  1 => 'editor',
                                                                                                                                                                                                                                                                                                                                                                      +  2 => 'author',
                                                                                                                                                                                                                                                                                                                                                                      +  3 => 'administrator'
                                                                                                                                                                                                                                                                                                                                                                      +  ], [
                                                                                                                                                                                                                                                                                                                                                                      +  'user_email' => 'luca@example.org'
                                                                                                                                                                                                                                                                                                                                                                      +  'meta' => ['a meta_key' => 'a_meta_value']
                                                                                                                                                                                                                                                                                                                                                                      +  ]
                                                                                                                                                                                                                                                                                                                                                                      +  );
                                                                                                                                                                                                                                                                                                                                                                      +  // Create editor in blog 1 w/ `edit_themes` cap, author in blog 2, admin in blog 3 w/o `manage_options` cap.
                                                                                                                                                                                                                                                                                                                                                                      +  $userWithMeta = $I->haveUserInDatabase('luca',
                                                                                                                                                                                                                                                                                                                                                                      +  [
                                                                                                                                                                                                                                                                                                                                                                      +  1 => ['editor', 'edit_themes'],
                                                                                                                                                                                                                                                                                                                                                                      +  2 => 'author',
                                                                                                                                                                                                                                                                                                                                                                      +  3 => ['administrator' => true, 'manage_options' => false]
                                                                                                                                                                                                                                                                                                                                                                      +  ]
                                                                                                                                                                                                                                                                                                                                                                      +  );
                                                                                                                                                                                                                                                                                                                                                                      +  // Create a user w/o role.
                                                                                                                                                                                                                                                                                                                                                                      +  $userId = $I->haveUserInDatabase('luca', '');
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string $user_login - The user login name.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • string/string/\Codeception\Module\array $role - The user role slug(s), e.g. administrator or ['author', 'editor'];
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • array/\Codeception\Module\array/array $overrides - An associative array of column names and values overriding defaults
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      haveUserLevelsInDatabase

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Sets the user access level meta in the database for a user. IDs/roles for a multisite installation (e.g. [1 => 'administrator, 2 => 'subscriber']`).

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $userId = $I->haveUserInDatabase('luca', 'editor');
                                                                                                                                                                                                                                                                                                                                                                      +  $moreThanAnEditorLessThanAnAdmin = 8;
                                                                                                                                                                                                                                                                                                                                                                      +  $I->haveUserLevelsInDatabase($userId, $moreThanAnEditorLessThanAnAdmin);
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • int $userId - The ID of the user to set the level for.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • \Codeception\Module\array/string $role - Either a role string (e.g. administrator) or an array of blog
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      haveUserMetaInDatabase

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Sets a user meta in the database.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $userId = $I->haveUserInDatabase('luca', 'editor');
                                                                                                                                                                                                                                                                                                                                                                      +  $I->haveUserMetaInDatabase($userId, 'karma', 23);
                                                                                                                                                                                                                                                                                                                                                                      +  values will trigger the insertion of multiple rows.
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • int $userId - The user ID.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • string $meta_key - The meta key to set the value for.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • mixed $meta_value - Either a single value or an array of values; objects will be serialized while array of
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      importSql

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Loads a set SQL code lines in the current database.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      // Import a SQL string.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->importSql([$sqlString]);
                                                                                                                                                                                                                                                                                                                                                                      +  // Import a set of SQL strings.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->importSql($sqlStrings);
                                                                                                                                                                                                                                                                                                                                                                      +  // Import a prepared set of SQL strings.
                                                                                                                                                                                                                                                                                                                                                                      +  $preparedSqlStrings = array_map(function($line){
                                                                                                                                                                                                                                                                                                                                                                      +  return str_replace('{{date}}', date('Y-m-d H:i:s'), $line);
                                                                                                                                                                                                                                                                                                                                                                      +  }, $sqlTemplate);
                                                                                                                                                                                                                                                                                                                                                                      +  $I->importSql($preparedSqlStrings);
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • \Codeception\Module\array/array $sql - The SQL strings to load.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      importSqlDumpFile

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Import the SQL dump file if populate is enabled.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      // Import a dump file passing the absolute path.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->importSqlDumpFile(codecept_data_dir('dumps/start.sql'));
                                                                                                                                                                                                                                                                                                                                                                      +  Specifying a dump file that file will be imported.
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string/null $dumpFile - The dump file that should be imported in place of the default one.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      seeAttachmentInDatabase

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Checks for an attachment in the database.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $url = 'https://example.org/images/foo.png';
                                                                                                                                                                                                                                                                                                                                                                      +  $I->seeAttachmentInDatabase(['guid' => $url]);
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • \Codeception\Module\array/array $criteria - An array of search criteria.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      seeBlogInDatabase

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Checks for a blog in the blogs table.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      // Search for a blog by `blog_id`.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->seeBlogInDatabase(['blog_id' => 23]);
                                                                                                                                                                                                                                                                                                                                                                      +  // Search for all blogs on a path.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->seeBlogInDatabase(['path' => '/sub-path/']);
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • \Codeception\Module\array/array $criteria - An array of search criteria.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      seeCommentInDatabase

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Checks for a comment in the database. Will look up the "comments" table.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $I->seeCommentInDatabase(['comment_ID' => 23]);
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • \Codeception\Module\array/array $criteria - An array of search criteria.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      seeCommentMetaInDatabase

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Checks that a comment meta value is in the database. Will look up the "commentmeta" table.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      // Assert a specified meta for a comment exists.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->seeCommentMetaInDatabase(['comment_ID' => $commentId, 'meta_key' => 'karma', 'meta_value' => 23]);
                                                                                                                                                                                                                                                                                                                                                                      +  // Assert the comment has at least one meta set.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->seeCommentMetaInDatabase(['comment_ID' => $commentId]);
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • \Codeception\Module\array/array $criteria - An array of search criteria.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      seeLinkInDatabase

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Checks for a link in the links table of the database.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      // Asserts a link exists by name.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->seeLinkInDatabase(['link_name' => 'my-link']);
                                                                                                                                                                                                                                                                                                                                                                      +  // Asserts at least one link exists for the user.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->seeLinkInDatabase(['link_owner' => $userId]);
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • \Codeception\Module\array/array $criteria - An array of search criteria.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      seeOptionInDatabase

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Checks if an option is in the database for the current blog, either by criteria or by name and value. If checking for an array or an object then the serialized version will be checked for.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      // Checks an option is in the database.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->seeOptionInDatabase('tables_version');
                                                                                                                                                                                                                                                                                                                                                                      +  // Checks an option is in the database and has a specific value.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->seeOptionInDatabase('tables_version', '1.0');
                                                                                                                                                                                                                                                                                                                                                                      +  $I->seeOptionInDatabase(['option_name' => 'tables_version', 'option_value' => 1.0']);
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • \Codeception\Module\array/string $criteriaOrName - An array of search criteria or the option name.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • mixed/null $value - The optional value to try and match, only used if the option name is provided.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      seePageInDatabase

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Checks for a page in the database.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      // Asserts a page with an exists in the database.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->seePageInDatabase(['ID' => 23]);
                                                                                                                                                                                                                                                                                                                                                                      +  // Asserts a page with a slug and ID exists in the database.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->seePageInDatabase(['post_title' => 'Test Page', 'ID' => 23]);
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • \Codeception\Module\array/array $criteria - An array of search criteria.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      seePostInDatabase

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Checks for a post in the database.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      // Assert a post exists in the database.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->seePostInDatabase(['ID' => 23]);
                                                                                                                                                                                                                                                                                                                                                                      +  // Assert a post with a slug and ID exists in the database.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->seePostInDatabase(['post_content' => 'test content', 'ID' => 23]);
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • \Codeception\Module\array/array $criteria - An array of search criteria.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      seePostMetaInDatabase

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Checks for a post meta value in the database for the current blog. If the meta_value is an object or an array then the check will be made for serialized values.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $postId = $I->havePostInDatabase(['meta_input' => ['foo' => 'bar']];
                                                                                                                                                                                                                                                                                                                                                                      +  $I->seePostMetaInDatabase(['post_id' => '$postId', 'meta_key' => 'foo']);
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • \Codeception\Module\array/array $criteria - An array of search criteria.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      seePostWithTermInDatabase

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Checks that a post to term relation exists in the database. The method will check the "term_relationships" table.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $fiction = $I->haveTermInDatabase('fiction', 'genre');
                                                                                                                                                                                                                                                                                                                                                                      +  $postId = $I->havePostInDatabase(['tax_input' => ['genre' => ['fiction']]]);
                                                                                                                                                                                                                                                                                                                                                                      +  $I->seePostWithTermInDatabase($postId, $fiction['term_taxonomy_id']);
                                                                                                                                                                                                                                                                                                                                                                      +  passed this parameter will be interpreted as a `term_id`, else as a
                                                                                                                                                                                                                                                                                                                                                                      +  the
                                                                                                                                                                                                                                                                                                                                                                      +  term order.
                                                                                                                                                                                                                                                                                                                                                                      +  to build a `taxonomy_term_id` from the `term_id`.
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • int $post_id - The post ID.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • int $term_taxonomy_id - The term term_id or term_taxonomy_id; if the $taxonomy argument is
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • int/null $term_order - The order the term applies to the post, defaults to null to not use
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • string/null $taxonomy - The taxonomy the term_id is for; if passed this parameter will be used
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      seeSiteOptionInDatabase

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Checks that a site option is in the database.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      // Check that the option is set in the database.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->seeSiteOptionInDatabase('foo_count');
                                                                                                                                                                                                                                                                                                                                                                      +  // Check that the option is set and has a specific value.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->seeSiteOptionInDatabase('foo_count', 23);
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • \Codeception\Module\array/string $criteriaOrName - An array of search criteria or the option name.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • mixed/null $value - The optional value to try and match, only used if the option name is provided.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      seeSiteSiteTransientInDatabase

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Checks that a site option is in the database.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      // Check a transient exists.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->seeSiteSiteTransientInDatabase('total_counts');
                                                                                                                                                                                                                                                                                                                                                                      +  // Check a transient exists and has a specific value.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->seeSiteSiteTransientInDatabase('total_counts', 23);
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string $key - The name of the transient to check for, w/o the _site_transient_ prefix.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • mixed/null $value - If provided then the assertion will include the value.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      seeTableInDatabase

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Checks that a table is in the database.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $options = $I->grabPrefixedTableNameFor('options');
                                                                                                                                                                                                                                                                                                                                                                      +  $I->seeTableInDatabase($options);
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string $table - The full table name, including the table prefix.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      seeTermInDatabase

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Checks for a term in the database. Looks up the terms and term_taxonomy prefixed tables. and the term_taxonomy tables.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $I->seeTermInDatabase(['slug' => 'genre--fiction']);
                                                                                                                                                                                                                                                                                                                                                                      +  $I->seeTermInDatabase(['name' => 'Fiction', 'slug' => 'genre--fiction']);
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • \Codeception\Module\array/array $criteria - An array of criteria to search for the term, can be columns from the terms
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      seeTermMetaInDatabase

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Checks for a term meta in the database.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      list($termId, $termTaxonomyId) = $I->haveTermInDatabase('fiction', 'genre');
                                                                                                                                                                                                                                                                                                                                                                      +  $I->haveTermMetaInDatabase($termId, 'rating', 4);
                                                                                                                                                                                                                                                                                                                                                                      +  $I->seeTermMetaInDatabase(['term_id' => $termId,'meta_key' => 'rating', 'meta_value' => 4]);
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • \Codeception\Module\array/array $criteria - An array of search criteria.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      seeTermRelationshipInDatabase

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Checks for a term relationship in the database.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $postId = $I->havePostInDatabase(['tax_input' => ['category' => 'one']]);
                                                                                                                                                                                                                                                                                                                                                                      +  $I->seeTermRelationshipInDatabase(['object_id' => $postId, 'term_taxonomy_id' => $oneTermTaxId]);
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • \Codeception\Module\array/array $criteria - An array of search criteria.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      seeTermTaxonomyInDatabase

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Checks for a taxonomy taxonomy in the database.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      list($termId, $termTaxonomyId) = $I->haveTermInDatabase('fiction', 'genre');
                                                                                                                                                                                                                                                                                                                                                                      +  $I->seeTermTaxonomyInDatabase(['term_id' => $termId, 'taxonomy' => 'genre']);
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • \Codeception\Module\array/array $criteria - An array of search criteria.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      seeUserInDatabase

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Checks that a user is in the database. The method will check the "users" table.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $I->seeUserInDatabase([
                                                                                                                                                                                                                                                                                                                                                                      +  "user_email" => "test@example.org",
                                                                                                                                                                                                                                                                                                                                                                      +  "user_login" => "login name"
                                                                                                                                                                                                                                                                                                                                                                      +  ])
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • \Codeception\Module\array/array $criteria - An array of search criteria.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      seeUserMetaInDatabase

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Checks for a user meta value in the database.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $I->seeUserMetaInDatabase(['user_id' => 23, 'meta_key' => 'karma']);
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • \Codeception\Module\array/array $criteria - An array of search criteria.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      useBlog

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Sets the blog to be used. This has nothing to do with WordPress switch_to_blog function, this code will affect the table prefixes used.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      // Switch to the blog with ID 23.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->useBlog(23);
                                                                                                                                                                                                                                                                                                                                                                      +  // Switch back to the main blog.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->useMainBlog();
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • int $blogId - The ID of the blog to use.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      useMainBlog

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Sets the current blog to the main one (blog_id 1).

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      // Switch to the blog with ID 23.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->useBlog(23);
                                                                                                                                                                                                                                                                                                                                                                      +  // Switch back to the main blog.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->useMainBlog();
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      useTheme

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Sets the current theme options.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $I->useTheme('twentyseventeen');
                                                                                                                                                                                                                                                                                                                                                                      +  $I->useTheme('child-of-twentyseventeen', 'twentyseventeen');
                                                                                                                                                                                                                                                                                                                                                                      +  $I->useTheme('acme', 'acme', 'Acme Theme');
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string $stylesheet - The theme stylesheet slug, e.g. twentysixteen.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • string $template - The theme template slug, e.g. twentysixteen, defaults to $stylesheet.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • string $themeName - The theme name, e.g. Acme, defaults to the "title" version of
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      This class extends \Codeception\Module\Db

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      This class implements \Codeception\Lib\Interfaces\Db

                                                                                                                                                                                                                                                                                                                                                                      + + + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + + + + + \ No newline at end of file diff --git a/docs/v3/modules/WPFilesystem/index.html b/docs/v3/modules/WPFilesystem/index.html new file mode 100644 index 000000000..fc3a3f18c --- /dev/null +++ b/docs/v3/modules/WPFilesystem/index.html @@ -0,0 +1,2967 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + WPFilesystem - wp-browser docs + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      + + +
                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      This is the documentation for version 3 of the project. +The current version is version 4 and the documentation can be found here.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      WPFilesystem module

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      This module should be used in acceptance and functional tests, see levels of testing for more information.
                                                                                                                                                                                                                                                                                                                                                                      +This module extends the Filesystem module adding WordPress-specific configuration parameters and methods.
                                                                                                                                                                                                                                                                                                                                                                      +The module provides methods to read, write and update the WordPress filesystem directly, without relying on WordPress methods, using WordPress functions or triggering WordPress filters.
                                                                                                                                                                                                                                                                                                                                                                      +This module also provides methods to scaffold plugins and themes on the fly in the context of tests and auto-remove them after each test.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Module requirements for Codeception 4.0+

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      This module requires the codeception/module-filesystem Composer package to work when wp-browser is used with Codeception 4.0.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      To install the package run:

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      composer require --dev codeception/module-filesystem:^1.0
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Configuration

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • wpRootFolder required The absolute, or relative to the project root folder, path to the root WordPress installation folder. The WordPress installation root folder is the one that contains the wp-load.php file.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • themes - defaults to /wp-content/themes; the path, relative to the the WordPress installation root folder, to the themes folder.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • plugins - defaults to /wp-content/plugins; the path, relative to the WordPress installation root folder, to the plugins folder.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • mu-plugins - defaults to wp-content/mu-plugins; the path, relative to the WordPress installation root folder, to the must-use plugins folder.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • uploads - defaults to /wp-content/uploads; the path, relative to the WordPress installation root folder, to the uploads folder.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Example configuration

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      modules:
                                                                                                                                                                                                                                                                                                                                                                      +    enabled:
                                                                                                                                                                                                                                                                                                                                                                      +        - WPFilesystem
                                                                                                                                                                                                                                                                                                                                                                      +    config:
                                                                                                                                                                                                                                                                                                                                                                      +        WPFilesystem:
                                                                                                                                                                                                                                                                                                                                                                      +            wpRootFolder: "/var/www/wordpress"
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + +

                                                                                                                                                                                                                                                                                                                                                                      Public API

                                                                                                                                                                                                                                                                                                                                                                      + + +

                                                                                                                                                                                                                                                                                                                                                                      amInMuPluginPath

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Sets the current working folder to a folder in a mu-plugin.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $I->amInMuPluginPath('mu-plugin');
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string $path - The path to the folder, relative to the mu-plugins root folder.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      amInPluginPath

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Sets the current working folder to a folder in a plugin.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $I->amInPluginPath('my-plugin');
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string $path - The folder path, relative to the root uploads folder, to change to.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      amInThemePath

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Sets the current working folder to a folder in a theme.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $I->amInThemePath('my-theme');
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string $path - The path to the theme folder, relative to themes root folder.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      amInUploadsPath

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Enters, changing directory, to the uploads folder in the local filesystem.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $I->amInUploadsPath('/logs');
                                                                                                                                                                                                                                                                                                                                                                      +  $I->seeFileFound('shop.log');
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string $path - The path, relative to the site uploads folder.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      cleanMuPluginDir

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Cleans, emptying it, a folder in a mu-plugin folder.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $I->cleanMuPluginDir('mu-plugin1/foo');
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string $dir - The path to the directory, relative to the mu-plugins root folder.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      cleanPluginDir

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Cleans, emptying it, a folder in a plugin folder.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $I->cleanPluginDir('my-plugin/foo');
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string $dir - The path to the folder, relative to the plugins root folder.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      cleanThemeDir

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Clears, emptying it, a folder in a theme folder.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $I->cleanThemeDir('my-theme/foo');
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string $dir - The path to the folder, relative to the themese root folder.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      cleanUploadsDir

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Clears a folder in the uploads folder. The date argument can be a string compatible with strtotime or a Unix timestamp that will be used to build the Y/m uploads subfolder path.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $I->cleanUploadsDir('some/folder');
                                                                                                                                                                                                                                                                                                                                                                      +  $I->cleanUploadsDir('some/folder', 'today');
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string $dir - The path to the directory to delete, relative to the uploads folder.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • string/int/[\DateTime](http://php.net/manual/en/class.datetime.php) $date - The date of the uploads to delete, will default to now.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      copyDirToMuPlugin

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Copies a folder to a folder in a mu-plugin.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $I->copyDirToMuPlugin(codecept_data_dir('foo'), 'mu-plugin/foo');
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string $src - The path to the source file to copy.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • string $pluginDst - The path to the destination folder, relative to the mu-plugins root folder.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      copyDirToPlugin

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Copies a folder to a folder in a plugin.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      // Copy the 'foo' folder to the 'foo' folder in the plugin.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->copyDirToPlugin(codecept_data_dir('foo'), 'my-plugin/foo');
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string $src - The path to the source directory to copy.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • string $pluginDst - The destination path, relative to the plugins root folder.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      copyDirToTheme

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Copies a folder in a theme folder.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $I->copyDirToTheme(codecept_data_dir('foo'), 'my-theme');
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string $src - The path to the source file.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • string $themeDst - The path to the destination folder, relative to the themes root folder.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      copyDirToUploads

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Copies a folder to the uploads folder. The date argument can be a string compatible with strtotime or a Unix timestamp that will be used to build the Y/m uploads subfolder path.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $I->copyDirToUploads(codecept_data_dir('foo'), 'uploadsFoo');
                                                                                                                                                                                                                                                                                                                                                                      +  $I->copyDirToUploads(codecept_data_dir('foo'), 'uploadsFoo', 'today');
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string $src - The path to the source file, relative to the current uploads folder.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • string $dst - The path to the destination file, relative to the current uploads folder.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • string/int/[\DateTime](http://php.net/manual/en/class.datetime.php) $date - The date of the uploads to delete, will default to now.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      deleteMuPluginFile

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Deletes a file in a mu-plugin folder.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $I->deleteMuPluginFile('mu-plugin1/some-file.txt');
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string $file - The path to the file, relative to the mu-plugins root folder.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      deletePluginFile

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Deletes a file in a plugin folder.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $I->deletePluginFile('my-plugin/some-file.txt');
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string $file - The folder path, relative to the plugins root folder.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      deleteThemeFile

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Deletes a file in a theme folder.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $I->deleteThemeFile('my-theme/some-file.txt');
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string $file - The path to the file to delete, relative to the themes root folder.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      deleteUploadedDir

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Deletes a dir in the uploads folder. The date argument can be a string compatible with strtotime or a Unix timestamp that will be used to build the Y/m uploads subfolder path.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $I->deleteUploadedDir('folder');
                                                                                                                                                                                                                                                                                                                                                                      +  $I->deleteUploadedDir('folder', 'today');
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string $dir - The path to the directory to delete, relative to the uploads folder.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • string/int/[\DateTime](http://php.net/manual/en/class.datetime.php) $date - The date of the uploads to delete, will default to now.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      deleteUploadedFile

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Deletes a file in the uploads folder. The date argument can be a string compatible with strtotime or a Unix timestamp that will be used to build the Y/m uploads subfolder path.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $I->deleteUploadedFile('some-file.txt');
                                                                                                                                                                                                                                                                                                                                                                      +  $I->deleteUploadedFile('some-file.txt', 'today');
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string $file - The file path, relative to the uploads folder or the current folder.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • string/int $date - A string compatible with strtotime or a Unix timestamp.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      dontSeeInMuPluginFile

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Checks that a file in a mu-plugin folder does not contain a string.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $I->dontSeeInMuPluginFile('mu-plugin1/some-file.txt', 'foo');
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string $file - The path to the file, relative to the mu-plugins root folder.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • string $contents - The contents to check the file for.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      dontSeeInPluginFile

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Checks that a file in a plugin folder does not contain a string.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $I->dontSeeInPluginFile('my-plugin/some-file.txt', 'foo');
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string $file - The path to the file, relative to the plugins root folder.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • string $contents - The contents to check the file for.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      dontSeeInThemeFile

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Checks that a file in a theme folder does not contain a string.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $I->dontSeeInThemeFile('my-theme/some-file.txt', 'foo');
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string $file - The path to the file, relative to the themes root folder.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • string $contents - The contents to check the file for.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      dontSeeInUploadedFile

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Checks that a file in the uploads folder does contain a string. The date argument can be a string compatible with strtotime or a Unix timestamp that will be used to build the Y/m uploads subfolder path.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $I->dontSeeInUploadedFile('some-file.txt', 'foo');
                                                                                                                                                                                                                                                                                                                                                                      +  $I->dontSeeInUploadedFile('some-file.txt','foo', 'today');
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string $file - The file path, relative to the uploads folder or the current folder.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • string $contents - The not expected file contents or part of them.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • string/int $date - A string compatible with strtotime or a Unix timestamp.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      dontSeeMuPluginFileFound

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Checks that a file is not found in a mu-plugin folder.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $I->dontSeeMuPluginFileFound('mu-plugin1/some-file.txt');
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string $file - The path to the file, relative to the mu-plugins folder.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      dontSeePluginFileFound

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Checks that a file is not found in a plugin folder.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $I->dontSeePluginFileFound('my-plugin/some-file.txt');
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string $file - The path to the file, relative to the plugins root folder.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      dontSeeThemeFileFound

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Checks that a file is not found in a theme folder.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $I->dontSeeThemeFileFound('my-theme/some-file.txt');
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string $file - The path to the file, relative to the themes root folder.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      dontSeeUploadedFileFound

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Checks thata a file does not exist in the uploads folder. The date argument can be a string compatible with strtotime or a Unix timestamp that will be used to build the Y/m uploads subfolder path.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $I->dontSeeUploadedFileFound('some-file.txt');
                                                                                                                                                                                                                                                                                                                                                                      +  $I->dontSeeUploadedFileFound('some-file.txt','today');
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string $file - The file path, relative to the uploads folder or the current folder.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • string/int $date - A string compatible with strtotime or a Unix timestamp.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      getBlogUploadsPath

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Returns the absolute path to a blog uploads folder or file.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $blogId = $I->haveBlogInDatabase('test');
                                                                                                                                                                                                                                                                                                                                                                      +  $testTodayUploads = $I->getBlogUploadsPath($blogId);
                                                                                                                                                                                                                                                                                                                                                                      +  $testLastMonthLogs = $I->getBlogUploadsPath($blogId, '/logs', '-1 month');
                                                                                                                                                                                                                                                                                                                                                                      +  file or folder.
                                                                                                                                                                                                                                                                                                                                                                      +  sub-folders in the year/month format; a UNIX timestamp or
                                                                                                                                                                                                                                                                                                                                                                      +  a string supported by the `strtotime` function; defaults
                                                                                                                                                                                                                                                                                                                                                                      +  to `now`.
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • int $blogId - The blog ID to get the path for.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • string $file - The path, relatitve to the blog uploads folder, to the
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • null/string/[\DateTime](http://php.net/manual/en/class.datetime.php)/[\DateTime](http://php.net/manual/en/class.datetime.php)Immutable $date - The date that should be used to build the uploads
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      getUploadsPath

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Returns the path to the specified uploads file of folder. Not providing a value for $file and $date will return the uploads folder path.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $todaysPath = $I->getUploadsPath();
                                                                                                                                                                                                                                                                                                                                                                      +  $lastWeek = $I->getUploadsPath('', '-1 week');
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string $file - The file path, relative to the uploads folder.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • mixed $date - A string compatible with strtotime, a Unix timestamp or a Date object.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      getWpRootFolder

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Returns the absolute path to WordPress root folder without trailing slash.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $rootFolder = $I->getWpRootFolder();
                                                                                                                                                                                                                                                                                                                                                                      +  $I->assertFileExists($rootFolder . 'wp-load.php');
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      haveMuPlugin

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Creates a mu-plugin file, including plugin header, in the mu-plugins folder. The code can not contain the opening '<?php' tag.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $code = 'echo "Hello world!"';
                                                                                                                                                                                                                                                                                                                                                                      +  $I->haveMuPlugin('foo-mu-plugin.php', $code);
                                                                                                                                                                                                                                                                                                                                                                      +  // Load the code from a file.
                                                                                                                                                                                                                                                                                                                                                                      +  $code = file_get_contents(codecept_data_dir('code/mu-plugin.php'));
                                                                                                                                                                                                                                                                                                                                                                      +  $I->haveMuPlugin('foo-mu-plugin.php', $code);
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string $filename - The path to the file to create, relative to the plugins root folder.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • string $code - The content of the plugin file with or without the opening PHP tag.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      havePlugin

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Creates a plugin file, including plugin header, in the plugins folder. The plugin is just created and not activated; the code can not contain the opening '<?php' tag.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $code = 'echo "Hello world!"';
                                                                                                                                                                                                                                                                                                                                                                      +  $I->havePlugin('foo/plugin.php', $code);
                                                                                                                                                                                                                                                                                                                                                                      +  // Load the code from a file.
                                                                                                                                                                                                                                                                                                                                                                      +  $code = file_get_contents(codecept_data_dir('code/plugin.php'));
                                                                                                                                                                                                                                                                                                                                                                      +  $I->havePlugin('foo/plugin.php', $code);
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string $path - The path to the file to create, relative to the plugins folder.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • string $code - The content of the plugin file with or without the opening PHP tag.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      haveTheme

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Creates a theme file structure, including theme style file and index, in the themes folder. The theme is just created and not activated; the code can not contain the opening '<?php' tag.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $code = 'sayHi();';
                                                                                                                                                                                                                                                                                                                                                                      +  $functionsCode  = 'function sayHi(){echo "Hello world";};';
                                                                                                                                                                                                                                                                                                                                                                      +  $I->haveTheme('foo', $indexCode, $functionsCode);
                                                                                                                                                                                                                                                                                                                                                                      +  // Load the code from a file.
                                                                                                                                                                                                                                                                                                                                                                      +  $indexCode = file_get_contents(codecept_data_dir('code/index.php'));
                                                                                                                                                                                                                                                                                                                                                                      +  $functionsCode = file_get_contents(codecept_data_dir('code/functions.php'));
                                                                                                                                                                                                                                                                                                                                                                      +  $I->haveTheme('foo', $indexCode, $functionsCode);
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string $folder - The path to the theme to create, relative to the themes root folder.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • string $indexFileCode - The content of the theme index.php file with or without the opening PHP tag.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • string $functionsFileCode - The content of the theme functions.php file with or without the opening PHP tag.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      makeUploadsDir

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Creates an empty folder in the WordPress installation uploads folder.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $logsDir = $I->makeUploadsDir('logs/acme');
                                                                                                                                                                                                                                                                                                                                                                      +  to create.
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string $path - The path, relative to the WordPress installation uploads folder, of the folder
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      openUploadedFile

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Opens a file in the the uploads folder. The date argument can be a string compatible with strtotime or a Unix timestamp that will be used to build the Y/m uploads subfolder path.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $I->openUploadedFile('some-file.txt');
                                                                                                                                                                                                                                                                                                                                                                      +  $I->openUploadedFile('some-file.txt', 'time');
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string $filename - The path to the file, relative to the current uploads folder.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • string/int/[\DateTime](http://php.net/manual/en/class.datetime.php) $date - The date of the uploads to delete, will default to now.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      seeInMuPluginFile

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Checks that a file in a mu-plugin folder contains a string.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $I->seeInMuPluginFile('mu-plugin1/some-file.txt', 'foo');
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string $file - The path the file, relative to the mu-plugins root folder.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • string $contents - The contents to check the file for.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      seeInPluginFile

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Checks that a file in a plugin folder contains a string.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $I->seeInPluginFile('my-plugin/some-file.txt', 'foo');
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string $file - The path to the file, relative to the plugins root folder.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • string $contents - The contents to check the file for.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      seeInThemeFile

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Checks that a file in a theme folder contains a string.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      <?php
                                                                                                                                                                                                                                                                                                                                                                      +  $I->seeInThemeFile('my-theme/some-file.txt', 'foo');
                                                                                                                                                                                                                                                                                                                                                                      +  ?>
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string $file - The path to the file, relative to the themes root folder.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • string $contents - The contents to check the file for.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      seeInUploadedFile

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Checks that a file in the uploads folder contains a string. The date argument can be a string compatible with strtotime or a Unix timestamp that will be used to build the Y/m uploads subfolder path.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $I->seeInUploadedFile('some-file.txt', 'foo');
                                                                                                                                                                                                                                                                                                                                                                      +  $I->seeInUploadedFile('some-file.txt','foo', 'today');
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string $file - The file path, relative to the uploads folder or the current folder.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • string $contents - The expected file contents or part of them.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • string/int $date - A string compatible with strtotime or a Unix timestamp.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      seeMuPluginFileFound

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Checks that a file is found in a mu-plugin folder.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $I->seeMuPluginFileFound('mu-plugin1/some-file.txt');
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string $file - The path to the file, relative to the mu-plugins folder.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      seePluginFileFound

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Checks that a file is found in a plugin folder.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $I->seePluginFileFound('my-plugin/some-file.txt');
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string $file - The path to the file, relative to thep plugins root folder.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      seeThemeFileFound

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Checks that a file is found in a theme folder.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $I->seeThemeFileFound('my-theme/some-file.txt');
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string $file - The path to the file, relative to the themes root folder.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      seeUploadedFileFound

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Checks if file exists in the uploads folder. The date argument can be a string compatible with strtotime or a Unix timestamp that will be used to build the Y/m uploads subfolder path.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $I->seeUploadedFileFound('some-file.txt');
                                                                                                                                                                                                                                                                                                                                                                      +  $I->seeUploadedFileFound('some-file.txt','today');
                                                                                                                                                                                                                                                                                                                                                                      +  ?>
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string $filename - The file path, relative to the uploads folder or the current folder.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • string/int $date - A string compatible with strtotime or a Unix timestamp.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      writeToMuPluginFile

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Writes a file in a mu-plugin folder.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $I->writeToMuPluginFile('mu-plugin1/some-file.txt', 'foo');
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string $file - The path to the destination file, relative to the mu-plugins root folder.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • string $data - The data to write to the file.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      writeToPluginFile

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Writes a file in a plugin folder.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $I->writeToPluginFile('my-plugin/some-file.txt', 'foo');
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string $file - The path to the file, relative to the plugins root folder.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • string $data - The data to write in the file.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      writeToThemeFile

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Writes a string to a file in a theme folder.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $I->writeToThemeFile('my-theme/some-file.txt', 'foo');
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string $file - The path to the file, relative to the themese root folder.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • string $data - The data to write to the file.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      writeToUploadedFile

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Writes a string to a file in the the uploads folder. The date argument can be a string compatible with strtotime or a Unix timestamp that will be used to build the Y/m uploads subfolder path.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $I->writeToUploadedFile('some-file.txt', 'foo bar');
                                                                                                                                                                                                                                                                                                                                                                      +  $I->writeToUploadedFile('some-file.txt', 'foo bar', 'today');
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string $filename - The path to the destination file, relative to the current uploads folder.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • string $data - The data to write to the file.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • string/int/[\DateTime](http://php.net/manual/en/class.datetime.php) $date - The date of the uploads to delete, will default to now.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      This class extends \Codeception\Module\Filesystem

                                                                                                                                                                                                                                                                                                                                                                      + + + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + + + + + \ No newline at end of file diff --git a/docs/v3/modules/WPLoader/index.html b/docs/v3/modules/WPLoader/index.html new file mode 100644 index 000000000..0d922809a --- /dev/null +++ b/docs/v3/modules/WPLoader/index.html @@ -0,0 +1,2594 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + WPLoader - wp-browser docs + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      + + +
                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      This is the documentation for version 3 of the project. +The current version is version 4 and the documentation can be found here.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      WPLoader module

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      This module should be used in integration tests, see levels of testing for more information, to bootstrap WordPress code in the context of the tests.
                                                                                                                                                                                                                                                                                                                                                                      +Setting the loadOnly parameter to true the module can be additionally used in acceptance and functional tests to access WordPress code in the tests context.
                                                                                                                                                                                                                                                                                                                                                                      +This module is a wrapper around the functionalities provided by the WordPress PHPUnit Core test suite, as such it provides the same method and facilities.
                                                                                                                                                                                                                                                                                                                                                                      +The parameters provided to the module duplicate the ones used in the WordPress configuration file: the WPLoader module will not bootstrap WordPress using the wp-config.php file, it will define and use its own WordPress configuration built from the module parameters.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Everything happens in a transaction

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      When used to bootstrap and install WordPress (loadOnly: false) exactly as the the WordPress PHPUnit Core test suite it is based on, this module will operate any change to the database in a transaction.
                                                                                                                                                                                                                                                                                                                                                                      +This means that, in the context of integration tests, the result of any write or delete operation done during the tests will be rolled back at the end of each test method; this is done for a number of reasons like performance and tests independence.
                                                                                                                                                                                                                                                                                                                                                                      +Inspection of the database during tests, e.g. stopping execution using XDebug, will not show any change in the database. +Keep this in mind while trying to debug integration tests using the WPLoader module.
                                                                                                                                                                                                                                                                                                                                                                      +When configured to only load WordPress (loadOnly: true) then any database operation will be committed and written to the database.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Configuration

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • wpRootFolder required The absolute, or relative to the project root folder, path to the root WordPress installation folder. The WordPress installation root folder is the one that contains the wp-load.php file.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • dbName required - The name of the database used by the WordPress installation, same as the DB_NAME constant.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • dbHost required - The host of the database used by the WordPress installation, same as the DB_HOST constant. If the database is accessible (as is the case on the latest version of [Local by Flywheel][http://localwp.com]) via unix socket, then the string to insert here should look like this localhost:/path/to/the/mysql.sock.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • dbUser required - The user of the database used by the WordPress installation, same as the DB_USER constant.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • dbPassword required - The password of the database used by the WordPress installation, same as DB_PASSWORD constant.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • loadOnly - defaults to false; whether to only load WordPress, without bootstrapping a fresh installation for tests or not. Read more in the "Using WPLoader in acceptance and functional tests" section. If this parameter is set to true the following parameters will not apply.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • isolatedInstall - defaults to true, whether to install and bootstrap the WordPress installation in a secondary PHP thread for thread safety or not. Maintained for back-compatibility purposes with wp-browser first versions: to get a replica of the bootstrap process used by WordPress Core PHPUnit tests leave this to true.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • installationTableHandling - defaults to empty; it controls how tables created by WordPress and plugins will be handled during the installation of WordPress during tests. By default tables will be emptied of any content, but some plugins might require tables to be dropped before WordPress is installed and after plugins are activated (this used to be the default behavior). Supported values are drop to drop the tables, empty to just empty the tables and let to do nothing about the tables. If you get errors from database queries while the WPLoader module installs the tests, then try changing this parameter value.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • wpDebug - defaults to true, the value the WP_DEBUG constant will be set to.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • multisite - defaults to false, the value the MULTISITE constant will be set to.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • skipPluggables - defaults to false, if set to true will skip the definition of pluggable functions.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • dbCharset - defaults to utf8, the value the DB_CHARSET constant will be set to.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • dbCollate - defaults to an empty string, the value the DB_COLLATE constant will be set to.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • tablePrefix - defaults to wptests_, the value the $table_prefix variable will be set to.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • domain - defaults to example.org, the domain of the WordPress site to scaffold for the tests.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • adminEmail - defaults to admin@example.org, the email of the WordPress site to scaffold for the tests.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • title - defaults to Test Blog, the title of the WordPress site to scaffolded for the tests.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • phpBinary - defaults to php, the PHP binary the host machine will have to use to bootstrap and load the test WordPress installation.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • language - defaults to an empty string, the language of the WordPress installation to scaffold.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • configFile - defaults to an empty string, an additional configuration file to include before loading WordPress. Any instruction in this fill will run before any WordPress file is included.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • contentFolder - defaults to an empty string; the path, relative to the wpRootFolder or absolute, to the content folder if different from the default one or the one defined by the WP_CONTENT_DIR constant; if the WP_CONTENT_DIR constant is defined in a config file (see the configFile parameter) this will be ignored.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • pluginsFolder - defaults to an empty string; the path, relative to the wpRootFolder or absolute, to the plugins folder from the wpRootFolder if different from the default one or the one defined by the WP_PLUGIN_DIR constant; if the WP_PLUGIN_DIR constant is defined in a config file (see the configFile parameter) this will be ignored.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • plugins - defaults to an empty string; a list of plugins that should be loaded before any test case runs and after mu-plugins have been loaded; these should be defined in the folder/plugin-file.php format.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • activatePlugins - defaults to an empty string, a list of plugins that will be activated before any test case runs and after WordPress is fully loaded and set up; these should be defined in the folder/plugin-file.php format; when the multisite option is set to true the plugins will be network activated during the installation.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • bootstrapActions - defaults to an empty string, a list of actions or static functions that should be called after before any test case runs, after plugins have been loaded and activated; static functions should be defined in the YAML array format: +
                                                                                                                                                                                                                                                                                                                                                                        bootstrapActions:
                                                                                                                                                                                                                                                                                                                                                                        +    - action_one
                                                                                                                                                                                                                                                                                                                                                                        +    - action_two
                                                                                                                                                                                                                                                                                                                                                                        +    - [MyClass, myStaticMethod]
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • +

                                                                                                                                                                                                                                                                                                                                                                        theme - defaults to an empty string, the theme that should be activated for the tests; if a string is passed then both template and stylesheet options will be set to the passed value; if an array is passed then the template and stylesheet will be set in that order:

                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                        theme: my-theme
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                        +

                                                                                                                                                                                                                                                                                                                                                                        The theme will be set to my-theme.

                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                        theme: [ parent, child ]
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                        +

                                                                                                                                                                                                                                                                                                                                                                        The template will be set to parent, the stylesheet will be set to child.

                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      A word of caution: right now the only way to write tests able to take advantage of the suite is to use the WP_UnitTestCase test case class; while the module will load fine and will raise no problems WP_UnitTestCase will take care of handling the database as intended and using another test case class will almost certainly result in an error if the test case defines more than one test method.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Example configuration

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        modules:
                                                                                                                                                                                                                                                                                                                                                                      +      enabled:
                                                                                                                                                                                                                                                                                                                                                                      +          - WPLoader
                                                                                                                                                                                                                                                                                                                                                                      +      config:
                                                                                                                                                                                                                                                                                                                                                                      +          WPLoader:
                                                                                                                                                                                                                                                                                                                                                                      +              multisite: false
                                                                                                                                                                                                                                                                                                                                                                      +              wpRootFolder: "/Users/luca/www/wordpress"
                                                                                                                                                                                                                                                                                                                                                                      +              dbName: "wordpress_tests"
                                                                                                                                                                                                                                                                                                                                                                      +              dbHost: "localhost"
                                                                                                                                                                                                                                                                                                                                                                      +              dbUser: "root"
                                                                                                                                                                                                                                                                                                                                                                      +              dbPassword: "password"
                                                                                                                                                                                                                                                                                                                                                                      +              isolatedInstall: true
                                                                                                                                                                                                                                                                                                                                                                      +              installationTableHandling: drop
                                                                                                                                                                                                                                                                                                                                                                      +              tablePrefix: "wptests_"
                                                                                                                                                                                                                                                                                                                                                                      +              domain: "wordrpess.localhost"
                                                                                                                                                                                                                                                                                                                                                                      +              adminEmail: "admin@wordpress.localhost"
                                                                                                                                                                                                                                                                                                                                                                      +              title: "Test Blog"
                                                                                                                                                                                                                                                                                                                                                                      +              theme: my-theme
                                                                                                                                                                                                                                                                                                                                                                      +              plugins: ['hello.php', 'my-plugin/my-plugin.php']
                                                                                                                                                                                                                                                                                                                                                                      +              activatePlugins: ['hello.php', 'my-plugin/my-plugin.php']
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Usage in integration or "WordPress unit" tests

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      The most common use of this module is to run integration, or "WordPress unit" tests (see levels of testing for more information).

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      As a first step generate a WPTestCase using Codeception command-line utility (see the commands provided by wp-browser):

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      codecept generate:wpunit my_suite "Acme\User"
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Codeception will generate the tests/my_suite/Acme/UserTest.php class. +The class extends the Codeception\TestCase\WPTestCase class provided by wp-browser; this looks like a normal PHPUnit test case but has some perks due to it's mixed breed nature.
                                                                                                                                                                                                                                                                                                                                                                      +Understanding them might help you work with it:

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • WordPress is installed and configured for the tests before the test case is loaded; WordPress defined functions and classes (and those of the plugins and themes loaded with it) will be available in the setUpBeforeClass method.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • WordPress is not loaded when PHPUnit will call the data provider methods; this means the post_provider method will generate a function not found exception when the test case runs as the WordPress defined methods are not loaded yet: +
                                                                                                                                                                                                                                                                                                                                                                        public function post_provider(){
                                                                                                                                                                                                                                                                                                                                                                        +        // `wp_insert_post` is loaded with WordPress and WordPress has not been loaded yet!
                                                                                                                                                                                                                                                                                                                                                                        +        return [
                                                                                                                                                                                                                                                                                                                                                                        +                [wp_insert_post(['post_title' => 'Test', 'post_status' => 'publish'])]
                                                                                                                                                                                                                                                                                                                                                                        +        ];
                                                                                                                                                                                                                                                                                                                                                                        +}
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                        +public function test_posts($post_id){
                                                                                                                                                                                                                                                                                                                                                                        +        $this->assertInstanceOf(WP_Post::class, get_post($post_id));
                                                                                                                                                                                                                                                                                                                                                                        +}
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • WordPress is reset to an initial known state before each test runs; the database transaction is rolled back to wipe any data and tables you might have manipulated in the tests, the global space is cleaned. See Everything happens in a transaction.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • This is a Codeception Unit test, as such it does provide access to the $this->tester property to access the methods defined in other modules loaded in the suite and to Codeception test doubles
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • This is a PhpUnit test case too; there are way too many testing functions to cover to report them here but, to highlight a few: mocking with Prophecy and the wealth of PHPUnit assertion methods.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • This is kind of a WordPress Core suite test case; as such it provides access to its functions and to the often-overlooked static::factory() method; in this instance too there are too many methods to list them all but it's worth noting how easy it is to set up test fixtures with the factory: +
                                                                                                                                                                                                                                                                                                                                                                        public function test_post_creation(){
                                                                                                                                                                                                                                                                                                                                                                        +        $random_post_id = static::factory()->post->create();
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                        +        $this->assertInstanceOf(WP_Post::class, get_post($random_post_id));
                                                                                                                                                                                                                                                                                                                                                                        +}
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • The factory property can be accessed on the tester property too and will work the same way as if called using static::factory(): +
                                                                                                                                                                                                                                                                                                                                                                        public function test_post_creation(){
                                                                                                                                                                                                                                                                                                                                                                        +        $random_post_id = $this->tester->factory()->post->create();
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                        +        $this->assertInstanceOf(WP_Post::class, get_post($random_post_id));
                                                                                                                                                                                                                                                                                                                                                                        +}
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      WPLoader to only bootstrap WordPress

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      If the need is to just bootstrap the WordPress installation in the context of the tests variable scope then the WPLoader module loadOnly parameter should be set to true; this could be the case for functional tests in need to access WordPress provided methods, functions and values.
                                                                                                                                                                                                                                                                                                                                                                      +An example configuration for the module in this mode is this one:

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        modules:
                                                                                                                                                                                                                                                                                                                                                                      +      enabled:
                                                                                                                                                                                                                                                                                                                                                                      +          - WPDb # BEFORE the WPLoader one!
                                                                                                                                                                                                                                                                                                                                                                      +          - WPLoader # AFTER the WPDb one!
                                                                                                                                                                                                                                                                                                                                                                      +      config:
                                                                                                                                                                                                                                                                                                                                                                      +          WPDb:
                                                                                                                                                                                                                                                                                                                                                                      +              dsn: 'mysql:host=localhost;dbname=wordpress'
                                                                                                                                                                                                                                                                                                                                                                      +              user: 'root'
                                                                                                                                                                                                                                                                                                                                                                      +              password: 'password'
                                                                                                                                                                                                                                                                                                                                                                      +              dump: 'tests/_data/dump.sql'
                                                                                                                                                                                                                                                                                                                                                                      +              populate: true
                                                                                                                                                                                                                                                                                                                                                                      +              cleanup: true
                                                                                                                                                                                                                                                                                                                                                                      +              waitlock: 10
                                                                                                                                                                                                                                                                                                                                                                      +              url: 'http://wordpress.localhost'
                                                                                                                                                                                                                                                                                                                                                                      +              urlReplacement: true
                                                                                                                                                                                                                                                                                                                                                                      +              tablePrefix: 'wp_'
                                                                                                                                                                                                                                                                                                                                                                      +          WPLoader:
                                                                                                                                                                                                                                                                                                                                                                      +              loadOnly: true 
                                                                                                                                                                                                                                                                                                                                                                      +              wpRootFolder: "/Users/User/www/wordpress"
                                                                                                                                                                                                                                                                                                                                                                      +              dbName: "wpress-tests"
                                                                                                                                                                                                                                                                                                                                                                      +              dbHost: "localhost"
                                                                                                                                                                                                                                                                                                                                                                      +              dbUser: "root"
                                                                                                                                                                                                                                                                                                                                                                      +              dbPassword: "root"
                                                                                                                                                                                                                                                                                                                                                                      +              domain: "wordpress.localhost"
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      With reference to the table above the module will not take care of the test WordPress installation state before and after the tests, the installed and activated plugins, and theme.
                                                                                                                                                                                                                                                                                                                                                                      +The module can be used in conjunction with a WPDb module to provide the tests with a WordPress installation suiting the tests at hand; when doing so please take care to list, in the suite configuration file modules section (see example above) the WPDb module before the WPLoader one.
                                                                                                                                                                                                                                                                                                                                                                      +Codeception will initialize the modules in the same order they are listed in the modules section of the suite configuration file and the WPLoader module needs the database to be populated by the WPDb module before it runs! +As an example this is a correct suite configuration: +

                                                                                                                                                                                                                                                                                                                                                                      modules:
                                                                                                                                                                                                                                                                                                                                                                      +  enabled:
                                                                                                                                                                                                                                                                                                                                                                      +      - WPDb # this before...
                                                                                                                                                                                                                                                                                                                                                                      +      - WPLoader # ...this one.
                                                                                                                                                                                                                                                                                                                                                                      +  config:
                                                                                                                                                                                                                                                                                                                                                                      +      WPDb:
                                                                                                                                                                                                                                                                                                                                                                      +        # ...
                                                                                                                                                                                                                                                                                                                                                                      +      WPLoader:
                                                                                                                                                                                                                                                                                                                                                                      +        loadOnly: true
                                                                                                                                                                                                                                                                                                                                                                      +        # ... 
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      + + +

                                                                                                                                                                                                                                                                                                                                                                      Public API

                                                                                                                                                                                                                                                                                                                                                                      + + +

                                                                                                                                                                                                                                                                                                                                                                      debugWpActionFinal

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Debugs a single WordPress action final call using Codeception debug functions. The output will show following the selected output verbosity (--debug and -vvv CLI options).

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      // Start debugging all WordPress actions final value.
                                                                                                                                                                                                                                                                                                                                                                      +  add_action('all', [$this,'debugWpActionFinal']);
                                                                                                                                                                                                                                                                                                                                                                      +  // Run some code firing actions and debug them.
                                                                                                                                                                                                                                                                                                                                                                      +  // Stop debugging all WordPress actions final value.
                                                                                                                                                                                                                                                                                                                                                                      +  remove_action('all', [$this,'debugWpActionFinal']);
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • mixed $args
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      debugWpActionInitial

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Debugs a single WordPress action initial call using Codeception debug functions. The output will show following the selected output verbosity (--debug and -vvv CLI options).

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      // Start debugging all WordPress actions initial value.
                                                                                                                                                                                                                                                                                                                                                                      +  add_action('all', [$this,'debugWpActionInitial']);
                                                                                                                                                                                                                                                                                                                                                                      +  // Run some code firing actions and debug them.
                                                                                                                                                                                                                                                                                                                                                                      +  // Stop debugging all WordPress actions initial value.
                                                                                                                                                                                                                                                                                                                                                                      +  remove_action('all', [$this,'debugWpActionInitial']);
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • mixed $args
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      debugWpFilterFinal

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Debugs a single WordPress filter final call using Codeception debug functions. The output will show following the selected output verbosity (--debug and -vvv CLI options).

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      // Start debugging all WordPress filters final value.
                                                                                                                                                                                                                                                                                                                                                                      +  add_filter('all', [$this,'debugWpFilterFinal']);
                                                                                                                                                                                                                                                                                                                                                                      +  // Run some code firing filters and debug them.
                                                                                                                                                                                                                                                                                                                                                                      +  // Stop debugging all WordPress filters final value.
                                                                                                                                                                                                                                                                                                                                                                      +  remove_filter('all', [$this,'debugWpFilterFinal']);
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • mixed $args
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      debugWpFilterInitial

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Debugs a single WordPress filter initial call using Codeception debug functions. The output will show following the selected output verbosity (--debug and -vvv CLI options).

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      // Start debugging all WordPress filters initial value.
                                                                                                                                                                                                                                                                                                                                                                      +  add_filter('all', [$this,'debugWpFilterInitial']);
                                                                                                                                                                                                                                                                                                                                                                      +  // Run some code firing filters and debug them.
                                                                                                                                                                                                                                                                                                                                                                      +  // Stop debugging all WordPress filters initial value.
                                                                                                                                                                                                                                                                                                                                                                      +  remove_filter('all', [$this,'debugWpFilterInitial']);
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • mixed $args
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      factory

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Accessor method to get the object storing the factories for things. This methods gives access to the same factories provided by the Core test suite.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $postId = $I->factory()->post->create();
                                                                                                                                                                                                                                                                                                                                                                      +  $userId = $I->factory()->user->create(['role' => 'administrator']);
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      getContentFolder

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Returns the absolute path to the WordPress content directory.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $content = $this->getContentFolder();
                                                                                                                                                                                                                                                                                                                                                                      +  $themes = $this->getContentFolder('themes');
                                                                                                                                                                                                                                                                                                                                                                      +  $twentytwenty = $this->getContentFolder('themes/twentytwenty');
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string $path - An optional path to append to the content directory absolute path.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      getPluginsFolder

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Returns the absolute path to the plugins directory. The value will first look at the WP_PLUGIN_DIR constant, then the pluginsFolder configuration parameter and will, finally, look in the default path from the WordPress root directory.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $plugins = $this->getPluginsFolder();
                                                                                                                                                                                                                                                                                                                                                                      +  $hello = $this->getPluginsFolder('hello.php');
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string $path - A relative path to append to te plugins directory absolute path.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      startWpFiltersDebug

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Starts the debug of all WordPress filters and actions. The method hook on all filters and actions to debug their value.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      // Start debugging all WordPress filters and action final and initial values.
                                                                                                                                                                                                                                                                                                                                                                      +  $this->startWpFiltersDebug();
                                                                                                                                                                                                                                                                                                                                                                      +  // Run some code firing filters and debug them.
                                                                                                                                                                                                                                                                                                                                                                      +  // Stop debugging all WordPress filters and action final and initial values.
                                                                                                                                                                                                                                                                                                                                                                      +  $this->stopWpFiltersDebug();
                                                                                                                                                                                                                                                                                                                                                                      +  the array of arguments as input.
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • \callable $format - A callback function to format the arguments debug output; the callback will receive
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      stopWpFiltersDebug

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Stops the debug of all WordPress filters and actions.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      // Start debugging all WordPress filters and action final and initial values.
                                                                                                                                                                                                                                                                                                                                                                      +  $this->startWpFiltersDebug();
                                                                                                                                                                                                                                                                                                                                                                      +  // Run some code firing filters and debug them.
                                                                                                                                                                                                                                                                                                                                                                      +  // Stop debugging all WordPress filters and action final and initial values.
                                                                                                                                                                                                                                                                                                                                                                      +  $this->stopWpFiltersDebug();
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      This class extends \Codeception\Module

                                                                                                                                                                                                                                                                                                                                                                      + + + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + + + + + \ No newline at end of file diff --git a/docs/v3/modules/WPQueries/index.html b/docs/v3/modules/WPQueries/index.html new file mode 100644 index 000000000..2f8b4c143 --- /dev/null +++ b/docs/v3/modules/WPQueries/index.html @@ -0,0 +1,2918 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + WPQueries - wp-browser docs + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      + + +
                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      This is the documentation for version 3 of the project. +The current version is version 4 and the documentation can be found here.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      WPQueries module

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      This module should be used in integration tests, see levels of testing for more information, to make assertions on the database queries made by the global $wpdb object.
                                                                                                                                                                                                                                                                                                                                                                      +This module requires the WPLoader module to work.
                                                                                                                                                                                                                                                                                                                                                                      +The module will set, if not set already, the SAVEQUERIES constant to true and will throw an exception if the constant is already set to a falsy value.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Configuration

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      This module does not require any configuration, but requires the WPLoader module to work correctly.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Usage

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      This module must be used in a test case extending the \Codeception\TestCase\WPTestCase class.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      The module public API is accessible calling via the \Codeception\TestCase\WPTestCase::queries() method:

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      <?php
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +use Codeception\Module\WPQueries;
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +class WPQueriesUsageTest extends \Codeception\TestCase\WPTestCase
                                                                                                                                                                                                                                                                                                                                                                      +{
                                                                                                                                                                                                                                                                                                                                                                      +    public function test_queries_made_by_factory_are_not_tracked()
                                                                                                                                                                                                                                                                                                                                                                      +    {
                                                                                                                                                                                                                                                                                                                                                                      +        $currentQueriesCount = $this->queries()->countQueries();
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +        $this->assertNotEmpty($currentQueriesCount);
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +        static::factory()->post->create_many(3);
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +        $this->assertNotEmpty($currentQueriesCount);
                                                                                                                                                                                                                                                                                                                                                                      +        $this->assertEquals($currentQueriesCount, $this->queries()->countQueries());
                                                                                                                                                                                                                                                                                                                                                                      +    }
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +    public function test_count_queries()
                                                                                                                                                                                                                                                                                                                                                                      +    {
                                                                                                                                                                                                                                                                                                                                                                      +        $currentQueriesCount = $this->queries()->countQueries();
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +        $this->assertNotEmpty($currentQueriesCount);
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +        foreach (range(1, 3) as $i) {
                                                                                                                                                                                                                                                                                                                                                                      +            wp_insert_post(['post_title' => 'Post ' . $i, 'post_content' => str_repeat('test', $i)]);
                                                                                                                                                                                                                                                                                                                                                                      +        }
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +        $this->assertNotEmpty($currentQueriesCount);
                                                                                                                                                                                                                                                                                                                                                                      +        $this->assertGreaterThan($currentQueriesCount, $this->queries()->countQueries());
                                                                                                                                                                                                                                                                                                                                                                      +    }
                                                                                                                                                                                                                                                                                                                                                                      +}
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + +

                                                                                                                                                                                                                                                                                                                                                                      Public API

                                                                                                                                                                                                                                                                                                                                                                      + + +

                                                                                                                                                                                                                                                                                                                                                                      assertCountQueries

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Asserts that n queries have been made.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $posts = $this->factory()->post->create_many(3);
                                                                                                                                                                                                                                                                                                                                                                      +  $cachedUsers = $this->factory()->user->create_many(2);
                                                                                                                                                                                                                                                                                                                                                                      +  $nonCachedUsers = $this->factory()->user->create_many(2);
                                                                                                                                                                                                                                                                                                                                                                      +  foreach($cachedUsers as $userId){
                                                                                                                                                                                                                                                                                                                                                                      +  wp_cache_set('page-posts-for-user-' . $userId, $posts, 'acme');
                                                                                                                                                                                                                                                                                                                                                                      +  }
                                                                                                                                                                                                                                                                                                                                                                      +  // Run the same query as different users
                                                                                                                                                                                                                                                                                                                                                                      +  foreach(array_merge($cachedUsers, $nonCachedUsers) as $userId){
                                                                                                                                                                                                                                                                                                                                                                      +  $pagePosts = $plugin->getPagePostsForUser($userId);
                                                                                                                                                                                                                                                                                                                                                                      +  }
                                                                                                                                                                                                                                                                                                                                                                      +  $I->assertCountQueries(2, 'A query should be made for each user missing cached posts.')
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • int $n - The expected number of queries.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • string $message - An optional message to override the default one.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      assertNotQueries

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Asserts that no queries were made. Queries generated by setUp, tearDown and factory methods are excluded by default.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $posts = $this->factory()->post->create_many(3);
                                                                                                                                                                                                                                                                                                                                                                      +  wp_cache_set('page-posts', $posts, 'acme');
                                                                                                                                                                                                                                                                                                                                                                      +  $pagePosts = $plugin->getPagePosts();
                                                                                                                                                                                                                                                                                                                                                                      +  $I->assertNotQueries('Queries should not be made if the cache is set.')
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string $message - An optional message to override the default one.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      assertNotQueriesByAction

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Asserts that no queries were made as a consequence of the specified action. Queries generated by setUp, tearDown and factory methods are excluded by default.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      add_action( 'edit_post', function($postId){
                                                                                                                                                                                                                                                                                                                                                                      +  $count = get_option('acme_title_updates_count');
                                                                                                                                                                                                                                                                                                                                                                      +  update_option('acme_title_updates_count', ++$count);
                                                                                                                                                                                                                                                                                                                                                                      +  } );
                                                                                                                                                                                                                                                                                                                                                                      +  wp_delete_post($bookId);
                                                                                                                                                                                                                                                                                                                                                                      +  $this->assertNotQueriesByAction('edit_post');
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string $action - The action name, e.g. 'init'.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • string $message - An optional message to override the default one.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      assertNotQueriesByFilter

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Asserts that no queries were made as a consequence of the specified filter. Queries generated by setUp, tearDown and factory methods are excluded by default.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      add_filter('the_title', function($title, $postId){
                                                                                                                                                                                                                                                                                                                                                                      +  $post = get_post($postId);
                                                                                                                                                                                                                                                                                                                                                                      +  if($post->post_type !== 'book'){
                                                                                                                                                                                                                                                                                                                                                                      +  return $title;
                                                                                                                                                                                                                                                                                                                                                                      +  }
                                                                                                                                                                                                                                                                                                                                                                      +  $new = get_option('acme_new_prefix');
                                                                                                                                                                                                                                                                                                                                                                      +  return "{$new} - " . $title;
                                                                                                                                                                                                                                                                                                                                                                      +  });
                                                                                                                                                                                                                                                                                                                                                                      +  $title = apply_filters('the_title', get_post($notABookId)->post_title, $notABookId);
                                                                                                                                                                                                                                                                                                                                                                      +  $this->assertNotQueriesByFilter('the_title');
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string $filter - The filter name, e.g. 'posts_where'.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • string $message - An optional message to override the default one.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      assertNotQueriesByFunction

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Asserts that no queries were made by the specified function. Queries generated by setUp, tearDown and factory methods are excluded by default.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $this->assertEmpty(Acme\get_orphaned_posts());
                                                                                                                                                                                                                                                                                                                                                                      +  Acme\delete_orphaned_posts();
                                                                                                                                                                                                                                                                                                                                                                      +  $this->assertNotQueriesByFunction('Acme\delete_orphaned_posts');
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string $function - The fully qualified name of the function to check.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • string $message - An optional message to override the default one.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      assertNotQueriesByMethod

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Asserts that no queries have been made by the specified class method. Queries generated by setUp, tearDown and factory methods are excluded by default.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $options = new Acme\Options();
                                                                                                                                                                                                                                                                                                                                                                      +  $options->update('adsSource', 'not-a-real-url.org');
                                                                                                                                                                                                                                                                                                                                                                      +  $I->assertNotQueriesByMethod('Acme\Options', 'update');
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string $class - The fully qualified name of the class to check.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • string $method - The name of the method to check.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • string $message - An optional message to override the default one.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      assertNotQueriesByStatement

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Asserts that no queries have been made by the specified class method. Queries generated by setUp, tearDown and factory methods are excluded by default.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $bookRepository = new Acme\BookRepository();
                                                                                                                                                                                                                                                                                                                                                                      +  $repository->where('ID', 23)->set('title', 'Peter Pan', $deferred = true);
                                                                                                                                                                                                                                                                                                                                                                      +  $this->assertNotQueriesByStatement('INSERT', 'Deferred write should happen on __destruct');
                                                                                                                                                                                                                                                                                                                                                                      +  Regular expressions must contain delimiters.
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string $statement - A simple string the statement should start with or a valid regular expression.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • string $message - An optional message to override the default one.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      assertNotQueriesByStatementAndAction

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Asserts that no queries were made as a consequence of the specified action containing the SQL query. Queries generated by setUp, tearDown and factory methods are excluded by default.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      add_action( 'edit_post', function($postId){
                                                                                                                                                                                                                                                                                                                                                                      +  $count = get_option('acme_title_updates_count');
                                                                                                                                                                                                                                                                                                                                                                      +  update_option('acme_title_updates_count', ++$count);
                                                                                                                                                                                                                                                                                                                                                                      +  } );
                                                                                                                                                                                                                                                                                                                                                                      +  wp_delete_post($bookId);
                                                                                                                                                                                                                                                                                                                                                                      +  $this->assertNotQueriesByStatementAndAction('DELETE', 'delete_post');
                                                                                                                                                                                                                                                                                                                                                                      +  Regular expressions must contain delimiters.
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string $statement - A simple string the statement should start with or a valid regular expression.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • string $action - The action name, e.g. 'init'.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • string $message - An optional message to override the default one.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      assertNotQueriesByStatementAndFilter

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Asserts that no queries were made as a consequence of the specified filter containing the specified SQL query. Queries generated by setUp, tearDown and factory methods are excluded by default.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      add_filter('the_title', function($title, $postId){
                                                                                                                                                                                                                                                                                                                                                                      +  $post = get_post($postId);
                                                                                                                                                                                                                                                                                                                                                                      +  if($post->post_type !== 'book'){
                                                                                                                                                                                                                                                                                                                                                                      +  return $title;
                                                                                                                                                                                                                                                                                                                                                                      +  }
                                                                                                                                                                                                                                                                                                                                                                      +  $new = get_option('acme_new_prefix');
                                                                                                                                                                                                                                                                                                                                                                      +  return "{$new} - " . $title;
                                                                                                                                                                                                                                                                                                                                                                      +  });
                                                                                                                                                                                                                                                                                                                                                                      +  $title = apply_filters('the_title', get_post($notABookId)->post_title, $notABookId);
                                                                                                                                                                                                                                                                                                                                                                      +  $this->assertNotQueriesByStatementAndFilter('SELECT', 'the_title');
                                                                                                                                                                                                                                                                                                                                                                      +  Regular expressions must contain delimiters.
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string $statement - A simple string the statement should start with or a valid regular expression.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • string $filter - The filter name, e.g. 'posts_where'.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • string $message - An optional message to override the default one.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      assertNotQueriesByStatementAndFunction

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Asserts that no queries were made by the specified function starting with the specified SQL statement. Queries generated by setUp, tearDown and factory methods are excluded by default.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      wp_insert_post(['ID' => $bookId, 'post_title' => 'The Call of the Wild']);
                                                                                                                                                                                                                                                                                                                                                                      +  $this->assertNotQueriesByStatementAndFunction('INSERT', 'wp_insert_post');
                                                                                                                                                                                                                                                                                                                                                                      +  $this->assertQueriesByStatementAndFunction('UPDATE', 'wp_insert_post');
                                                                                                                                                                                                                                                                                                                                                                      +  Regular expressions must contain delimiters.
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string $statement - A simple string the statement should start with or a valid regular expression.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • string $function - The name of the function to check the assertions for.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • string $message - An optional message to override the default one.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      assertNotQueriesByStatementAndMethod

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Asserts that no queries were made by the specified class method starting with the specified SQL statement. Queries generated by setUp, tearDown and factory methods are excluded by default.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      Acme\BookRepository::new(['title' => 'Alice in Wonderland'])->commit();
                                                                                                                                                                                                                                                                                                                                                                      +  $this->assertQueriesByStatementAndMethod('INSERT', Acme\BookRepository::class, 'commit');
                                                                                                                                                                                                                                                                                                                                                                      +  Regular expressions must contain delimiters.
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string $statement - A simple string the statement should start with or a valid regular expression.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • string $class - The fully qualified name of the class to check.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • string $method - The name of the method to check.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • string $message - An optional message to override the default one.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      assertQueries

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Asserts that at least one query was made during the test. Queries generated by setUp, tearDown and factory methods are excluded by default.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      wp_cache_delete('page-posts', 'acme');
                                                                                                                                                                                                                                                                                                                                                                      +  $pagePosts = $plugin->getPagePosts();
                                                                                                                                                                                                                                                                                                                                                                      +  $I->assertQueries('Queries should be made to set the cache.')
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string $message - An optional message to override the default one.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      assertQueriesByAction

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Asserts that at least one query was made as a consequence of the specified action. Queries generated by setUp, tearDown and factory methods are excluded by default.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      add_action( 'edit_post', function($postId){
                                                                                                                                                                                                                                                                                                                                                                      +  $count = get_option('acme_title_updates_count');
                                                                                                                                                                                                                                                                                                                                                                      +  update_option('acme_title_updates_count', ++$count);
                                                                                                                                                                                                                                                                                                                                                                      +  } );
                                                                                                                                                                                                                                                                                                                                                                      +  wp_update_post(['ID' => $bookId, 'post_title' => 'New Title']);
                                                                                                                                                                                                                                                                                                                                                                      +  $this->assertQueriesByAction('edit_post');
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string $action - The action name, e.g. 'init'.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • string $message - An optional message to override the default one.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      assertQueriesByFilter

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Asserts that at least one query was made as a consequence of the specified filter. Queries generated by setUp, tearDown and factory methods are excluded by default.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      add_filter('the_title', function($title, $postId){
                                                                                                                                                                                                                                                                                                                                                                      +  $post = get_post($postId);
                                                                                                                                                                                                                                                                                                                                                                      +  if($post->post_type !== 'book'){
                                                                                                                                                                                                                                                                                                                                                                      +  return $title;
                                                                                                                                                                                                                                                                                                                                                                      +  }
                                                                                                                                                                                                                                                                                                                                                                      +  $new = get_option('acme_new_prefix');
                                                                                                                                                                                                                                                                                                                                                                      +  return "{$new} - " . $title;
                                                                                                                                                                                                                                                                                                                                                                      +  });
                                                                                                                                                                                                                                                                                                                                                                      +  $title = apply_filters('the_title', get_post($bookId)->post_title, $bookId);
                                                                                                                                                                                                                                                                                                                                                                      +  $this->assertQueriesByFilter('the_title');
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string $filter - The filter name, e.g. 'posts_where'.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • string $message - An optional message to override the default one.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      assertQueriesByFunction

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Asserts that queries were made by the specified function. Queries generated by setUp, tearDown and factory methods are excluded by default.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      acme_clean_queue();
                                                                                                                                                                                                                                                                                                                                                                      +  $this->assertQueriesByFunction('acme_clean_queue');
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string $function - The fully qualified name of the function to check.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • string $message - An optional message to override the default one.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      assertQueriesByMethod

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Asserts that at least one query has been made by the specified class method. Queries generated by setUp, tearDown and factory methods are excluded by default.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $options = new Acme\Options();
                                                                                                                                                                                                                                                                                                                                                                      +  $options->update('showAds', false);
                                                                                                                                                                                                                                                                                                                                                                      +  $I->assertQueriesByMethod('Acme\Options', 'update');
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string $class - The fully qualified name of the class to check.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • string $method - The name of the method to check.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • string $message - An optional message to override the default one.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      assertQueriesByStatement

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Asserts that at least a query starting with the specified statement was made. Queries generated by setUp, tearDown and factory methods are excluded by default.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      wp_cache_flush();
                                                                                                                                                                                                                                                                                                                                                                      +  cached_get_posts($args);
                                                                                                                                                                                                                                                                                                                                                                      +  $I->assertQueriesByStatement('SELECT');
                                                                                                                                                                                                                                                                                                                                                                      +  Regular expressions must contain delimiters.
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string $statement - A simple string the statement should start with or a valid regular expression.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • string $message - An optional message to override the default one.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      assertQueriesByStatementAndAction

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Asserts that at least one query was made as a consequence of the specified action containing the SQL query. Queries generated by setUp, tearDown and factory methods are excluded by default.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      add_action( 'edit_post', function($postId){
                                                                                                                                                                                                                                                                                                                                                                      +  $count = get_option('acme_title_updates_count');
                                                                                                                                                                                                                                                                                                                                                                      +  update_option('acme_title_updates_count', ++$count);
                                                                                                                                                                                                                                                                                                                                                                      +  } );
                                                                                                                                                                                                                                                                                                                                                                      +  wp_update_post(['ID' => $bookId, 'post_title' => 'New']);
                                                                                                                                                                                                                                                                                                                                                                      +  $this->assertQueriesByStatementAndAction('UPDATE', 'edit_post');
                                                                                                                                                                                                                                                                                                                                                                      +  Regular expressions must contain delimiters.
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string $statement - A simple string the statement should start with or a valid regular expression.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • string $action - The action name, e.g. 'init'.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • string $message - An optional message to override the default one.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      assertQueriesByStatementAndFilter

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Asserts that at least one query was made as a consequence of the specified filter containing the SQL query. Queries generated by setUp, tearDown and factory methods are excluded by default.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      add_filter('the_title', function($title, $postId){
                                                                                                                                                                                                                                                                                                                                                                      +  $post = get_post($postId);
                                                                                                                                                                                                                                                                                                                                                                      +  if($post->post_type !== 'book'){
                                                                                                                                                                                                                                                                                                                                                                      +  return $title;
                                                                                                                                                                                                                                                                                                                                                                      +  }
                                                                                                                                                                                                                                                                                                                                                                      +  $new = get_option('acme_new_prefix');
                                                                                                                                                                                                                                                                                                                                                                      +  return "{$new} - " . $title;
                                                                                                                                                                                                                                                                                                                                                                      +  });
                                                                                                                                                                                                                                                                                                                                                                      +  $title = apply_filters('the_title', get_post($bookId)->post_title, $bookId);
                                                                                                                                                                                                                                                                                                                                                                      +  $this->assertQueriesByStatementAndFilter('SELECT', 'the_title');
                                                                                                                                                                                                                                                                                                                                                                      +  Regular expressions must contain delimiters.
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string $statement - A simple string the statement should start with or a valid regular expression.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • string $filter - The filter name, e.g. 'posts_where'.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • string $message - An optional message to override the default one.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      assertQueriesByStatementAndFunction

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Asserts that queries were made by the specified function starting with the specified SQL statement. Queries generated by setUp, tearDown and factory methods are excluded by default.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      wp_insert_post(['post_type' => 'book', 'post_title' => 'Alice in Wonderland']);
                                                                                                                                                                                                                                                                                                                                                                      +  $this->assertQueriesByStatementAndFunction('INSERT', 'wp_insert_post');
                                                                                                                                                                                                                                                                                                                                                                      +  Regular expressions must contain delimiters.
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string $statement - A simple string the statement should start with or a valid regular expression.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • string $function - The fully qualified function name.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • string $message - An optional message to override the default one.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      assertQueriesByStatementAndMethod

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Asserts that queries were made by the specified class method starting with the specified SQL statement. Queries generated by setUp, tearDown and factory methods are excluded by default.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      Acme\BookRepository::new(['title' => 'Alice in Wonderland'])->commit();
                                                                                                                                                                                                                                                                                                                                                                      +  $this->assertQueriesByStatementAndMethod('UPDATE', Acme\BookRepository::class, 'commit');
                                                                                                                                                                                                                                                                                                                                                                      +  Regular expressions must contain delimiters.
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string $statement - A simple string the statement should start with or a valid regular expression.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • string $class - The fully qualified name of the class to check.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • string $method - The name of the method to check.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • string $message - An optional message to override the default one.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      assertQueriesCountByAction

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Asserts that n queries were made as a consequence of the specified action. Queries generated by setUp, tearDown and factory methods are excluded by default.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      add_action( 'edit_post', function($postId){
                                                                                                                                                                                                                                                                                                                                                                      +  $count = get_option('acme_title_updates_count');
                                                                                                                                                                                                                                                                                                                                                                      +  update_option('acme_title_updates_count', ++$count);
                                                                                                                                                                                                                                                                                                                                                                      +  } );
                                                                                                                                                                                                                                                                                                                                                                      +  wp_update_post(['ID' => $bookOneId, 'post_title' => 'One']);
                                                                                                                                                                                                                                                                                                                                                                      +  wp_update_post(['ID' => $bookTwoId, 'post_title' => 'Two']);
                                                                                                                                                                                                                                                                                                                                                                      +  wp_update_post(['ID' => $bookThreeId, 'post_title' => 'Three']);
                                                                                                                                                                                                                                                                                                                                                                      +  $this->assertQueriesCountByAction(3, 'edit_post');
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • int $n - The expected number of queries.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • string $action - The action name, e.g. 'init'.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • string $message - An optional message to override the default one.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      assertQueriesCountByFilter

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Asserts that n queries were made as a consequence of the specified filter. Queries generated by setUp, tearDown and factory methods are excluded by default.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      add_filter('the_title', function($title, $postId){
                                                                                                                                                                                                                                                                                                                                                                      +  $post = get_post($postId);
                                                                                                                                                                                                                                                                                                                                                                      +  if($post->post_type !== 'book'){
                                                                                                                                                                                                                                                                                                                                                                      +  return $title;
                                                                                                                                                                                                                                                                                                                                                                      +  }
                                                                                                                                                                                                                                                                                                                                                                      +  $new = get_option('acme_new_prefix');
                                                                                                                                                                                                                                                                                                                                                                      +  return "{$new} - " . $title;
                                                                                                                                                                                                                                                                                                                                                                      +  });
                                                                                                                                                                                                                                                                                                                                                                      +  $title = apply_filters('the_title', get_post($bookOneId)->post_title, $bookOneId);
                                                                                                                                                                                                                                                                                                                                                                      +  $title = apply_filters('the_title', get_post($notABookId)->post_title, $notABookId);
                                                                                                                                                                                                                                                                                                                                                                      +  $title = apply_filters('the_title', get_post($bookTwoId)->post_title, $bookTwoId);
                                                                                                                                                                                                                                                                                                                                                                      +  $this->assertQueriesCountByFilter(2, 'the_title');
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • int $n - The expected number of queries.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • string $filter - The filter name, e.g. 'posts_where'.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • string $message - An optional message to override the default one.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      assertQueriesCountByFunction

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Asserts that n queries were made by the specified function. Queries generated by setUp, tearDown and factory methods are excluded by default.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $this->assertCount(3, Acme\get_orphaned_posts());
                                                                                                                                                                                                                                                                                                                                                                      +  Acme\delete_orphaned_posts();
                                                                                                                                                                                                                                                                                                                                                                      +  $this->assertQueriesCountByFunction(3, 'Acme\delete_orphaned_posts');
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • int $n - The expected number of queries.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • string $function - The function to check the queries for.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • string $message - An optional message to override the default one.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      assertQueriesCountByMethod

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Asserts that n queries have been made by the specified class method. Queries generated by setUp, tearDown and factory methods are excluded by default.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $bookRepository = new Acme\BookRepository();
                                                                                                                                                                                                                                                                                                                                                                      +  $repository->where('ID', 23)->commit('title', 'Peter Pan');
                                                                                                                                                                                                                                                                                                                                                                      +  $repository->where('ID', 89)->commit('title', 'Moby-dick');
                                                                                                                                                                                                                                                                                                                                                                      +  $repository->where('ID', 2389)->commit('title', 'The call of the wild');
                                                                                                                                                                                                                                                                                                                                                                      +  $this->assertQueriesCountByMethod(3, 'Acme\BookRepository', 'commit');
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • int $n - The expected number of queries.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • string $class - The fully qualified name of the class to check.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • string $method - The name of the method to check.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • string $message - An optional message to override the default one.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      assertQueriesCountByStatement

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Asserts that n queries starting with the specified statement were made. Queries generated by setUp, tearDown and factory methods are excluded by default.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $bookRepository = new Acme\BookRepository();
                                                                                                                                                                                                                                                                                                                                                                      +  $repository->where('ID', 23)->set('title', 'Peter Pan', $deferred = true);
                                                                                                                                                                                                                                                                                                                                                                      +  $repository->where('ID', 89)->set('title', 'Moby-dick', $deferred = true);
                                                                                                                                                                                                                                                                                                                                                                      +  $repository->where('ID', 2389)->set('title', 'The call of the wild', $deferred = false);
                                                                                                                                                                                                                                                                                                                                                                      +  $this->assertQueriesCountByStatement(1, 'INSERT', 'Deferred write should happen on __destruct');
                                                                                                                                                                                                                                                                                                                                                                      +  Regular expressions must contain delimiters.
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • int $n - The expected number of queries.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • string $statement - A simple string the statement should start with or a valid regular expression.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • string $message - An optional message to override the default one.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      assertQueriesCountByStatementAndAction

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Asserts that n queries were made as a consequence of the specified action containing the specified SQL statement. Queries generated by setUp, tearDown and factory methods are excluded by default.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      add_action( 'edit_post', function($postId){
                                                                                                                                                                                                                                                                                                                                                                      +  $count = get_option('acme_title_updates_count');
                                                                                                                                                                                                                                                                                                                                                                      +  update_option('acme_title_updates_count', ++$count);
                                                                                                                                                                                                                                                                                                                                                                      +  } );
                                                                                                                                                                                                                                                                                                                                                                      +  wp_delete_post($bookOneId);
                                                                                                                                                                                                                                                                                                                                                                      +  wp_delete_post($bookTwoId);
                                                                                                                                                                                                                                                                                                                                                                      +  wp_update_post(['ID' => $bookThreeId, 'post_title' => 'New']);
                                                                                                                                                                                                                                                                                                                                                                      +  $this->assertQueriesCountByStatementAndAction(2, 'DELETE', 'delete_post');
                                                                                                                                                                                                                                                                                                                                                                      +  $this->assertQueriesCountByStatementAndAction(1, 'INSERT', 'edit_post');
                                                                                                                                                                                                                                                                                                                                                                      +  Regular expressions must contain delimiters.
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • int $n - The expected number of queries.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • string $statement - A simple string the statement should start with or a valid regular expression.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • string $action - The action name, e.g. 'init'.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • string $message - An optional message to override the default one.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      assertQueriesCountByStatementAndFilter

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Asserts that n queries were made as a consequence of the specified filter containing the specified SQL statement. Queries generated by setUp, tearDown and factory methods are excluded by default.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      add_filter('the_title', function($title, $postId){
                                                                                                                                                                                                                                                                                                                                                                      +  $post = get_post($postId);
                                                                                                                                                                                                                                                                                                                                                                      +  if($post->post_type !== 'book'){
                                                                                                                                                                                                                                                                                                                                                                      +  return $title;
                                                                                                                                                                                                                                                                                                                                                                      +  }
                                                                                                                                                                                                                                                                                                                                                                      +  $new = get_option('acme_new_prefix');
                                                                                                                                                                                                                                                                                                                                                                      +  return "{$new} - " . $title;
                                                                                                                                                                                                                                                                                                                                                                      +  });
                                                                                                                                                                                                                                                                                                                                                                      +  // Warm up the cache.
                                                                                                                                                                                                                                                                                                                                                                      +  $title = apply_filters('the_title', get_post($bookOneId)->post_title, $bookOneId);
                                                                                                                                                                                                                                                                                                                                                                      +  // Cache is warmed up now.
                                                                                                                                                                                                                                                                                                                                                                      +  $title = apply_filters('the_title', get_post($bookTwoId)->post_title, $bookTwoId);
                                                                                                                                                                                                                                                                                                                                                                      +  $title = apply_filters('the_title', get_post($bookThreeId)->post_title, $bookThreeId);
                                                                                                                                                                                                                                                                                                                                                                      +  $this->assertQueriesCountByStatementAndFilter(1, 'SELECT', 'the_title');
                                                                                                                                                                                                                                                                                                                                                                      +  Regular expressions must contain delimiters.
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • int $n - The expected number of queries.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • string $statement - A simple string the statement should start with or a valid regular expression.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • string $filter - The filter name, e.g. 'posts_where'.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • string $message - An optional message to override the default one.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      assertQueriesCountByStatementAndFunction

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Asserts that n queries were made by the specified function starting with the specified SQL statement. Queries generated by setUp, tearDown and factory methods are excluded by default.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      wp_insert_post(['post_type' => 'book', 'post_title' => 'The Call of the Wild']);
                                                                                                                                                                                                                                                                                                                                                                      +  wp_insert_post(['post_type' => 'book', 'post_title' => 'Alice in Wonderland']);
                                                                                                                                                                                                                                                                                                                                                                      +  wp_insert_post(['post_type' => 'book', 'post_title' => 'The Chocolate Factory']);
                                                                                                                                                                                                                                                                                                                                                                      +  $this->assertQueriesCountByStatementAndFunction(3, 'INSERT', 'wp_insert_post');
                                                                                                                                                                                                                                                                                                                                                                      +  Regular expressions must contain delimiters.
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • int $n - The expected number of queries.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • string $statement - A simple string the statement should start with or a valid regular expression.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • string $function - The fully-qualified function name.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • string $message - An optional message to override the default one.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      assertQueriesCountByStatementAndMethod

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Asserts that n queries were made by the specified class method starting with the specified SQL statement. Queries generated by setUp, tearDown and factory methods are excluded by default.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      Acme\BookRepository::new(['title' => 'Alice in Wonderland'])->commit();
                                                                                                                                                                                                                                                                                                                                                                      +  Acme\BookRepository::new(['title' => 'Moby-Dick'])->commit();
                                                                                                                                                                                                                                                                                                                                                                      +  Acme\BookRepository::new(['title' => 'The Call of the Wild'])->commit();
                                                                                                                                                                                                                                                                                                                                                                      +  $this->assertQueriesCountByStatementAndMethod(3, 'INSERT', Acme\BookRepository::class, 'commit');
                                                                                                                                                                                                                                                                                                                                                                      +  Regular expressions must contain delimiters.
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • int $n - The expected number of queries.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • string $statement - A simple string the statement should start with or a valid regular expression.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • string $class - The fully qualified name of the class to check.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • string $method - The name of the method to check.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • string $message - An optional message to override the default one.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      countQueries

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Returns the current number of queries. Set-up and tear-down queries performed by the test case are filtered out.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      // In a WPTestCase, using the global $wpdb object.
                                                                                                                                                                                                                                                                                                                                                                      +  $queriesCount = $this->queries()->countQueries();
                                                                                                                                                                                                                                                                                                                                                                      +  // In a WPTestCase, using a custom $wpdb object.
                                                                                                                                                                                                                                                                                                                                                                      +  $queriesCount = $this->queries()->countQueries($customWdbb);
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • \wpdb/null $wpdb - A specific instance of the wpdb class or null to use the global one.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      getQueries

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Returns the queries currently performed by the global database object or the specified one. Set-up and tear-down queries performed by the test case are filtered out.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      // In a WPTestCase, using the global $wpdb object.
                                                                                                                                                                                                                                                                                                                                                                      +  $queries = $this->queries()->getQueries();
                                                                                                                                                                                                                                                                                                                                                                      +  // In a WPTestCase, using a custom $wpdb object.
                                                                                                                                                                                                                                                                                                                                                                      +  $queries = $this->queries()->getQueries($customWdbb);
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • null/\wpdb $wpdb - A specific instance of the wpdb class or null to use the global one.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      This class extends \Codeception\Module

                                                                                                                                                                                                                                                                                                                                                                      + + + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + + + + + \ No newline at end of file diff --git a/docs/v3/modules/WPWebDriver/index.html b/docs/v3/modules/WPWebDriver/index.html new file mode 100644 index 000000000..aab064073 --- /dev/null +++ b/docs/v3/modules/WPWebDriver/index.html @@ -0,0 +1,2623 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + WPWebDriver - wp-browser docs + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      + + +
                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      This is the documentation for version 3 of the project. +The current version is version 4 and the documentation can be found here.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      WpWebDriver module

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      This module should be used in acceptance tests, see levels of testing for more information.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      This module extends the WebDriver module adding WordPress-specific configuration parameters and methods.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      The module simulates a user interaction with the site with Javascript support; if you don't need to test your project with Javascript support use the WPBrowser module.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Module requirements for Codeception 4.0+

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      This module requires the codeception/module-webdriver Composer package to work when wp-browser is used with Codeception 4.0.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      To install the package run:

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      composer require --dev codeception/module-webdriver:^1.0
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Configuration

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Due to the combination of possible browsers, capabilities and configurations, it's not possible to provide an exhaustive coverage of all the possible configuration parameteters here.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Please refer to WebDriver documentation for more information.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • url required - Start URL of your WordPress project, e.g. http://wp.test.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • adminUsername required - This is the login name, not the "nice" name, of the administrator user of the WordPress test site. This will be used to fill the username field in WordPress login page.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • adminPassword required - This is the the password of the administrator use of the WordPress test site. This will be used to fill the password in WordPress login page.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • adminPath required - The path, relative to the WordPress test site home URL, to the administration area, usually /wp-admin.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • browser - The browser to use for the tests, e.g. chrome or firefox.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • capabilities - Depending on the browser set in browser this is a list of browser-specific capabilities.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Example configuration

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      modules:
                                                                                                                                                                                                                                                                                                                                                                      +  enabled:
                                                                                                                                                                                                                                                                                                                                                                      +    - WPWebDriver
                                                                                                                                                                                                                                                                                                                                                                      +  config:
                                                                                                                                                                                                                                                                                                                                                                      +    WPWebDriver:
                                                                                                                                                                                                                                                                                                                                                                      +      url: 'http://wp.test'
                                                                                                                                                                                                                                                                                                                                                                      +      adminUsername: 'admin'
                                                                                                                                                                                                                                                                                                                                                                      +      adminPassword: 'password'
                                                                                                                                                                                                                                                                                                                                                                      +      adminPath: '/wp-admin'
                                                                                                                                                                                                                                                                                                                                                                      +      browser: chrome
                                                                                                                                                                                                                                                                                                                                                                      +      host: localhost
                                                                                                                                                                                                                                                                                                                                                                      +      port: 4444
                                                                                                                                                                                                                                                                                                                                                                      +      window_size: false #disabled for Chrome driver
                                                                                                                                                                                                                                                                                                                                                                      +      capabilities:
                                                                                                                                                                                                                                                                                                                                                                      +        chromeOptions:
                                                                                                                                                                                                                                                                                                                                                                      +          args: ["--headless", "--disable-gpu", "--proxy-server='direct://'", "--proxy-bypass-list=*"]
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + +

                                                                                                                                                                                                                                                                                                                                                                      Public API

                                                                                                                                                                                                                                                                                                                                                                      + + +

                                                                                                                                                                                                                                                                                                                                                                      activatePlugin

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      In the plugin administration screen activates one or more plugins clicking the "Activate" link. The method will not handle authentication and navigation to the plugins administration page.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      // Activate a plugin.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->loginAsAdmin();
                                                                                                                                                                                                                                                                                                                                                                      +  $I->amOnPluginsPage();
                                                                                                                                                                                                                                                                                                                                                                      +  $I->activatePlugin('hello-dolly');
                                                                                                                                                                                                                                                                                                                                                                      +  // Activate a list of plugins.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->loginAsAdmin();
                                                                                                                                                                                                                                                                                                                                                                      +  $I->amOnPluginsPage();
                                                                                                                                                                                                                                                                                                                                                                      +  $I->activatePlugin(['hello-dolly','another-plugin']);
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string/\Codeception\Module\array $pluginSlug - The plugin slug, like "hello-dolly" or a list of plugin slugs.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      amEditingPostWithId

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Go to the admin page to edit the post with the specified ID. The method will not handle authentication the admin area.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $I->loginAsAdmin();
                                                                                                                                                                                                                                                                                                                                                                      +  $postId = $I->havePostInDatabase();
                                                                                                                                                                                                                                                                                                                                                                      +  $I->amEditingPostWithId($postId);
                                                                                                                                                                                                                                                                                                                                                                      +  $I->fillField('post_title', 'Post title');
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • int $id - The post ID.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      amOnAdminAjaxPage

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Go to the admin-ajax.php page to start a synchronous, and blocking, GET AJAX request. The method will not handle authentication, nonces or authorization.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $I->amOnAdminAjaxPage(['action' => 'my-action', 'data' => ['id' => 23], 'nonce' => $nonce]);
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string/\Codeception\Module\array $queryVars - A string or array of query variables to append to the AJAX path.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      amOnAdminPage

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Go to a page in the admininstration area of the site. This method will not handle authentication to the administration area.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $I->loginAs('user', 'password');
                                                                                                                                                                                                                                                                                                                                                                      +  // Go to the plugins management screen.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->amOnAdminPage('/plugins.php');
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string $page - The path, relative to the admin area URL, to the page.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      amOnCronPage

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Go to the cron page to start a synchronous, and blocking, GET request to the cron script.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      // Triggers the cron job with an optional query argument.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->amOnCronPage('/?some-query-var=some-value');
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string/\Codeception\Module\array $queryVars - A string or array of query variables to append to the AJAX path.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      amOnPagesPage

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Go the "Pages" administration screen. The method will not handle authentication.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $I->loginAsAdmin();
                                                                                                                                                                                                                                                                                                                                                                      +  $I->amOnPagesPage();
                                                                                                                                                                                                                                                                                                                                                                      +  $I->see('Add New');
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      amOnPluginsPage

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Go to the plugins administration screen. The method will not handle authentication.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $I->loginAsAdmin();
                                                                                                                                                                                                                                                                                                                                                                      +  $I->amOnPluginsPage();
                                                                                                                                                                                                                                                                                                                                                                      +  $I->activatePlugin('hello-dolly');
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      deactivatePlugin

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      In the plugin administration screen deactivate a plugin clicking the "Deactivate" link. The method will not handle authentication and navigation to the plugins administration page.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      // Deactivate one plugin.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->loginAsAdmin();
                                                                                                                                                                                                                                                                                                                                                                      +  $I->amOnPluginsPage();
                                                                                                                                                                                                                                                                                                                                                                      +  $I->deactivatePlugin('hello-dolly');
                                                                                                                                                                                                                                                                                                                                                                      +  // Deactivate a list of plugins.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->loginAsAdmin();
                                                                                                                                                                                                                                                                                                                                                                      +  $I->amOnPluginsPage();
                                                                                                                                                                                                                                                                                                                                                                      +  $I->deactivatePlugin(['hello-dolly', 'my-plugin']);
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string/\Codeception\Module\array $pluginSlug - The plugin slug, like "hello-dolly", or a list of plugin slugs.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      dontSeePluginInstalled

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Assert a plugin is not installed in the plugins administration screen. The method will not handle authentication and navigation to the plugin administration screen.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $I->loginAsAdmin();
                                                                                                                                                                                                                                                                                                                                                                      +  $I->amOnPluginsPage();
                                                                                                                                                                                                                                                                                                                                                                      +  $I->dontSeePluginInstalled('my-plugin');
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string $pluginSlug - The plugin slug, like "hello-dolly".
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      grabCookiesWithPattern

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Returns all the cookies whose name matches a regex pattern.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $I->loginAs('customer','password');
                                                                                                                                                                                                                                                                                                                                                                      +  $I->amOnPage('/shop');
                                                                                                                                                                                                                                                                                                                                                                      +  $cartCookies = $I->grabCookiesWithPattern("#^shop_cart\\.*#");
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string $cookiePattern - The regular expression pattern to use for the matching.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      grabFullUrl

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Grabs the current page full URL including the query vars.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $today = date('Y-m-d');
                                                                                                                                                                                                                                                                                                                                                                      +  $I->amOnPage('/concerts?date=' . $today);
                                                                                                                                                                                                                                                                                                                                                                      +  $I->assertRegExp('#\\/concerts$#', $I->grabFullUrl());
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      grabWordPressTestCookie

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Returns WordPress default test cookie object if present.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      // Grab the default WordPress test cookie.
                                                                                                                                                                                                                                                                                                                                                                      +  $wpTestCookie = $I->grabWordPressTestCookie();
                                                                                                                                                                                                                                                                                                                                                                      +  // Grab a customized version of the test cookie.
                                                                                                                                                                                                                                                                                                                                                                      +  $myTestCookie = $I->grabWordPressTestCookie('my_test_cookie');
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string $name - Optional, overrides the default cookie name.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      logOut

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Navigate to the default WordPress logout page and click the logout link.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      // Log out using the `wp-login.php` form and return to the current page.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->logOut(true);
                                                                                                                                                                                                                                                                                                                                                                      +  // Log out using the `wp-login.php` form and remain there.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->logOut(false);
                                                                                                                                                                                                                                                                                                                                                                      +  // Log out using the `wp-login.php` form and move to another page.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->logOut('/some-other-page');
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • bool/bool/string $redirectTo - Whether to redirect to another (optionally specified) page after the logout.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      loginAs

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Login as the specified user. The method will not follow redirection, after the login, to any page. Depending on the driven browser the login might be "too fast" and the server might have not replied with valid cookies yet; in that case the method will re-attempt the login to obtain the cookies.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $I->loginAs('user', 'password');
                                                                                                                                                                                                                                                                                                                                                                      +  $I->amOnAdminPage('/');
                                                                                                                                                                                                                                                                                                                                                                      +  $I->see('Dashboard');
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string $username - The user login name.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • string $password - The user password in plain text.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • int $timeout - The max time, in seconds, to try to login.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • int $maxAttempts - The max number of attempts to try to login.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      loginAsAdmin

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Login as the administrator user using the credentials specified in the module configuration. The method will not follow redirection, after the login, to any page.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $I->loginAsAdmin();
                                                                                                                                                                                                                                                                                                                                                                      +  $I->amOnAdminPage('/');
                                                                                                                                                                                                                                                                                                                                                                      +  $I->see('Dashboard');
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • int $timeout - The max time, in seconds, to try to login.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • int $maxAttempts - The max number of attempts to try to login.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      seeErrorMessage

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      In an administration screen look for an error admin notice. The check is class-based to decouple from internationalization. The method will not handle authentication and navigation the administration area. .notice.notice-error ones.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $I->loginAsAdmin()
                                                                                                                                                                                                                                                                                                                                                                      +  $I->amOnAdminPage('/');
                                                                                                                                                                                                                                                                                                                                                                      +  $I->seeErrorMessage('.my-plugin');
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string/string/\Codeception\Module\array $classes - A list of classes the notice should have other than the
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      seeMessage

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      In an administration screen look for an admin notice. The check is class-based to decouple from internationalization. The method will not handle authentication and navigation the administration area.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $I->loginAsAdmin()
                                                                                                                                                                                                                                                                                                                                                                      +  $I->amOnAdminPage('/');
                                                                                                                                                                                                                                                                                                                                                                      +  $I->seeMessage('.missing-api-token.my-plugin');
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string/\Codeception\Module\array/string $classes - A list of classes the message should have in addition to the .notice one.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      seePluginActivated

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Assert a plugin is activated in the plugin administration screen. The method will not handle authentication and navigation to the plugin administration screen.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $I->loginAsAdmin();
                                                                                                                                                                                                                                                                                                                                                                      +  $I->amOnPluginsPage();
                                                                                                                                                                                                                                                                                                                                                                      +  $I->seePluginActivated('my-plugin');
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string $pluginSlug - The plugin slug, like "hello-dolly".
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      seePluginDeactivated

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Assert a plugin is not activated in the plugins administration screen. The method will not handle authentication and navigation to the plugin administration screen.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $I->loginAsAdmin();
                                                                                                                                                                                                                                                                                                                                                                      +  $I->amOnPluginsPage();
                                                                                                                                                                                                                                                                                                                                                                      +  $I->seePluginDeactivated('my-plugin');
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string $pluginSlug - The plugin slug, like "hello-dolly".
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      seePluginInstalled

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Assert a plugin is installed, no matter its activation status, in the plugin administration screen. The method will not handle authentication and navigation to the plugin administration screen.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $I->loginAsAdmin();
                                                                                                                                                                                                                                                                                                                                                                      +  $I->amOnPluginsPage();
                                                                                                                                                                                                                                                                                                                                                                      +  $I->seePluginInstalled('my-plugin');
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string $pluginSlug - The plugin slug, like "hello-dolly".
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      seeWpDiePage

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Checks that the current page is one generated by the wp_die function. The method will try to identify the page based on the default WordPress die page HTML attributes.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $I->loginAs('user', 'password');
                                                                                                                                                                                                                                                                                                                                                                      +  $I->amOnAdminPage('/forbidden');
                                                                                                                                                                                                                                                                                                                                                                      +  $I->seeWpDiePage();
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      waitForJqueryAjax

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Waits for any jQuery triggered AJAX request to be resolved.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $I->amOnPage('/triggering-ajax-requests');
                                                                                                                                                                                                                                                                                                                                                                      +  $I->waitForJqueryAjax();
                                                                                                                                                                                                                                                                                                                                                                      +  $I->see('From AJAX');
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • int $time - The max time to wait for AJAX requests to complete.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      This class extends \Codeception\Module\WebDriver

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      This class implements \Codeception\Lib\Interfaces\RequiresPackage, \Codeception\Lib\Interfaces\ConflictsWithModule, \Codeception\Lib\Interfaces\ElementLocator, \Codeception\Lib\Interfaces\PageSourceSaver, \Codeception\Lib\Interfaces\ScreenshotSaver, \Codeception\Lib\Interfaces\SessionSnapshot, \Codeception\Lib\Interfaces\MultiSession, \Codeception\Lib\Interfaces\Remote, \Codeception\Lib\Interfaces\Web

                                                                                                                                                                                                                                                                                                                                                                      + + + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + + + + + \ No newline at end of file diff --git a/docs/v3/modules/WordPress/index.html b/docs/v3/modules/WordPress/index.html new file mode 100644 index 000000000..e3f50ec11 --- /dev/null +++ b/docs/v3/modules/WordPress/index.html @@ -0,0 +1,2524 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + WordPress - wp-browser docs + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      + + +
                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      This is the documentation for version 3 of the project. +The current version is version 4 and the documentation can be found here.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      WordPress module

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      This module requires good knowledge and attention to be used effectively; you can replace it with a combination of the WPBrowser module together with the WPLoader module in loadOnly mode. +This module should be used in functional tests, see levels of testing for more information.
                                                                                                                                                                                                                                                                                                                                                                      +This module provides a middle-ground, in terms of testing and effects, between the fully isolated approach of the WPBrowser module and the fully integrated approach of the WPLoader module with loadOnly set to false.
                                                                                                                                                                                                                                                                                                                                                                      +It allows to interact with WordPress on a very high level, using methods like $I->loginAs() or $I->amOnPage() as you could do with the WPBrowser module while also loading WordPress in the same variable scope as the tests as the WPLoader module would. +Due to WordPress reliance on constants, globals and side-effects this module will make requests to WordPress in an insulated manner and reproduce WordPress environment (globals and super-globals) after each response in the tests variable scope. +The module simulates a user interaction with the site without Javascript support, use the WPWebDriver module for any kind of testing that requires Javascript-based interaction with the site.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Module requirements for Codeception 4.0+

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      This module requires the codeception/lib-innerbrowser Composer package to work when wp-browser is used with Codeception 4.0.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      To install the package run:

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      composer require --dev codeception/lib-innerbrowser:^1.0
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Detecting requests coming from this module

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      When it runs this module will set the WPBROWSER_HOST_REQUEST environment variable.
                                                                                                                                                                                                                                                                                                                                                                      +You can detect and use that information to, as an example, use the correct database in your test site wp-config.php file: +

                                                                                                                                                                                                                                                                                                                                                                      <?php
                                                                                                                                                                                                                                                                                                                                                                      +if ( 
                                                                                                                                                                                                                                                                                                                                                                      +    // Custom header.
                                                                                                                                                                                                                                                                                                                                                                      +    isset( $_SERVER['HTTP_X_TESTING'] )
                                                                                                                                                                                                                                                                                                                                                                      +    // Custom user agent.
                                                                                                                                                                                                                                                                                                                                                                      +    || ( isset( $_SERVER['HTTP_USER_AGENT'] ) && $_SERVER['HTTP_USER_AGENT'] === 'wp-browser' )
                                                                                                                                                                                                                                                                                                                                                                      +    // The env var set by the WPClIr or WordPress modules.
                                                                                                                                                                                                                                                                                                                                                                      +    || getenv( 'WPBROWSER_HOST_REQUEST' )
                                                                                                                                                                                                                                                                                                                                                                      +) {
                                                                                                                                                                                                                                                                                                                                                                      +    // Use the test database if the request comes from a test.
                                                                                                                                                                                                                                                                                                                                                                      +    define( 'DB_NAME', 'wordpress_test' );
                                                                                                                                                                                                                                                                                                                                                                      +} else {
                                                                                                                                                                                                                                                                                                                                                                      +    // Else use the default one.
                                                                                                                                                                                                                                                                                                                                                                      +    define( 'DB_NAME', 'wordpress' );
                                                                                                                                                                                                                                                                                                                                                                      +}
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Configuration

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • wpRootFolder required The absolute, or relative to the project root folder, path to the root WordPress installation folder. The WordPress installation root folder is the one that contains the wp-load.php file.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • adminUsername required - This is the login name, not the "nice" name, of the administrator user of the WordPress test site. This will be used to fill the username field in WordPress login page.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • adminPassword required - This is the the password of the administrator use of the WordPress test site. This will be used to fill the password in WordPress login page.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • adminPath required - The path, relative to the WordPress test site home URL, to the administration area, usually /wp-admin.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Example configuration

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        modules:
                                                                                                                                                                                                                                                                                                                                                                      +      enabled:
                                                                                                                                                                                                                                                                                                                                                                      +          - WordPress
                                                                                                                                                                                                                                                                                                                                                                      +      config:
                                                                                                                                                                                                                                                                                                                                                                      +          WordPress:
                                                                                                                                                                                                                                                                                                                                                                      +              wpRootFolder: "/var/www/wordpress"
                                                                                                                                                                                                                                                                                                                                                                      +              adminUsername: 'admin'
                                                                                                                                                                                                                                                                                                                                                                      +              adminPassword: 'password'
                                                                                                                                                                                                                                                                                                                                                                      +              adminPath: '/wp-admin'
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + +

                                                                                                                                                                                                                                                                                                                                                                      Public API

                                                                                                                                                                                                                                                                                                                                                                      + + +

                                                                                                                                                                                                                                                                                                                                                                      amEditingPostWithId

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Go to the admin page to edit the post with the specified ID. The method will not handle authentication the admin area.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $I->loginAsAdmin();
                                                                                                                                                                                                                                                                                                                                                                      +  $postId = $I->havePostInDatabase();
                                                                                                                                                                                                                                                                                                                                                                      +  $I->amEditingPostWithId($postId);
                                                                                                                                                                                                                                                                                                                                                                      +  $I->fillField('post_title', 'Post title');
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • int $id - The post ID.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      amOnAdminAjaxPage

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Go to the admin-ajax.php page to start a synchronous, and blocking, GET AJAX request. The method will not handle authentication, nonces or authorization.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $I->amOnAdminAjaxPage(['action' => 'my-action', 'data' => ['id' => 23], 'nonce' => $nonce]);
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string/\Codeception\Module\array $queryVars - A string or array of query variables to append to the AJAX path.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      amOnAdminPage

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Go to a page in the admininstration area of the site.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $I->loginAs('user', 'password');
                                                                                                                                                                                                                                                                                                                                                                      +  // Go to the plugins management screen.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->amOnAdminPage('/plugins.php');
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string $page - The path, relative to the admin area URL, to the page.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      amOnCronPage

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Go to the cron page to start a synchronous, and blocking, GET request to the cron script.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      // Triggers the cron job with an optional query argument.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->amOnCronPage('/?some-query-var=some-value');
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string/\Codeception\Module\array $queryVars - A string or array of query variables to append to the AJAX path.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      amOnPage

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Go to a page on the site. The module will try to reach the page, relative to the URL specified in the module configuration, without applying any permalink resolution.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      // Go the the homepage.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->amOnPage('/');
                                                                                                                                                                                                                                                                                                                                                                      +  // Go to the single page of post with ID 23.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->amOnPage('/?p=23');
                                                                                                                                                                                                                                                                                                                                                                      +  // Go to search page for the string "foo".
                                                                                                                                                                                                                                                                                                                                                                      +  $I->amOnPage('/?s=foo');
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string $page - The path to the page, relative to the the root URL.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      amOnPagesPage

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Go the "Pages" administration screen. The method will not handle authentication.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $I->loginAsAdmin();
                                                                                                                                                                                                                                                                                                                                                                      +  $I->amOnPagesPage();
                                                                                                                                                                                                                                                                                                                                                                      +  $I->see('Add New');
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      amOnPluginsPage

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Go to the plugins administration screen. The method will not handle authentication.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $I->loginAsAdmin();
                                                                                                                                                                                                                                                                                                                                                                      +  $I->amOnPluginsPage();
                                                                                                                                                                                                                                                                                                                                                                      +  $I->activatePlugin('hello-dolly');
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      dontSeePluginInstalled

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Assert a plugin is not installed in the plugins administration screen. The method will not handle authentication and navigation to the plugin administration screen.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $I->loginAsAdmin();
                                                                                                                                                                                                                                                                                                                                                                      +  $I->amOnPluginsPage();
                                                                                                                                                                                                                                                                                                                                                                      +  $I->dontSeePluginInstalled('my-plugin');
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string $pluginSlug - The plugin slug, like "hello-dolly".
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      extractCookie

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Grab a cookie value from the current session, sets it in the $_COOKIE array and returns its value. This method utility is to get, in the scope of test code, the value of a cookie set during the tests.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $id = $I->haveUserInDatabase('user', 'subscriber', ['user_pass' => 'pass']);
                                                                                                                                                                                                                                                                                                                                                                      +  $I->loginAs('user', 'pass');
                                                                                                                                                                                                                                                                                                                                                                      +  // The cookie is now set in the `$_COOKIE` super-global.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->extractCookie(LOGGED_IN_COOKIE);
                                                                                                                                                                                                                                                                                                                                                                      +  // Generate a nonce using WordPress methods (see WPLoader in loadOnly mode) with correctly set context.
                                                                                                                                                                                                                                                                                                                                                                      +  wp_set_current_user($id);
                                                                                                                                                                                                                                                                                                                                                                      +  $nonce = wp_create_nonce('wp_rest');
                                                                                                                                                                                                                                                                                                                                                                      +  // Use the generated nonce to make a request to the the REST API.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->haveHttpHeader('X-WP-Nonce', $nonce);
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string $cookie - The cookie name.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • array/\Codeception\Module\array/array $params - Parameters to filter the cookie value.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      getResponseContent

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Returns content of the last response. This method exposes an underlying API for custom assertions.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      // In test class.
                                                                                                                                                                                                                                                                                                                                                                      +  $this->assertContains($text, $this->getResponseContent(), "foo-bar");
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      getWpRootFolder

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Returns the absolute path to the WordPress root folder.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $root = $I->getWpRootFolder();
                                                                                                                                                                                                                                                                                                                                                                      +  $this->assertFileExists($root . '/someFile.txt');
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      grabWordPressTestCookie

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Returns WordPress default test cookie object if present.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      // Grab the default WordPress test cookie.
                                                                                                                                                                                                                                                                                                                                                                      +  $wpTestCookie = $I->grabWordPressTestCookie();
                                                                                                                                                                                                                                                                                                                                                                      +  // Grab a customized version of the test cookie.
                                                                                                                                                                                                                                                                                                                                                                      +  $myTestCookie = $I->grabWordPressTestCookie('my_test_cookie');
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string $name - Optional, overrides the default cookie name.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      logOut

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Navigate to the default WordPress logout page and click the logout link.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      // Log out using the `wp-login.php` form and return to the current page.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->logOut(true);
                                                                                                                                                                                                                                                                                                                                                                      +  // Log out using the `wp-login.php` form and remain there.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->logOut(false);
                                                                                                                                                                                                                                                                                                                                                                      +  // Log out using the `wp-login.php` form and move to another page.
                                                                                                                                                                                                                                                                                                                                                                      +  $I->logOut('/some-other-page');
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • bool/bool/string $redirectTo - Whether to redirect to another (optionally specified) page after the logout.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      loginAs

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Login as the specified user. The method will not follow redirection, after the login, to any page.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $I->loginAs('user', 'password');
                                                                                                                                                                                                                                                                                                                                                                      +  $I->amOnAdminPage('/');
                                                                                                                                                                                                                                                                                                                                                                      +  $I->seeElement('.admin');
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string $username - The user login name.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • string $password - The user password in plain text.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      loginAsAdmin

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Login as the administrator user using the credentials specified in the module configuration. The method will not follow redirection, after the login, to any page.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $I->loginAsAdmin();
                                                                                                                                                                                                                                                                                                                                                                      +  $I->amOnAdminPage('/');
                                                                                                                                                                                                                                                                                                                                                                      +  $I->see('Dashboard');
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      seeErrorMessage

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      In an administration screen look for an error admin notice. The check is class-based to decouple from internationalization. The method will not handle authentication and navigation the administration area. .notice.notice-error ones.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $I->loginAsAdmin()
                                                                                                                                                                                                                                                                                                                                                                      +  $I->amOnAdminPage('/');
                                                                                                                                                                                                                                                                                                                                                                      +  $I->seeErrorMessage('.my-plugin');
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string/string/\Codeception\Module\array $classes - A list of classes the notice should have other than the
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      seeMessage

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      In an administration screen look for an admin notice. The check is class-based to decouple from internationalization. The method will not handle authentication and navigation the administration area.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $I->loginAsAdmin()
                                                                                                                                                                                                                                                                                                                                                                      +  $I->amOnAdminPage('/');
                                                                                                                                                                                                                                                                                                                                                                      +  $I->seeMessage('.missing-api-token.my-plugin');
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string/\Codeception\Module\array/string $classes - A list of classes the message should have in addition to the .notice one.
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      seePluginActivated

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Assert a plugin is activated in the plugin administration screen. The method will not handle authentication and navigation to the plugin administration screen.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $I->loginAsAdmin();
                                                                                                                                                                                                                                                                                                                                                                      +  $I->amOnPluginsPage();
                                                                                                                                                                                                                                                                                                                                                                      +  $I->seePluginActivated('my-plugin');
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string $pluginSlug - The plugin slug, like "hello-dolly".
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      seePluginDeactivated

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Assert a plugin is not activated in the plugins administration screen. The method will not handle authentication and navigation to the plugin administration screen.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $I->loginAsAdmin();
                                                                                                                                                                                                                                                                                                                                                                      +  $I->amOnPluginsPage();
                                                                                                                                                                                                                                                                                                                                                                      +  $I->seePluginDeactivated('my-plugin');
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string $pluginSlug - The plugin slug, like "hello-dolly".
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      seePluginInstalled

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Assert a plugin is installed, no matter its activation status, in the plugin administration screen. The method will not handle authentication and navigation to the plugin administration screen.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $I->loginAsAdmin();
                                                                                                                                                                                                                                                                                                                                                                      +  $I->amOnPluginsPage();
                                                                                                                                                                                                                                                                                                                                                                      +  $I->seePluginInstalled('my-plugin');
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Parameters

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • string $pluginSlug - The plugin slug, like "hello-dolly".
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      seeWpDiePage

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + +

                                                                                                                                                                                                                                                                                                                                                                      Checks that the current page is one generated by the wp_die function. The method will try to identify the page based on the default WordPress die page HTML attributes.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      $I->loginAs('user', 'password');
                                                                                                                                                                                                                                                                                                                                                                      +  $I->amOnAdminPage('/forbidden');
                                                                                                                                                                                                                                                                                                                                                                      +  $I->seeWpDiePage();
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      This class extends \Codeception\Lib\Framework

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      This class implements \Codeception\Lib\Interfaces\Web, \Codeception\Lib\Interfaces\PageSourceSaver, \Codeception\Lib\Interfaces\ElementLocator, \Codeception\Lib\Interfaces\ConflictsWithModule, \Codeception\Lib\Interfaces\DependsOnModule

                                                                                                                                                                                                                                                                                                                                                                      + + + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + + + + + \ No newline at end of file diff --git a/docs/v3/requirements/index.html b/docs/v3/requirements/index.html new file mode 100644 index 000000000..faf794e62 --- /dev/null +++ b/docs/v3/requirements/index.html @@ -0,0 +1,2243 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Requirements - wp-browser docs + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      + + +
                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + + + +

                                                                                                                                                                                                                                                                                                                                                                      Requirements

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      This is the documentation for version 3 of the project. +The current version is version 4 and the documentation can be found here.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Requirements

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      wp-browser has some requirements your development environment will need to fulfill for it to work correctly.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      PHP

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      The minimum supported version of PHP supported by wp-browser is 5.6.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      This requirement does not reflect on the minimum PHP version your plugin might require; see the FAQs for more information.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Composer

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      There is no phar version of wp-browser and it can only be installed using Composer.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      See Composer installation guide for more information.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      WordPress, MySQL, Apache/Nginx

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      wp-browser will not download, install and configure WordPress for you.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      It will also not download, install and setup MySQL, Apache, Nginx or any other technology required by a fully functional WordPress installation for you.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      You need to set up a local WordPress installation on your own; you can use your preferred solution to do it.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      In the documentation I will show automated ways to do this but, for most projects, that's not the best solution.

                                                                                                                                                                                                                                                                                                                                                                      + + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + + + + + \ No newline at end of file diff --git a/docs/v3/setting-up-minimum-wordpress-installation/index.html b/docs/v3/setting-up-minimum-wordpress-installation/index.html new file mode 100644 index 000000000..a99acd4f6 --- /dev/null +++ b/docs/v3/setting-up-minimum-wordpress-installation/index.html @@ -0,0 +1,2186 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Setting up a minimum WordPress installation - wp-browser docs + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      + + +
                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + + + +

                                                                                                                                                                                                                                                                                                                                                                      Setting up a minimum WordPress installation

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      This is the documentation for version 3 of the project. +The current version is version 4 and the documentation can be found here.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Setting up a minimum WordPress installation

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      As mentioned in Installation section wp-browser will not download, configure and install WordPress for you.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      On a high level, once WordPress is installed and configured, whatever local development environment solution you've used, there are some information you'll need to gather before moving into wp-browser configuration.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      While there will be a section dedicated to different environments and setups I will outline below the example setup I will use, in the next section, to configure wp-browser:

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • WordPress is installed, on my machine, at /Users/luca/Sites/wordpress.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • I'm running MySQL server locally; I can connect to the MySQL server with the command mysql -u root -h 127.0.0.1 -P 3306; there is no password.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • I've created two databases, wordpress and tests, with the command: +
                                                                                                                                                                                                                                                                                                                                                                        mysql -u root -h 127.0.0.1 -P 3306 -e "create database if not exists wordpress; create database if not exists tests"
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • I've configured the /Users/luca/Sites/wordpress/wp-config.php file like below (redacted for brevity): +
                                                                                                                                                                                                                                                                                                                                                                        <?php
                                                                                                                                                                                                                                                                                                                                                                        +define( 'DB_NAME', 'wordpress' );
                                                                                                                                                                                                                                                                                                                                                                        +define( 'DB_USER', 'root' );
                                                                                                                                                                                                                                                                                                                                                                        +define( 'DB_PASSWORD', '' );
                                                                                                                                                                                                                                                                                                                                                                        +define( 'DB_HOST', '127.0.0.1' );
                                                                                                                                                                                                                                                                                                                                                                        +define( 'DB_CHARSET', 'utf8' );
                                                                                                                                                                                                                                                                                                                                                                        +define( 'DB_COLLATE', '' );
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                        +$table_prefix = 'wp_';
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                        +if ( ! defined( 'ABSPATH' ) )
                                                                                                                                                                                                                                                                                                                                                                        +    define( 'ABSPATH', dirname( __FILE__ ) . '/' );
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                        +require_once ABSPATH . 'wp-settings.php';
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • To serve the site I'm using PHP built-in server with the command: +
                                                                                                                                                                                                                                                                                                                                                                        (cd /Users/luca/Sites/wordpress; php -S localhost:8080)
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • I can access the WordPress homepage at http://localhost:8080 and the administration area at http://localhost:8080/wp-admin.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • I've installed WordPress via its UI (http://localhost:8080/wp-admin), the administrator username is admin, the administrator password is password.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • I'm testing a plugin and that plugin is in the folder, relative to the WordPress root folder, wp-content/plugins/acme-plugin.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      With all the steps above done I can now move into the actual wp-browser configuration phase.

                                                                                                                                                                                                                                                                                                                                                                      + + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + + + + + \ No newline at end of file diff --git a/docs/v3/tutorials/automatically-change-db-in-tests/index.html b/docs/v3/tutorials/automatically-change-db-in-tests/index.html new file mode 100644 index 000000000..4452daf1a --- /dev/null +++ b/docs/v3/tutorials/automatically-change-db-in-tests/index.html @@ -0,0 +1,2241 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Automatically change database during acceptance and functional tests - wp-browser docs + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      + + +
                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      This is the documentation for version 3 of the project. +The current version is version 4 and the documentation can be found here.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Automatically change database during acceptance and functional tests

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      You should always back up any site you run tests on if you care about the site content.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Now this disclaimer has been made ad nauseam; there's a simple way to use a different database when during tests.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Identifying requests

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      The first component of this solution is identifying the source of the current HTTP request.
                                                                                                                                                                                                                                                                                                                                                                      +WordPress makes this identification before deciding which database to use.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      To provide the WordPress installation with this information, you can set the headers entry of the WPBrowser or WPWebDriver module in the suite configuration file.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      As an example here is an acceptance suite configuration file setting two custom headers, X_WPBROWSER_REQUEST and X_TEST_REQUEST, on each request sent by the WPWebDriver module:

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      actor: AcceptanceTester
                                                                                                                                                                                                                                                                                                                                                                      +modules:
                                                                                                                                                                                                                                                                                                                                                                      +    enabled:
                                                                                                                                                                                                                                                                                                                                                                      +        - WPDb
                                                                                                                                                                                                                                                                                                                                                                      +        - WPBrowser
                                                                                                                                                                                                                                                                                                                                                                      +        - \Helper\Acceptance
                                                                                                                                                                                                                                                                                                                                                                      +    config:
                                                                                                                                                                                                                                                                                                                                                                      +        WPDb:
                                                                                                                                                                                                                                                                                                                                                                      +            dsn: 'mysql:host=localhost;dbname=tests'
                                                                                                                                                                                                                                                                                                                                                                      +            user: 'root'
                                                                                                                                                                                                                                                                                                                                                                      +            password: 'root'
                                                                                                                                                                                                                                                                                                                                                                      +            dump: 'tests/_data/dump.sql'
                                                                                                                                                                                                                                                                                                                                                                      +            populate: true
                                                                                                                                                                                                                                                                                                                                                                      +            cleanup: true
                                                                                                                                                                                                                                                                                                                                                                      +            waitlock: 10
                                                                                                                                                                                                                                                                                                                                                                      +            url: 'http://wp.test'
                                                                                                                                                                                                                                                                                                                                                                      +            urlReplacement: true
                                                                                                                                                                                                                                                                                                                                                                      +            tablePrefix: 'wp_'
                                                                                                                                                                                                                                                                                                                                                                      +        WPBrowser:
                                                                                                                                                                                                                                                                                                                                                                      +            url: 'http://wp.test'
                                                                                                                                                                                                                                                                                                                                                                      +            adminUsername: 'admin'
                                                                                                                                                                                                                                                                                                                                                                      +            adminPassword: 'admin'
                                                                                                                                                                                                                                                                                                                                                                      +            adminPath: '/wp-admin'
                                                                                                                                                                                                                                                                                                                                                                      +            headers:
                                                                                                                                                                                                                                                                                                                                                                      +                X_WPBROWSER_REQUEST: 1
                                                                                                                                                                                                                                                                                                                                                                      +                X_TEST_REQUEST: 1
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      The two headers are sent on each HTTP request type, not just on GET type requests.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Using a different database to handle test requests

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Now that each request made by the WPWebDriver module contains those two headers, it's time for WordPress to check those and change the database to use accordingly.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      The database to use is set by the DB_NAME constant that is, in turn, set in the wp-config.php file.
                                                                                                                                                                                                                                                                                                                                                                      +Different setups could involve more complex configurations for the wp-config.php file but, for the sake of simplicity, I assume the default WordPress wp-config.php file structure.
                                                                                                                                                                                                                                                                                                                                                                      +In the example below, the default database name is wordpress, while the name of the test database is tests.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      - define( 'DB_NAME', 'wordpress' );
                                                                                                                                                                                                                                                                                                                                                                      ++ if( isset( $_SERVER['HTTP_X_TEST_REQUEST'] ) && $_SERVER['HTTP_X_TEST_REQUEST'] ) {
                                                                                                                                                                                                                                                                                                                                                                      ++     define( 'DB_NAME', 'tests' );
                                                                                                                                                                                                                                                                                                                                                                      ++ } else {
                                                                                                                                                                                                                                                                                                                                                                      ++     define( 'DB_NAME', 'wordpress' );
                                                                                                                                                                                                                                                                                                                                                                      ++ }
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      The diff shows the replacement done in the WordPress installation wp-config.php file.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      For copy-and-paste pleasure, replace the line starting with:

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      define( 'DB_NAME', 'default_db_name' );
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      With this snippet:

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      if( isset( $_SERVER['HTTP_X_TEST_REQUEST'] ) && $_SERVER['HTTP_X_TEST_REQUEST'] ) {
                                                                                                                                                                                                                                                                                                                                                                      +      define( 'DB_NAME', 'test_db_name' );
                                                                                                                                                                                                                                                                                                                                                                      +} else {
                                                                                                                                                                                                                                                                                                                                                                      +      define( 'DB_NAME', 'default_db_name' );
                                                                                                                                                                                                                                                                                                                                                                      +}
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Where default_db_name is the name of the database your test WordPress installation normally uses.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Happy, and safer, testing.

                                                                                                                                                                                                                                                                                                                                                                      + + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + + + + + \ No newline at end of file diff --git a/docs/public/v3/tutorials/images/local-flywheel-adminer.png b/docs/v3/tutorials/images/local-flywheel-adminer.png similarity index 100% rename from docs/public/v3/tutorials/images/local-flywheel-adminer.png rename to docs/v3/tutorials/images/local-flywheel-adminer.png diff --git a/docs/public/v3/tutorials/images/local-flywheel-codecept-version.png b/docs/v3/tutorials/images/local-flywheel-codecept-version.png similarity index 100% rename from docs/public/v3/tutorials/images/local-flywheel-codecept-version.png rename to docs/v3/tutorials/images/local-flywheel-codecept-version.png diff --git a/docs/public/v3/tutorials/images/local-flywheel-composer-init.png b/docs/v3/tutorials/images/local-flywheel-composer-init.png similarity index 100% rename from docs/public/v3/tutorials/images/local-flywheel-composer-init.png rename to docs/v3/tutorials/images/local-flywheel-composer-init.png diff --git a/docs/public/v3/tutorials/images/local-flywheel-create-database.png b/docs/v3/tutorials/images/local-flywheel-create-database.png similarity index 100% rename from docs/public/v3/tutorials/images/local-flywheel-create-database.png rename to docs/v3/tutorials/images/local-flywheel-create-database.png diff --git a/docs/public/v3/tutorials/images/local-flywheel-db-export.png b/docs/v3/tutorials/images/local-flywheel-db-export.png similarity index 100% rename from docs/public/v3/tutorials/images/local-flywheel-db-export.png rename to docs/v3/tutorials/images/local-flywheel-db-export.png diff --git a/docs/public/v3/tutorials/images/local-flywheel-db-import.png b/docs/v3/tutorials/images/local-flywheel-db-import.png similarity index 100% rename from docs/public/v3/tutorials/images/local-flywheel-db-import.png rename to docs/v3/tutorials/images/local-flywheel-db-import.png diff --git a/docs/public/v3/tutorials/images/local-flywheel-mac-db-creds.png b/docs/v3/tutorials/images/local-flywheel-mac-db-creds.png similarity index 100% rename from docs/public/v3/tutorials/images/local-flywheel-mac-db-creds.png rename to docs/v3/tutorials/images/local-flywheel-mac-db-creds.png diff --git a/docs/public/v3/tutorials/images/local-flywheel-mac-wpbrowser-init-1.png b/docs/v3/tutorials/images/local-flywheel-mac-wpbrowser-init-1.png similarity index 100% rename from docs/public/v3/tutorials/images/local-flywheel-mac-wpbrowser-init-1.png rename to docs/v3/tutorials/images/local-flywheel-mac-wpbrowser-init-1.png diff --git a/docs/public/v3/tutorials/images/local-flywheel-mac-wpbrowser-init-2.png b/docs/v3/tutorials/images/local-flywheel-mac-wpbrowser-init-2.png similarity index 100% rename from docs/public/v3/tutorials/images/local-flywheel-mac-wpbrowser-init-2.png rename to docs/v3/tutorials/images/local-flywheel-mac-wpbrowser-init-2.png diff --git a/docs/public/v3/tutorials/images/local-flywheel-sites-path.png b/docs/v3/tutorials/images/local-flywheel-sites-path.png similarity index 100% rename from docs/public/v3/tutorials/images/local-flywheel-sites-path.png rename to docs/v3/tutorials/images/local-flywheel-sites-path.png diff --git a/docs/public/v3/tutorials/images/local-flywheel-win-db-creds.png b/docs/v3/tutorials/images/local-flywheel-win-db-creds.png similarity index 100% rename from docs/public/v3/tutorials/images/local-flywheel-win-db-creds.png rename to docs/v3/tutorials/images/local-flywheel-win-db-creds.png diff --git a/docs/public/v3/tutorials/images/local-flywheel-win-wpbrowser-init-1.png b/docs/v3/tutorials/images/local-flywheel-win-wpbrowser-init-1.png similarity index 100% rename from docs/public/v3/tutorials/images/local-flywheel-win-wpbrowser-init-1.png rename to docs/v3/tutorials/images/local-flywheel-win-wpbrowser-init-1.png diff --git a/docs/public/v3/tutorials/images/local-flywheel-win-wpbrowser-init-2.png b/docs/v3/tutorials/images/local-flywheel-win-wpbrowser-init-2.png similarity index 100% rename from docs/public/v3/tutorials/images/local-flywheel-win-wpbrowser-init-2.png rename to docs/v3/tutorials/images/local-flywheel-win-wpbrowser-init-2.png diff --git a/docs/public/v3/tutorials/images/local-lite-mac-db-creds.png b/docs/v3/tutorials/images/local-lite-mac-db-creds.png similarity index 100% rename from docs/public/v3/tutorials/images/local-lite-mac-db-creds.png rename to docs/v3/tutorials/images/local-lite-mac-db-creds.png diff --git a/docs/public/v3/tutorials/images/local-my-plugin-shows.png b/docs/v3/tutorials/images/local-my-plugin-shows.png similarity index 100% rename from docs/public/v3/tutorials/images/local-my-plugin-shows.png rename to docs/v3/tutorials/images/local-my-plugin-shows.png diff --git a/docs/public/v3/tutorials/images/mac-codecept-version.png b/docs/v3/tutorials/images/mac-codecept-version.png similarity index 100% rename from docs/public/v3/tutorials/images/mac-codecept-version.png rename to docs/v3/tutorials/images/mac-codecept-version.png diff --git a/docs/public/v3/tutorials/images/mac-composer-init.png b/docs/v3/tutorials/images/mac-composer-init.png similarity index 100% rename from docs/public/v3/tutorials/images/mac-composer-init.png rename to docs/v3/tutorials/images/mac-composer-init.png diff --git a/docs/public/v3/tutorials/images/mamp-create-db.png b/docs/v3/tutorials/images/mamp-create-db.png similarity index 100% rename from docs/public/v3/tutorials/images/mamp-create-db.png rename to docs/v3/tutorials/images/mamp-create-db.png diff --git a/docs/public/v3/tutorials/images/mamp-db-export.png b/docs/v3/tutorials/images/mamp-db-export.png similarity index 100% rename from docs/public/v3/tutorials/images/mamp-db-export.png rename to docs/v3/tutorials/images/mamp-db-export.png diff --git a/docs/public/v3/tutorials/images/mamp-db-import.png b/docs/v3/tutorials/images/mamp-db-import.png similarity index 100% rename from docs/public/v3/tutorials/images/mamp-db-import.png rename to docs/v3/tutorials/images/mamp-db-import.png diff --git a/docs/public/v3/tutorials/images/mamp-mac-dirs.png b/docs/v3/tutorials/images/mamp-mac-dirs.png similarity index 100% rename from docs/public/v3/tutorials/images/mamp-mac-dirs.png rename to docs/v3/tutorials/images/mamp-mac-dirs.png diff --git a/docs/public/v3/tutorials/images/mamp-mac-ports.png b/docs/v3/tutorials/images/mamp-mac-ports.png similarity index 100% rename from docs/public/v3/tutorials/images/mamp-mac-ports.png rename to docs/v3/tutorials/images/mamp-mac-ports.png diff --git a/docs/public/v3/tutorials/images/mamp-my-plugin-shows.png b/docs/v3/tutorials/images/mamp-my-plugin-shows.png similarity index 100% rename from docs/public/v3/tutorials/images/mamp-my-plugin-shows.png rename to docs/v3/tutorials/images/mamp-my-plugin-shows.png diff --git a/docs/public/v3/tutorials/images/mamp-wp-installation-1.png b/docs/v3/tutorials/images/mamp-wp-installation-1.png similarity index 100% rename from docs/public/v3/tutorials/images/mamp-wp-installation-1.png rename to docs/v3/tutorials/images/mamp-wp-installation-1.png diff --git a/docs/public/v3/tutorials/images/mamp-wpbrowser-init-1.png b/docs/v3/tutorials/images/mamp-wpbrowser-init-1.png similarity index 100% rename from docs/public/v3/tutorials/images/mamp-wpbrowser-init-1.png rename to docs/v3/tutorials/images/mamp-wpbrowser-init-1.png diff --git a/docs/public/v3/tutorials/images/mamp-wpbrowser-init-2.png b/docs/v3/tutorials/images/mamp-wpbrowser-init-2.png similarity index 100% rename from docs/public/v3/tutorials/images/mamp-wpbrowser-init-2.png rename to docs/v3/tutorials/images/mamp-wpbrowser-init-2.png diff --git a/docs/public/v3/tutorials/images/vvv-codecept-version.png b/docs/v3/tutorials/images/vvv-codecept-version.png similarity index 100% rename from docs/public/v3/tutorials/images/vvv-codecept-version.png rename to docs/v3/tutorials/images/vvv-codecept-version.png diff --git a/docs/public/v3/tutorials/images/vvv-my-plugin-composer-init.png b/docs/v3/tutorials/images/vvv-my-plugin-composer-init.png similarity index 100% rename from docs/public/v3/tutorials/images/vvv-my-plugin-composer-init.png rename to docs/v3/tutorials/images/vvv-my-plugin-composer-init.png diff --git a/docs/src/v3/tutorials/images/vvv-my-plugin-shows.png b/docs/v3/tutorials/images/vvv-my-plugin-shows.png similarity index 100% rename from docs/src/v3/tutorials/images/vvv-my-plugin-shows.png rename to docs/v3/tutorials/images/vvv-my-plugin-shows.png diff --git a/docs/public/v3/tutorials/images/vvv-ssh.png b/docs/v3/tutorials/images/vvv-ssh.png similarity index 100% rename from docs/public/v3/tutorials/images/vvv-ssh.png rename to docs/v3/tutorials/images/vvv-ssh.png diff --git a/docs/public/v3/tutorials/images/vvv-up.png b/docs/v3/tutorials/images/vvv-up.png similarity index 100% rename from docs/public/v3/tutorials/images/vvv-up.png rename to docs/v3/tutorials/images/vvv-up.png diff --git a/docs/public/v3/tutorials/images/vvv-wp-browser-init-1.png b/docs/v3/tutorials/images/vvv-wp-browser-init-1.png similarity index 100% rename from docs/public/v3/tutorials/images/vvv-wp-browser-init-1.png rename to docs/v3/tutorials/images/vvv-wp-browser-init-1.png diff --git a/docs/public/v3/tutorials/images/vvv-wp-browser-init-2.png b/docs/v3/tutorials/images/vvv-wp-browser-init-2.png similarity index 100% rename from docs/public/v3/tutorials/images/vvv-wp-browser-init-2.png rename to docs/v3/tutorials/images/vvv-wp-browser-init-2.png diff --git a/docs/public/v3/tutorials/images/vvv-wp-db-backup.png b/docs/v3/tutorials/images/vvv-wp-db-backup.png similarity index 100% rename from docs/public/v3/tutorials/images/vvv-wp-db-backup.png rename to docs/v3/tutorials/images/vvv-wp-db-backup.png diff --git a/docs/public/v3/tutorials/images/wamp-codecept-version.png b/docs/v3/tutorials/images/wamp-codecept-version.png similarity index 100% rename from docs/public/v3/tutorials/images/wamp-codecept-version.png rename to docs/v3/tutorials/images/wamp-codecept-version.png diff --git a/docs/public/v3/tutorials/images/wamp-composer-init.png b/docs/v3/tutorials/images/wamp-composer-init.png similarity index 100% rename from docs/public/v3/tutorials/images/wamp-composer-init.png rename to docs/v3/tutorials/images/wamp-composer-init.png diff --git a/docs/public/v3/tutorials/images/wamp-create-db.png b/docs/v3/tutorials/images/wamp-create-db.png similarity index 100% rename from docs/public/v3/tutorials/images/wamp-create-db.png rename to docs/v3/tutorials/images/wamp-create-db.png diff --git a/docs/public/v3/tutorials/images/wamp-db-export.png b/docs/v3/tutorials/images/wamp-db-export.png similarity index 100% rename from docs/public/v3/tutorials/images/wamp-db-export.png rename to docs/v3/tutorials/images/wamp-db-export.png diff --git a/docs/public/v3/tutorials/images/wamp-db-import.png b/docs/v3/tutorials/images/wamp-db-import.png similarity index 100% rename from docs/public/v3/tutorials/images/wamp-db-import.png rename to docs/v3/tutorials/images/wamp-db-import.png diff --git a/docs/public/v3/tutorials/images/wamp-my-plugin-shows.png b/docs/v3/tutorials/images/wamp-my-plugin-shows.png similarity index 100% rename from docs/public/v3/tutorials/images/wamp-my-plugin-shows.png rename to docs/v3/tutorials/images/wamp-my-plugin-shows.png diff --git a/docs/public/v3/tutorials/images/wamp-virtualhost-creation-1.png b/docs/v3/tutorials/images/wamp-virtualhost-creation-1.png similarity index 100% rename from docs/public/v3/tutorials/images/wamp-virtualhost-creation-1.png rename to docs/v3/tutorials/images/wamp-virtualhost-creation-1.png diff --git a/docs/public/v3/tutorials/images/wamp-virtualhost-creation-2.png b/docs/v3/tutorials/images/wamp-virtualhost-creation-2.png similarity index 100% rename from docs/public/v3/tutorials/images/wamp-virtualhost-creation-2.png rename to docs/v3/tutorials/images/wamp-virtualhost-creation-2.png diff --git a/docs/public/v3/tutorials/images/wamp-wp-installation-1.png b/docs/v3/tutorials/images/wamp-wp-installation-1.png similarity index 100% rename from docs/public/v3/tutorials/images/wamp-wp-installation-1.png rename to docs/v3/tutorials/images/wamp-wp-installation-1.png diff --git a/docs/public/v3/tutorials/images/wamp-wpbrowser-init-1.png b/docs/v3/tutorials/images/wamp-wpbrowser-init-1.png similarity index 100% rename from docs/public/v3/tutorials/images/wamp-wpbrowser-init-1.png rename to docs/v3/tutorials/images/wamp-wpbrowser-init-1.png diff --git a/docs/public/v3/tutorials/images/wamp-wpbrowser-init-2.png b/docs/v3/tutorials/images/wamp-wpbrowser-init-2.png similarity index 100% rename from docs/public/v3/tutorials/images/wamp-wpbrowser-init-2.png rename to docs/v3/tutorials/images/wamp-wpbrowser-init-2.png diff --git a/docs/public/v3/tutorials/images/wp-installation-2.png b/docs/v3/tutorials/images/wp-installation-2.png similarity index 100% rename from docs/public/v3/tutorials/images/wp-installation-2.png rename to docs/v3/tutorials/images/wp-installation-2.png diff --git a/docs/v3/tutorials/local-flywheel-setup/index.html b/docs/v3/tutorials/local-flywheel-setup/index.html new file mode 100644 index 000000000..e525f795c --- /dev/null +++ b/docs/v3/tutorials/local-flywheel-setup/index.html @@ -0,0 +1,2644 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Setting up wp-browser on Local by Flywheel to test a plugin - wp-browser docs + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      + + +
                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + + + +

                                                                                                                                                                                                                                                                                                                                                                      Setting up wp-browser on Local by Flywheel to test a plugin

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      This is the documentation for version 3 of the project. +The current version is version 4 and the documentation can be found here.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Setting up wp-browser with Local by Flywheel to test a plugin

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Note: the original version of this guide used, on Mac, the version of Local by Flywheel based on VirtualBox and Docker containers. That version has been replaced by a new one that will not use any virtualization layer. The UI is almost the same but, for back-compatibility purposes, I've not removed the references to the previous version; I have, instead, pointed out where the set up values and procedures might differ due to the changes.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Requirements

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • A Mac or Windows machine
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • A working installation of Local By Flywheel.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • You should be able to create sites and visit them from your browser without issues.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • Composer installed and working on your terminal PATH, you should be able to run composer --version at the terminal and see the version correctly.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Install Local by Flywheel

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      This walk-through starts after Local by Flywheel has been installed and is correctly running on your machine; you can download Local from the site and follow the installation instructions.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      In the context of this guide I'm assuming the sites directory is ~/Local Sites, the default "Sites Path" in Local preferences.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      If your document root lies elsewhere, replace the ~/Local Sites path with the actual directory in each command.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Creating the databases and installing WordPress

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Using Local UI create a new site:

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • The site name is myplugin.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • The site administrator user name is admin.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • The site administrator password is password.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Once Local provisioned and installed the new site, open the "Database" administration tab and, depending on your OS, start a database administration UI or website. +In the image below I'm using Adminer:

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Create a database called tests:

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Make sure you can visit the WordPress installation at http://myplugin.local and that you can correctly access the administration area at http://myplugin.local/wp-admin.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Scaffolding the project folder

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      I'm assuming the scope of the development is to test the my-plugin plugin.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      The first step is to create the bare minimum code required to make the plugin show up among the available WordPress plugins.
                                                                                                                                                                                                                                                                                                                                                                      +Create the main plugin file in the WordPress installation plugins directory, in the ~/Local Sites/myplugin/app/public/wp-content/plugins/my-plugin/my-plugin.php file:

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      <?php
                                                                                                                                                                                                                                                                                                                                                                      +/**
                                                                                                                                                                                                                                                                                                                                                                      + * Plugin Name: My plugin
                                                                                                                                                                                                                                                                                                                                                                      + */ 
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      The plugin should now show up, activate and deactivate correctly, among the plugins listed in the WordPress installation at http://myplugin.local/wp-admin/plugins.php.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Installing wp-browser

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Open a terminal window and navigate to the plugin directory and initialize the Composer project:

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      cd ~/Local Sites/myplugin/app/public/wp-content/plugins/my-plugin
                                                                                                                                                                                                                                                                                                                                                                      +composer init
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Composer will ask some questions to initialize the project, for the sake of this small guide the answers are not relevant. +Here is the composer.json file generated by the above answers:

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      {
                                                                                                                                                                                                                                                                                                                                                                      +    "name": "local/my-plugin",
                                                                                                                                                                                                                                                                                                                                                                      +    "type": "wordpress-plugin",
                                                                                                                                                                                                                                                                                                                                                                      +    "require": {}
                                                                                                                                                                                                                                                                                                                                                                      +}
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Next require lucatume/wp-browser as a development dependency:

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      composer require --dev lucatume/wp-browser
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Composer installs any dependency binary file, an executable file, in the project vendor/bin folder.
                                                                                                                                                                                                                                                                                                                                                                      +To check Codeception is correctly installed run this command:

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      vendor/bin/codecept --version
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Since wp-browser requires Codeception, there is no need to require Codeception explicitly as a development dependency.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Setting up wp-browser

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      For those that might get lost while trying to set up wp-browser for the first time the VVV context provides an excellent base to understand the process.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      wp-browser needs to know:

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • Where the WordPress installation files are located: they will be loaded in integration and "WordPress unit" tests.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • How to connect to the WordPress site "normal" database: this is the database that stores the data of the site I would see when visiting the local installation URL at http://myplugin.local.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • How to connect to the database dedicated to the integration and "WordPress unit" tests: this database will be used to install WordPress during integration and "WordPress unit" tests.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Any test suite using a database should never run on a database containing data of any value; this means that your first step should be to backup the site database.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      You can create a backup of the current site database contents using whatever tool the version of Local you're using provides.
                                                                                                                                                                                                                                                                                                                                                                      +In this example I'm using Adminer:

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      At any moment you can re-import the site database dump using, again, phpMyAdmin, under the "Import" tab:

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Bootstrapping and configuring wp-browser

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      After the backup is done it's time to bootstrap wp-browser using its interactive mode:

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      cd ~/Local Sites/myplugin/app/public/wp-content/plugins/my-plugin
                                                                                                                                                                                                                                                                                                                                                                      +vendor/bin/codecept init wpbrowser
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      The initialization guide will ask a number of questions.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Windows configuration

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      In the screenshots below are the answers I used to configure wp-browser on Windows.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Note that I've set up the database host using the values provided by Local UI, yours might differ depending on the version of Local you're using:

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Below a complete list of each answer:

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • I acknowledge wp-browser should run on development servers... y
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • Would you like to set up the suites interactively now? y
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • How would you like the acceptance suite to be called? acceptance
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • How would you like the functional suite to be called? functional
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • How would you like the WordPress unit and integration suite to be called? wpunit
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • How would you like to call the env configuration file? .env.testing
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • What is the path of the WordPress root directory? ~/Local Sites/myplugin/app/public
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • What is the path, relative to WordPress root URL, of the admin area of the test site? /wp-admin
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • What is the name of the test database used by the test site? tests
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • What is the host of the test database used by the test site? localhost:10003
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • What is the user of the test database used by the test site? root
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • What is the password of the test database used by the test site? root
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • What is the table prefix of the test database used by the test site? wp_
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • What is the name of the test database WPLoader should use? tests
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • What is the host of the test database WPLoader should use? localhost:10003
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • What is the user of the test database WPLoader should use? root
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • What is the password of the test database WPLoader should use? root
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • What is the table prefix of the test database WPLoader should use? wp_
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • What is the URL the test site? http://myplugin.local
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • What is the email of the test site WordPress administrator? admin@myplugin.local
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • What is the title of the test site? My Plugin Test
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • What is the login of the administrator user of the test site? admin
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • What is the password of the administrator user of the test site? password
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • Are you testing a plugin, a theme or a combination of both (both)? plugin
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • What is the folder/plugin.php name of the plugin? my-plugin/my-plugin.php
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • Does your project needs additional plugins to be activated to work? no
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Codeception will build the suites for the first time and should be ready to go.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Mac configuration

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      In the screenshots below are the answers I used to configure wp-browser on Mac.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Note that I've set up the database host using the values provided by Local UI, yours might differ.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      This screenshot is from the previous version of Local, the one based on VirtualBox and Docker:

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Below a complete list of each answer:

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • I acknowledge wp-browser should run on development servers... y
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • Would you like to set up the suites interactively now? y
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • How would you like the acceptance suite to be called? acceptance
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • How would you like the functional suite to be called? functional
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • How would you like the WordPress unit and integration suite to be called? wpunit
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • How would you like to call the env configuration file? .env.testing
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • What is the path of the WordPress root directory? ~/Local Sites/myplugin/app/public
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • What is the path, relative to WordPress root URL, of the admin area of the test site? /wp-admin
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • What is the name of the test database used by the test site? tests
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • What is the host of the test database used by the test site? /Users/lucatume/Library/Application Support/Local/run/FjKWfVMGd/mysql/mysqld.sock ( or 192.168.95.100:4055 on an older version of Local)
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • What is the user of the test database used by the test site? root
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • What is the password of the test database used by the test site? root
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • What is the table prefix of the test database used by the test site? wp_
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • What is the name of the test database WPLoader should use? tests
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • What is the host of the test database WPLoader should use? /Users/lucatume/Library/Application Support/Local/run/FjKWfVMGd/mysql/mysqld.sock (or 192.168.95.100:4055 on an older version of Local)
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • What is the user of the test database WPLoader should use? root
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • What is the password of the test database WPLoader should use? root
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • What is the table prefix of the test database WPLoader should use? wp_
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • What is the URL the test site? http://myplugin.local
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • What is the email of the test site WordPress administrator? admin@myplugin.local
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • What is the title of the test site? My Plugin Test
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • What is the login of the administrator user of the test site? admin
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • What is the password of the administrator user of the test site? password
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • Are you testing a plugin, a theme or a combination of both (both)? plugin
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • What is the folder/plugin.php name of the plugin? my-plugin/my-plugin.php
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • Does your project needs additional plugins to be activated to work? no
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Codeception will build the suites for the first time and should be ready to go.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Setting up the starting database fixture

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      A "fixture", in testing terms, is a minimal, starting environment shared by all tests.
                                                                                                                                                                                                                                                                                                                                                                      +In BDD it's the Background any scenario will share. +In the case of a plugin the minimal, starting environment is the following:

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • A fresh WordPress installation empty of any content.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • WordPress using its default theme.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • The only active plugin is the one you're testing, in this example: my-plugin.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      You should set up this fixture "manually", using the site administration UI at http://myplugin.local/wp-admin.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      The following command will empty the site, backup any content you care about first!

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      When you're done setting up the initial database fixture, export it using the "Export" tab of your database tool of choice, and move the file to the ~/Local Sites/myplugin/app/public/wp-content/plugins/my-plugin/tests/_data/dump.sql directory.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      There is one last step left to complete the setup.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Using the tests database in acceptance and functional tests

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Acceptance and functional tests will act as users, navigating to the site pages and making requests as a user would.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      This means that WordPress will load, and with it its wp-config.php file, to handle the requests made by the tests.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      During the setup phase I've specified the database to be used for acceptance and functional tests as tests but, looking at the contents of the ~/Local Sites/myplugin/app/public/wp-config.php file, the DB_NAME constant is set to local.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      What we'll do now means:

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • If the request is a normal one, use the local database.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • If the request comes from a test, use the tests database.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      In your IDE/text-editor of choice edit the ~/Local Sites/myplugin/app/public/wp-config.php and replace the line defining the DB_NAME constant like this:

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      - define( 'DB_NAME', 'local' );
                                                                                                                                                                                                                                                                                                                                                                      ++ if( isset( $_SERVER['HTTP_X_WPBROWSER_REQUEST'] ) && $_SERVER['HTTP_X_WPBROWSER_REQUEST'] ) { 
                                                                                                                                                                                                                                                                                                                                                                      ++    define( 'DB_NAME', 'tests' );
                                                                                                                                                                                                                                                                                                                                                                      ++ } else {
                                                                                                                                                                                                                                                                                                                                                                      ++    define( 'DB_NAME', 'local' );
                                                                                                                                                                                                                                                                                                                                                                      ++ }
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Here's the copy-and-paste friendly version:

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      if( isset( $_SERVER['HTTP_X_TEST_REQUEST'] ) && $_SERVER['HTTP_X_TEST_REQUEST'] ) {
                                                                                                                                                                                                                                                                                                                                                                      +        define( 'DB_NAME', 'tests' );
                                                                                                                                                                                                                                                                                                                                                                      +} else {
                                                                                                                                                                                                                                                                                                                                                                      +        define( 'DB_NAME', 'local' );
                                                                                                                                                                                                                                                                                                                                                                      +}
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      If you look at the tests/acceptance.suite.yml and tests/functional.suite.yml files, respectively the acceptance and functional suite configuration files, you will see these entries in the WPBrowser module configuration:

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      headers:
                                                                                                                                                                                                                                                                                                                                                                      +    X_TEST_REQUEST: 1
                                                                                                                                                                                                                                                                                                                                                                      +    X_WPBROWSER_REQUEST: 1
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      This means that, with each HTTP request done during tests, the module will send the two headers.
                                                                                                                                                                                                                                                                                                                                                                      +Those headers are read, on the WordPress side, using the $_SERVER['HTTP_X_TEST_REQUEST'] and $_SERVER['X_WPBROWSER_REQUEST'] variables.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Codeception and wp-browser are ready to run and the test-drive development can start.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Sanity check

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Before starting to write tests, take a moment to run each suite separately and make sure all is set up correctly.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      If you run into issues, there's a chance you forgot something along the way, please take the time to read this tutorial a second time before opening an issue.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      You have created 4 suites, each suite has at least one example test to make sure all works.
                                                                                                                                                                                                                                                                                                                                                                      +Run each suite and make sure all tests succeed, from within the box run:

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      cd ~/Local Sites/myplugin/app/public/wp-content/plugins/my-plugin 
                                                                                                                                                                                                                                                                                                                                                                      +vendor/bin/codecept run acceptance
                                                                                                                                                                                                                                                                                                                                                                      +vendor/bin/codecept run functional
                                                                                                                                                                                                                                                                                                                                                                      +vendor/bin/codecept run wpunit
                                                                                                                                                                                                                                                                                                                                                                      +vendor/bin/codecept run unit
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      You're now run to customize the suites to your liking or start writing tests, run vendor/bin/codecept to see a list of the available commands.

                                                                                                                                                                                                                                                                                                                                                                      + + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + + + + + \ No newline at end of file diff --git a/docs/v3/tutorials/mamp-mac-setup/index.html b/docs/v3/tutorials/mamp-mac-setup/index.html new file mode 100644 index 000000000..8e716e649 --- /dev/null +++ b/docs/v3/tutorials/mamp-mac-setup/index.html @@ -0,0 +1,2554 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Setting up wp-browser on MAMP for Mac to test a plugin - wp-browser docs + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      + + +
                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + + + +

                                                                                                                                                                                                                                                                                                                                                                      Setting up wp-browser on MAMP for Mac to test a plugin

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      This is the documentation for version 3 of the project. +The current version is version 4 and the documentation can be found here.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Setting up wp-browser with MAMP on Mac to test a plugin

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Requirements

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • A Mac machine
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • A working installation of MAMP.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • You should be able to create sites and visit them from your browser without issues.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • Composer installed and working on your terminal PATH, you should be able to run composer --version at the terminal and see the version correctly.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      The version of MAMP used in this tutorial is the free, non PRO, one. MAMP PRO provides more features, but the setup instructions should remain valid.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Install and configure MAMP

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      This walk-through starts after MAMP has been installed and is correctly running on the host machine; you can download MAMP from the site and follow the installation instructions.
                                                                                                                                                                                                                                                                                                                                                                      +In the context of this guide I'm assuming the "Document Root" directory is the default one, in the /Applications/MAMP/htdocs directory.
                                                                                                                                                                                                                                                                                                                                                                      +If your document root lies elsewhere, replace the /Applications/MAMP/htdocs path with the actual directory in each command.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Creating the databases and installing WordPress

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Go to the http://localhost/phpMyAdmin/ page and create two new databases:

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • wordpress is the database you will use for WordPress
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • tests is the database you will use for the tests
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Unzip the the WordPress files into the /Applications/MAMP/htdocs and head over to http://localhost to install WordPress.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      The database credentials for the installation are:

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • Database name: wordpress
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • Database user: root
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • Database password: root
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • Database host: localhost
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Use admin as administrator user name and password as password for the administrator user.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Make sure you can visit the WordPress installation at http://localhost and that you can correctly access the administration area at http://localhost/wp-admin.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Scaffolding the project folder

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      I'm assuming the scope of the development is to test the my-plugin plugin.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      The first step is to create the bare minimum code required to make the plugin show up among the available WordPress plugins.
                                                                                                                                                                                                                                                                                                                                                                      +Create the main plugin file in the WordPress installation plugins directory, in the /Applications/MAMP/htdocs/wp-content/plugins/my-plugin/my-plugin.php file:

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      <?php
                                                                                                                                                                                                                                                                                                                                                                      +/**
                                                                                                                                                                                                                                                                                                                                                                      + * Plugin Name: My plugin
                                                                                                                                                                                                                                                                                                                                                                      + */ 
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      The plugin should now show up, activate and deactivate correctly, among the plugins listed in the WordPress installation at http://localhost/wp-admin/plugins.php.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Installing wp-browser

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Open a terminal window and navigate to the plugin directory and initialize the Composer project:

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      cd /Applications/MAMP/htdocs/wp-content/plugins/my-plugin
                                                                                                                                                                                                                                                                                                                                                                      +composer init
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Composer will ask some questions to initialize the project, for the sake of this small guide the answers are not relevant. +Here is the composer.json file generated by the above answers:

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      {
                                                                                                                                                                                                                                                                                                                                                                      +    "name": "mamp/my-plugin",
                                                                                                                                                                                                                                                                                                                                                                      +    "type": "wordpress-plugin",
                                                                                                                                                                                                                                                                                                                                                                      +    "require": {}
                                                                                                                                                                                                                                                                                                                                                                      +}
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Next require lucatume/wp-browser as a development dependency:

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      composer require --dev lucatume/wp-browser
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Composer installs any dependency binary file, an executable file, in the project vendor/bin folder.
                                                                                                                                                                                                                                                                                                                                                                      +To check Codeception is correctly installed run this command:

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      vendor/bin/codecept --version
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Since wp-browser requires Codeception, there is no need to require Codeception explicitly as a development dependency.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Setting up wp-browser

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      For those that might get lost while trying to set up wp-browser for the first time the VVV context provides an excellent base to understand the process.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      wp-browser needs to know:

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • Where the WordPress installation files are located: they will be loaded in integration and "WordPress unit" tests.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • How to connect to the WordPress site "normal" database: this is the database that stores the data of the site I would see when visiting the local installation URL at http://localhost.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • How to connect to the database dedicated to the integration and "WordPress unit" tests: this database will be used to install WordPress during integration and "WordPress unit" tests.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Any test suite using a database should never run on a database containing data of any value; this means that your first step should be to backup the site database.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      You can create a backup of the current site database contents using phpMyAdmin, at http://localhost/phpMyAdmin/, under the "Export" tab:

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      At any moment you can re-import the site database dump using, again, phpMyAdmin, under the "Import" tab:

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Bootstrapping and configuring wp-browser

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      After the backup is done it's time to bootstrap wp-browser using its interactive mode:

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      cd /Applications/MAMP/htdocs/wp-content/plugins/my-plugin
                                                                                                                                                                                                                                                                                                                                                                      +vendor/bin/codecept init wpbrowser
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      The initialization guide will ask a number of questions.
                                                                                                                                                                                                                                                                                                                                                                      +In the screenshots below are the answers I used to configure wp-browser.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Below a complete list of each answer:

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • I acknowledge wp-browser should run on development servers... y
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • Would you like to set up the suites interactively now? y
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • How would you like the acceptance suite to be called? acceptance
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • How would you like the functional suite to be called? functional
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • How would you like the WordPress unit and integration suite to be called? wpunit
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • How would you like to call the env configuration file? .env.testing
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • What is the path of the WordPress root directory? /Applications/MAMP/htdocs
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • What is the path, relative to WordPress root URL, of the admin area of the test site? /wp-admin
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • What is the name of the test database used by the test site? tests
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • What is the host of the test database used by the test site? localhost
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • What is the user of the test database used by the test site? root
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • What is the password of the test database used by the test site? root
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • What is the table prefix of the test database used by the test site? wp_
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • What is the name of the test database WPLoader should use? tests
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • What is the host of the test database WPLoader should use? localhost
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • What is the user of the test database WPLoader should use? root
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • What is the password of the test database WPLoader should use? root
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • What is the table prefix of the test database WPLoader should use? wp_
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • What is the URL the test site? http://localhost
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • What is the email of the test site WordPress administrator? admin@wp.test
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • What is the title of the test site? My Plugin Test
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • What is the login of the administrator user of the test site? admin
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • What is the password of the administrator user of the test site? password
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • Are you testing a plugin, a theme or a combination of both (both)? plugin
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • What is the folder/plugin.php name of the plugin? my-plugin/my-plugin.php
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • Does your project needs additional plugins to be activated to work? no
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Codeception will build the suites for the first time and should be ready to go.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Setting up the starting database fixture

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      A "fixture", in testing terms, is a minimal, starting environment shared by all tests.
                                                                                                                                                                                                                                                                                                                                                                      +In BDD it's the Background any scenario will share. +In the case of a plugin the minimal, starting environment is the following:

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • A fresh WordPress installation empty of any content.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • WordPress using its default theme.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • The only active plugin is the one you're testing, in this example: my-plugin.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      You should set up this fixture "manually", using the site administration UI at http://localhost/wp-admin.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      The following command will empty the site, backup any content you care about first!

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      When you're done setting up the initial database fixture, export it using the "Export" tab of phpMyAdmin, at http://localhost/phpMyAdmin/ and move the file to the /Applications/MAMP/htdocs/wp-content/plugins/my-plugin/tests/_data/dump.sql directory.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      There is one last step left to complete the setup.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Using the tests database in acceptance and functional tests

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Acceptance and functional tests will act as users, navigating to the site pages and making requests as a user would.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      This means that WordPress will load, and with it its wp-config.php file, to handle the requests made by the tests.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      During the setup phase I've specified the database to be used for acceptance and functional tests as tests but, looking at the contents of the /Applications/MAMP/htdocs/wp-config.php file, the DB_NAME constant is set to wordpress.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      What we'll do now means:

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • If the request is a normal one, use the wordpress database.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • If the request comes from a test, use the tests database.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      In your IDE/text-editor of choice edit the /Applications/MAMP/htdocs/wp-config.php and replace the line defining the DB_NAME constant like this:

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      - define( 'DB_NAME', 'wordpress' );
                                                                                                                                                                                                                                                                                                                                                                      ++ if( isset( $_SERVER['HTTP_X_WPBROWSER_REQUEST'] ) && $_SERVER['HTTP_X_WPBROWSER_REQUEST'] ) { 
                                                                                                                                                                                                                                                                                                                                                                      ++    define( 'DB_NAME', 'tests' );
                                                                                                                                                                                                                                                                                                                                                                      ++ } else {
                                                                                                                                                                                                                                                                                                                                                                      ++    define( 'DB_NAME', 'wordpress' );
                                                                                                                                                                                                                                                                                                                                                                      ++ }
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Here's the copy-and-paste friendly version:

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      if( isset( $_SERVER['HTTP_X_TEST_REQUEST'] ) && $_SERVER['HTTP_X_TEST_REQUEST'] ) {
                                                                                                                                                                                                                                                                                                                                                                      +        define( 'DB_NAME', 'tests' );
                                                                                                                                                                                                                                                                                                                                                                      +} else {
                                                                                                                                                                                                                                                                                                                                                                      +        define( 'DB_NAME', 'wordpress' );
                                                                                                                                                                                                                                                                                                                                                                      +}
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      If you look at the tests/acceptance.suite.yml and tests/functional.suite.yml files, respectively the acceptance and functional suite configuration files, you will see these entries in the WPBrowser module configuration:

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      headers:
                                                                                                                                                                                                                                                                                                                                                                      +    X_TEST_REQUEST: 1
                                                                                                                                                                                                                                                                                                                                                                      +    X_WPBROWSER_REQUEST: 1
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      This means that, with each HTTP request done during tests, the module will send the two headers.
                                                                                                                                                                                                                                                                                                                                                                      +Those headers are read, on the WordPress side, using the $_SERVER['HTTP_X_TEST_REQUEST'] and $_SERVER['X_WPBROWSER_REQUEST'] variables.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Codeception and wp-browser are ready to run and the test-drive development can start.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Sanity check

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Before starting to write tests, take a moment to run each suite separately and make sure all is set up correctly.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      If you run into issues, there's a chance you forgot something along the way, please take the time to read this tutorial a second time before opening an issue.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      You have created 4 suites, each suite has at least one example test to make sure all works.
                                                                                                                                                                                                                                                                                                                                                                      +Run each suite and make sure all tests succeed, from within the box run:

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      cd /Applications/MAMP/htdocs/wp-content/plugins/my-plugin 
                                                                                                                                                                                                                                                                                                                                                                      +vendor/bin/codecept run acceptance
                                                                                                                                                                                                                                                                                                                                                                      +vendor/bin/codecept run functional
                                                                                                                                                                                                                                                                                                                                                                      +vendor/bin/codecept run wpunit
                                                                                                                                                                                                                                                                                                                                                                      +vendor/bin/codecept run unit
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      You're now run to customize the suites to your liking or start writing tests, run vendor/bin/codecept to see a list of the available commands.

                                                                                                                                                                                                                                                                                                                                                                      + + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + + + + + \ No newline at end of file diff --git a/docs/v3/tutorials/vvv-setup/index.html b/docs/v3/tutorials/vvv-setup/index.html new file mode 100644 index 000000000..aa84e437b --- /dev/null +++ b/docs/v3/tutorials/vvv-setup/index.html @@ -0,0 +1,2642 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Setting up wp-browser on VVV to test a plugin - wp-browser docs + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      + + +
                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + + + +

                                                                                                                                                                                                                                                                                                                                                                      Setting up wp-browser on VVV to test a plugin

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      This is the documentation for version 3 of the project. +The current version is version 4 and the documentation can be found here.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Setting up wp-browser on VVV to test a plugin

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Requirements

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • A Windows, Linux or Mac machine (I'll call this the "host machine" or just "host").
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • A working installation of VVV; you should be able to navigate to VVV root directory, run the vagrant up command, and have VVV up and running.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • On the VVV installation you should be able to visit the two default sites URLs without issues; the two default sites addresses are:
                                                                                                                                                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                                                                                                                                                        • http://one.wordpress.test
                                                                                                                                                                                                                                                                                                                                                                        • +
                                                                                                                                                                                                                                                                                                                                                                        • http://two.wordpress.test
                                                                                                                                                                                                                                                                                                                                                                        • +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Why VVV?

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      The VVV project provides a "a Vagrant configuration for developing with WordPress" and is an excellent, no-frills, starting point to develop WordPress projects (themes, plugins and whole sites.
                                                                                                                                                                                                                                                                                                                                                                      +Based on Vagrant and Virtual Box, VVV removes the differences between systems by providing a uniform, Ubuntu Linux based, virtual machine that will bahave the same on Windows, Linux and Mac. +Configuring it to run WordPress tests is easy: let's get started.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Check VVV works correctly

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      This walk-through starts after VVV has been installed and is running on the host machine; the installation guide is clear and simple to follow and I'm not duplicating it here.
                                                                                                                                                                                                                                                                                                                                                                      +In the context of this guide I'm assuming VVV lives in the ~/Repos/VVV directory, that we are working on the my-plugin project and that the plugin is being developed in the default (wordpress-one) WordPress installation provided by the box.
                                                                                                                                                                                                                                                                                                                                                                      +If your VVV installation lies elsewhere, replace the ~/Repos/VVV with the actual directory in each command.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      After completing the installation of VVV navigate to VVV root folder and run the vagrant up command:

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      cd ~/Repos/VVV
                                                                                                                                                                                                                                                                                                                                                                      +vagrant up
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      vagrant up command result

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      After the automatic bootstrap and initialization process completed, VVV makes two WordPress sites available:

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • http://one.wordpress.test/ is the first default site address.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • http://two.wordpress.test/ is the second default site address.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • http://vvv.test/ is VVV dashboard address.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      You should be able to reach each one of the URLs above without issues, should this not be the case something during VVV setup did not go according to the plan and you should fix it before moving on.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      If the sanity check above is complete it's time to move to the following part specific to Codeception and wp-browser setup.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      In and out, host and guest

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      The Vagrant box provided by VVV goes beyond a simple MySQL, PHP and Ngnix server stack and provides a complete WordPress development environment; tools like Composer, [grunt-cli][4992-0003], and [wp-cli][4992-0006] are ready to use.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      This allows the entire development, when it comes to the CLI tools, to happen in the virtual machine and not outside of it.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      "Inside the virtual machine" means the first CLI instruction to run from the ~/Repos/VVV folder (assuming that is the folder where VVV was installed) is this:

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      cd ~/Repos/VVV
                                                                                                                                                                                                                                                                                                                                                                      +vagrant ssh
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      vagrant ssh command result

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      This will connect, via SSH, to the virtual machine as the vagrant user.
                                                                                                                                                                                                                                                                                                                                                                      +To exit from the SSH session inside the box, just type exit and return.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Note: any further instruction I'm showing here, beside the code editing that will happen in a dedicated PHP IDE like [PHPStorm][4992-0004] or [Sublime Text][4992-0005] on the host machine, will happen "inside the virtual machine".

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      When I say "host machine" I mean your laptop, desktop or whatever computer you're working on; when I say "guest machine" I mean VVV virtual machine; this is usually the case for any virtual-ish setup (Vagrant, Docker and the like).

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Scaffolding the project folder

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      I'm assuming the scope of the development is to test the my-plugin plugin.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      The first step is to create the bare minimum code required to make the plugin show up among the available WordPress plugins.
                                                                                                                                                                                                                                                                                                                                                                      +Create the main plugin file in the http://one.wordpress.test installation plugins directory, in the ~/Repos/VVV/www/wordpress-one/public_html/wp-content/plugins/my-plugin/my-plugin.php file:

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      <?php
                                                                                                                                                                                                                                                                                                                                                                      +/**
                                                                                                                                                                                                                                                                                                                                                                      + * Plugin Name: My plugin
                                                                                                                                                                                                                                                                                                                                                                      + */ 
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      The plugin should now show up, activate and deactivate correctly, among the plugins listed in the VVV default WordPress installation at http://one.wordpress.test/wp-admin/plugins.php.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      By default, VVV administrator user name is admin and password is password.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Installing wp-browser

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Since Composer is provided from VVV, installing wp-browser requires entering the virtual machine (if you did not already):

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      cd ~/Repos/VVV
                                                                                                                                                                                                                                                                                                                                                                      +vagrant ssh
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Once inside navigate to the plugins folder.
                                                                                                                                                                                                                                                                                                                                                                      +The path is now relative to VVV filesystem structure so it won't be the same as the one used above that was, instead, in the context of the "host machine":

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      cd /srv/www/wordpress-one/public_html/wp-content/plugins/my-plugin 
                                                                                                                                                                                                                                                                                                                                                                      +composer init
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Composer will ask some questions to initialize the project, for the sake of this small guide the answers are not relevant. +Here is the composer.json file generated by the above answers:

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      {
                                                                                                                                                                                                                                                                                                                                                                      +    "name": "vagrant/my-plugin",
                                                                                                                                                                                                                                                                                                                                                                      +    "type": "wordpress-plugin",
                                                                                                                                                                                                                                                                                                                                                                      +    "require": {}
                                                                                                                                                                                                                                                                                                                                                                      +}
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Next require lucatume/wp-browser as a development dependency:

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      composer require --dev lucatume/wp-browser
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Composer installs any dependency binary file, an executable file, in the project vendor/bin folder.
                                                                                                                                                                                                                                                                                                                                                                      +To check Codeception is correctly installed run this command:

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      vendor/bin/codecept --version
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Since wp-browser requires Codeception, there is no need to require Codeception explicitly as a development dependency.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Setting up wp-browser

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      For those that might get lost while trying to set up wp-browser for the first time the VVV context provides an excellent base to understand the process.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      wp-browser needs to know:

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • Where the WordPress installation files are located: they will be loaded in integration and "WordPress unit" tests.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • How to connect to the WordPress site "normal" database: this is the database that stores the data of the site I would see when visiting the local installation URL (http://one.wordpress.test in the case of the VVV default installation).
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • How to connect to the database dedicated to the integration and "WordPress unit" tests: this database will be used to install WordPress during integration and "WordPress unit" tests.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Any test suite using a database should never run on a database containing data of any value; this means that if I am using VVV for my day to day WordPress development my first step should be to backup the site database.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      You can create a backup of the current site database contents using wp-cli from within the virtual machine:

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      cd /srv/www/wordpress-one/public_html
                                                                                                                                                                                                                                                                                                                                                                      +wp db export wordpress-one-backup.sql
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      At any moment you can re-import the site database dump using this command, the site database will be reset to the state it was when you created the database dump:

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      cd /srv/www/wordpress-one/public_html
                                                                                                                                                                                                                                                                                                                                                                      +wp db import wordpress-one-backup.sql
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Creating the database dedicated to the tests

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      wp-browser will use the databases it works on in a destructive way: between tests the data will be lost.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      After the backup you should have done in the previous step, the next step is creating a database dedicated to the test.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      At the VVV box command line run:

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      mysql -u root -p -e "CREATE DATABASE if not exists tests"
                                                                                                                                                                                                                                                                                                                                                                      +mysql -u root -p -e "GRANT ALL PRIVILEGES ON tests.* TO 'wp'@'localhost';"
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      When prompted for the password enter root. +The first command creates the tests database, if it does not exist; the second command grants the wp user all privileges on it.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      In VVV the root database user name is root and the password is root.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Check the database was correctly created running this command:

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      mysql -u root -p -e "SHOW DATABASES"
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      The tests database should be present in the list.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Bootstrapping and configuring wp-browser

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      After the backup is done it's time to bootstrap wp-browser using its interactive mode:

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      cd /srv/www/wordpress-one/public_html/wp-content/plugins/my-plugin
                                                                                                                                                                                                                                                                                                                                                                      +vendor/bin/codecept init wpbrowser
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      The initialization guide will ask a number of questions.
                                                                                                                                                                                                                                                                                                                                                                      +In the screenshots below are the answers I used to configure wp-browser.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Below a complete list of each answer:

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • I acknowledge wp-browser should run on development servers... y
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • Would you like to set up the suites interactively now? y
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • How would you like the acceptance suite to be called? acceptance
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • How would you like the functional suite to be called? functional
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • How would you like the WordPress unit and integration suite to be called? wpunit
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • How would you like to call the env configuration file? .env.testing
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • What is the path of the WordPress root directory? /srv/www/wordpress-one/public_html
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • What is the path, relative to WordPress root URL, of the admin area of the test site? /wp-admin
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • What is the name of the test database used by the test site? tests
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • What is the host of the test database used by the test site? localhost
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • What is the user of the test database used by the test site? root
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • What is the password of the test database used by the test site? root
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • What is the table prefix of the test database used by the test site? wp_
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • What is the name of the test database WPLoader should use? tests
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • What is the host of the test database WPLoader should use? localhost
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • What is the user of the test database WPLoader should use? root
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • What is the password of the test database WPLoader should use? root
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • What is the table prefix of the test database WPLoader should use? wp_
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • What is the URL the test site? http://one.wordpress.test
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • What is the email of the test site WordPress administrator? admin@one.wordpress.test
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • What is the title of the test site? My Plugin Test
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • What is the login of the administrator user of the test site? admin
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • What is the password of the administrator user of the test site? password
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • Are you testing a plugin, a theme or a combination of both (both)? plugin
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • What is the folder/plugin.php name of the plugin? my-plugin/my-plugin.php
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • Does your project needs additional plugins to be activated to work? no
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Codeception will build the suites for the first time and should be ready to go.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Setting up the starting database fixture

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      A "fixture", in testing terms, is a minimal, starting environment shared by all tests.
                                                                                                                                                                                                                                                                                                                                                                      +In BDD it's the Background any scenario will share. +In the case of a plugin the minimal, starting environment is the following:

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • A fresh WordPress installation empty of any content.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • WordPress using its default theme.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • The only active plugin is the one you're testing, in this example: my-plugin.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      You can set up this fixture "manually", using the site administration UI at http://one.wordpress.test/wp-admin, or use wp-cli and save precious time.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      The following command will empty the site, backup any content you care about first!

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      As it's been the case so far, I'm running the following command from within the VVV box (use vagrant ssh to log in):

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      cd /srv/www/wordpress-one/public_html
                                                                                                                                                                                                                                                                                                                                                                      +wp site empty --yes --uploads
                                                                                                                                                                                                                                                                                                                                                                      +wp plugin deactivate --all
                                                                                                                                                                                                                                                                                                                                                                      +wp plugin activate my-plugin
                                                                                                                                                                                                                                                                                                                                                                      +wp db export wp-content/plugins/my-plugin/tests/_data/dump.sql
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      The initial database fixture has been created, now there's one last step to complete.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Using the tests database in acceptance and functional tests

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Acceptance and functional tests will act as users, navigating to the site pages and making requests as a user would.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      This means that WordPress will load, and with it its wp-config.php file, to handle the requests made by the tests.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      During the setup phase I've specified the database to be used for acceptance and functional tests as tests but, looking at the contents of the /srv/www/wordpress-one/public_html/wp-config.php file, the DB_NAME constant is set to wordpress-one.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      What we'll do now means:

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • If the request is a normal one, use the wordpress-one database.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • If the request comes from a test, use the tests database.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      In your IDE/text-editor of choice edit the ~/Repos/VVV/www/wordpress-one/public_html/wp-config.php and replace the line defining the DB_NAME constant like this:

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      - define( 'DB_NAME', 'wordpress-one' );
                                                                                                                                                                                                                                                                                                                                                                      ++ if( isset( $_SERVER['HTTP_X_WPBROWSER_REQUEST'] ) && $_SERVER['HTTP_X_WPBROWSER_REQUEST'] ) { 
                                                                                                                                                                                                                                                                                                                                                                      ++    define( 'DB_NAME', 'tests' );
                                                                                                                                                                                                                                                                                                                                                                      ++ } else {
                                                                                                                                                                                                                                                                                                                                                                      ++    define( 'DB_NAME', 'wordpress-one' );
                                                                                                                                                                                                                                                                                                                                                                      ++ }
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Here's the copy-and-paste friendly version:

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      if( isset( $_SERVER['HTTP_X_TEST_REQUEST'] ) && $_SERVER['HTTP_X_TEST_REQUEST'] ) {
                                                                                                                                                                                                                                                                                                                                                                      +        define( 'DB_NAME', 'tests' );
                                                                                                                                                                                                                                                                                                                                                                      +} else {
                                                                                                                                                                                                                                                                                                                                                                      +        define( 'DB_NAME', 'wordpress-one' );
                                                                                                                                                                                                                                                                                                                                                                      +}
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      If you look at the tests/acceptance.suite.yml and tests/functional.suite.yml files, respectively the acceptance and functional suite configuration files, you will see these entries in the WPBrowser module configuration:

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      headers:
                                                                                                                                                                                                                                                                                                                                                                      +    X_TEST_REQUEST: 1
                                                                                                                                                                                                                                                                                                                                                                      +    X_WPBROWSER_REQUEST: 1
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      This means that, with each HTTP request done during tests, the module will send the two headers.
                                                                                                                                                                                                                                                                                                                                                                      +Those headers are read, on the WordPress side, using the $_SERVER['HTTP_X_TEST_REQUEST'] and $_SERVER['X_WPBROWSER_REQUEST'] variables.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Codeception and wp-browser are ready to run and the test-drive development can start.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Sanity check

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Before starting to write tests, take a moment to run each suite separately and make sure all is set up correctly.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      If you run into issues, there's a chance you forgot something along the way, please take the time to read this tutorial a second time before opening an issue.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      You have created 4 suites, each suite has at least one example test to make sure all works.
                                                                                                                                                                                                                                                                                                                                                                      +Run each suite and make sure all tests succeed, from within the box run:

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      cd /srv/www/wordpress-one/public_html/wp-content/plugins/my-plugin 
                                                                                                                                                                                                                                                                                                                                                                      +vendor/bin/codecept run acceptance
                                                                                                                                                                                                                                                                                                                                                                      +vendor/bin/codecept run functional
                                                                                                                                                                                                                                                                                                                                                                      +vendor/bin/codecept run wpunit
                                                                                                                                                                                                                                                                                                                                                                      +vendor/bin/codecept run unit
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      You're now run to customize the suites to your liking or start writing tests, run vendor/bin/codecept to see a list of the available commands.

                                                                                                                                                                                                                                                                                                                                                                      + + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + + + + + \ No newline at end of file diff --git a/docs/v3/tutorials/wamp-setup/index.html b/docs/v3/tutorials/wamp-setup/index.html new file mode 100644 index 000000000..e15c89791 --- /dev/null +++ b/docs/v3/tutorials/wamp-setup/index.html @@ -0,0 +1,2556 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Setting up wp-browser on WAMP for Windows to test a plugin - wp-browser docs + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      + + +
                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + + + +

                                                                                                                                                                                                                                                                                                                                                                      Setting up wp-browser on WAMP for Windows to test a plugin

                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      This is the documentation for version 3 of the project. +The current version is version 4 and the documentation can be found here.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Setting up wp-browser with WAMP on Windows to test a plugin

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Requirements

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • A Windows machine
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • A working installation of WAMP.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • You should be able to create sites and visit them from your browser without issues.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • Composer installed and working on your terminal PATH, you should be able to run composer --version at the terminal and see the version correctly.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Install and configure WAMP

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      This walk-through starts after WAMP has been installed and is correctly running on the host machine; you can download WAMP from the site and follow the installation instructions.
                                                                                                                                                                                                                                                                                                                                                                      +In the context of this guide I'm installing the test WordPress installation in the C:\wamp64\www\wp directory. +If your installation lies elsewhere, replace the C:\wamp64\www\wp path with the actual directory in each command.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Creating the databases and installing WordPress

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Go to the http://localhost/phpmyadmin/index.php page and create two new databases:

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • wordpress is the database you will use for WordPress
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • tests is the database you will use for the tests
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      The default database user is root, the default password is empty.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Unzip the the WordPress files into the C:\wamp64\www\wp and head over to http://localhost/wp to install WordPress.
                                                                                                                                                                                                                                                                                                                                                                      +The database credentials for the installation are:

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • Database name: wordpress
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • Database user: root
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • Database password is empty
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • Database host: localhost
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Use admin as administrator user name and password as password for the administrator user.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Make sure you can visit the WordPress installation at http://localhost/wp and that you can correctly access the administration area at http://localhost/wp/wp-admin.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Scaffolding the project folder

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      I'm assuming the scope of the development is to test the my-plugin plugin.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      The first step is to create the bare minimum code required to make the plugin show up among the available WordPress plugins.
                                                                                                                                                                                                                                                                                                                                                                      +Create the main plugin file in the WordPress installation plugins directory, in the C:\wamp64\www\wp\wp-content\plugins\my-plugin\my-plugin.php file:

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      <?php
                                                                                                                                                                                                                                                                                                                                                                      +/**
                                                                                                                                                                                                                                                                                                                                                                      + * Plugin Name: My plugin
                                                                                                                                                                                                                                                                                                                                                                      + */ 
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      The plugin should now show up, activate and deactivate correctly, among the plugins listed in the WordPress installation at http://localhost/wp/wp-admin/plugins.php.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Installing wp-browser

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Open a terminal window and navigate to the plugin directory and initialize the Composer project.
                                                                                                                                                                                                                                                                                                                                                                      +I'm using Cmder as terminal emulator on Windows, but you can use the default one.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      cd C:\wamp64\www\wp\wp-content\plugins\my-plugin
                                                                                                                                                                                                                                                                                                                                                                      +composer init
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Composer will ask some questions to initialize the project, for the sake of this small guide the answers are not relevant. +Here is the composer.json file generated by the above answers:

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      {
                                                                                                                                                                                                                                                                                                                                                                      +    "name": "wamp/my-plugin",
                                                                                                                                                                                                                                                                                                                                                                      +    "type": "wordpress-plugin",
                                                                                                                                                                                                                                                                                                                                                                      +    "require": {}
                                                                                                                                                                                                                                                                                                                                                                      +}
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Next require lucatume/wp-browser as a development dependency:

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      composer require --dev lucatume/wp-browser
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Composer installs any dependency binary file, an executable file, in the project vendor/bin folder.
                                                                                                                                                                                                                                                                                                                                                                      +To check Codeception is correctly installed run this command:

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      vendor\bin\codecept.bat --version
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Since wp-browser requires Codeception, there is no need to require Codeception explicitly as a development dependency.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Setting up wp-browser

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      For those that might get lost while trying to set up wp-browser for the first time the VVV context provides an excellent base to understand the process.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      wp-browser needs to know:

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • Where the WordPress installation files are located: they will be loaded in integration and "WordPress unit" tests.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • How to connect to the WordPress site "normal" database: this is the database that stores the data of the site I would see when visiting the local installation URL at http://localhost/wp.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • How to connect to the database dedicated to the integration and "WordPress unit" tests: this database will be used to install WordPress during integration and "WordPress unit" tests.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Any test suite using a database should never run on a database containing data of any value; this means that your first step should be to backup the site database.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      You can create a backup of the current site database contents using phpMyAdmin, at http://localhost/phpmyadmin/, under the "Export" tab:

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      At any moment you can re-import the site database dump using, again, phpMyAdmin, under the "Import" tab:

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Bootstrapping and configuring wp-browser

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      After the backup is done it's time to bootstrap wp-browser using its interactive mode:

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      cd C:\wamp64\www\wp\wp-content\plugins\my-plugin
                                                                                                                                                                                                                                                                                                                                                                      +vendor/bin/codecept.bat init wpbrowser
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      The initialization guide will ask a number of questions.
                                                                                                                                                                                                                                                                                                                                                                      +In the screenshots below are the answers I used to configure wp-browser.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Below a complete list of each answer:

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • I acknowledge wp-browser should run on development servers... y
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • Would you like to set up the suites interactively now? y
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • How would you like the acceptance suite to be called? acceptance
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • How would you like the functional suite to be called? functional
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • How would you like the WordPress unit and integration suite to be called? wpunit
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • How would you like to call the env configuration file? .env.testing
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • What is the path of the WordPress root directory? C:/wamp64/www/wp
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • What is the path, relative to WordPress root URL, of the admin area of the test site? /wp-admin
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • What is the name of the test database used by the test site? tests
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • What is the host of the test database used by the test site? localhost
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • What is the user of the test database used by the test site? root
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • What is the password of the test database used by the test site? ``
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • What is the table prefix of the test database used by the test site? wp_
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • What is the name of the test database WPLoader should use? tests
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • What is the host of the test database WPLoader should use? localhost
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • What is the user of the test database WPLoader should use? root
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • What is the password of the test database WPLoader should use? ``
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • What is the table prefix of the test database WPLoader should use? wp_
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • What is the URL the test site? http://localhost/wp
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • What is the email of the test site WordPress administrator? admin@wp.test
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • What is the title of the test site? My Plugin Test
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • What is the login of the administrator user of the test site? admin
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • What is the password of the administrator user of the test site? password
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • Are you testing a plugin, a theme or a combination of both (both)? plugin
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • What is the folder/plugin.php name of the plugin? my-plugin/my-plugin.php
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • Does your project needs additional plugins to be activated to work? no
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Codeception will build the suites for the first time and should be ready to go.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Setting up the starting database fixture

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      A "fixture", in testing terms, is a minimal, starting environment shared by all tests.
                                                                                                                                                                                                                                                                                                                                                                      +In BDD it's the Background any scenario will share. +In the case of a plugin the minimal, starting environment is the following:

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • A fresh WordPress installation empty of any content.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • WordPress using its default theme.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • The only active plugin is the one you're testing, in this example: my-plugin.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      You should set up this fixture "manually", using the site administration UI at http://localhost/wp/wp-admin.

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      The following command will empty the site, backup any content you care about first!

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      When you're done setting up the initial database fixture, export it using the "Export" tab of phpMyAdmin, at http://localhost/phpmyadmin/ and move the file to the C:\wamp64\www\wp\wp-content\plugins\my-plugin\tests\_data\dump.sql directory.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      There is one last step left to complete the setup.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Using the tests database in acceptance and functional tests

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Acceptance and functional tests will act as users, navigating to the site pages and making requests as a user would.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      This means that WordPress will load, and with it its wp-config.php file, to handle the requests made by the tests.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      During the setup phase I've specified the database to be used for acceptance and functional tests as tests but, looking at the contents of the C:\wamp64\www\wp\wp-config.php file, the DB_NAME constant is set to wordpress.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      What we'll do now means:

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                      • If the request is a normal one, use the wordpress database.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      • If the request comes from a test, use the tests database.
                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      In your IDE/text-editor of choice edit the C:\wamp64\www\wp\wp-config.php and replace the line defining the DB_NAME constant like this:

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      - define( 'DB_NAME', 'wordpress' );
                                                                                                                                                                                                                                                                                                                                                                      ++ if( isset( $_SERVER['HTTP_X_WPBROWSER_REQUEST'] ) && $_SERVER['HTTP_X_WPBROWSER_REQUEST'] ) { 
                                                                                                                                                                                                                                                                                                                                                                      ++    define( 'DB_NAME', 'tests' );
                                                                                                                                                                                                                                                                                                                                                                      ++ } else {
                                                                                                                                                                                                                                                                                                                                                                      ++    define( 'DB_NAME', 'wordpress' );
                                                                                                                                                                                                                                                                                                                                                                      ++ }
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Here's the copy-and-paste friendly version:

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      if( isset( $_SERVER['HTTP_X_TEST_REQUEST'] ) && $_SERVER['HTTP_X_TEST_REQUEST'] ) {
                                                                                                                                                                                                                                                                                                                                                                      +        define( 'DB_NAME', 'tests' );
                                                                                                                                                                                                                                                                                                                                                                      +} else {
                                                                                                                                                                                                                                                                                                                                                                      +        define( 'DB_NAME', 'wordpress' );
                                                                                                                                                                                                                                                                                                                                                                      +}
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      If you look at the tests/acceptance.suite.yml and tests/functional.suite.yml files, respectively the acceptance and functional suite configuration files, you will see these entries in the WPBrowser module configuration:

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      headers:
                                                                                                                                                                                                                                                                                                                                                                      +    X_TEST_REQUEST: 1
                                                                                                                                                                                                                                                                                                                                                                      +    X_WPBROWSER_REQUEST: 1
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      This means that, with each HTTP request done during tests, the module will send the two headers.
                                                                                                                                                                                                                                                                                                                                                                      +Those headers are read, on the WordPress side, using the $_SERVER['HTTP_X_TEST_REQUEST'] and $_SERVER['X_WPBROWSER_REQUEST'] variables.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Codeception and wp-browser are ready to run and the test-drive development can start.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Sanity check

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      Before starting to write tests, take a moment to run each suite separately and make sure all is set up correctly.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      If you run into issues, there's a chance you forgot something along the way, please take the time to read this tutorial a second time before opening an issue.

                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      You have created 4 suites, each suite has at least one example test to make sure all works.
                                                                                                                                                                                                                                                                                                                                                                      +Run each suite and make sure all tests succeed, from within the box run:

                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      cd C:\wamp64\www\wp\wp-content\plugins\my-plugin 
                                                                                                                                                                                                                                                                                                                                                                      +vendor/bin/codecept run acceptance
                                                                                                                                                                                                                                                                                                                                                                      +vendor/bin/codecept run functional
                                                                                                                                                                                                                                                                                                                                                                      +vendor/bin/codecept run wpunit
                                                                                                                                                                                                                                                                                                                                                                      +vendor/bin/codecept run unit
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                      You're now run to customize the suites to your liking or start writing tests, run vendor/bin/codecept.bat to see a list of the available commands.

                                                                                                                                                                                                                                                                                                                                                                      + + + + + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      + + + +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      + + + + + + + + + \ No newline at end of file diff --git a/docs/src/README.md b/docs_src/README.md similarity index 100% rename from docs/src/README.md rename to docs_src/README.md diff --git a/docs/src/commands.md b/docs_src/commands.md similarity index 100% rename from docs/src/commands.md rename to docs_src/commands.md diff --git a/docs/src/custom-configuration.md b/docs_src/custom-configuration.md similarity index 100% rename from docs/src/custom-configuration.md rename to docs_src/custom-configuration.md diff --git a/docs/src/default-configuration.md b/docs_src/default-configuration.md similarity index 100% rename from docs/src/default-configuration.md rename to docs_src/default-configuration.md diff --git a/docs/src/extensions.md b/docs_src/extensions.md similarity index 100% rename from docs/src/extensions.md rename to docs_src/extensions.md diff --git a/docs/src/modules/WPBrowser.md b/docs_src/modules/WPBrowser.md similarity index 100% rename from docs/src/modules/WPBrowser.md rename to docs_src/modules/WPBrowser.md diff --git a/docs/src/modules/WPCLI.md b/docs_src/modules/WPCLI.md similarity index 100% rename from docs/src/modules/WPCLI.md rename to docs_src/modules/WPCLI.md diff --git a/docs/src/modules/WPDb.md b/docs_src/modules/WPDb.md similarity index 100% rename from docs/src/modules/WPDb.md rename to docs_src/modules/WPDb.md diff --git a/docs/src/modules/WPFilesystem.md b/docs_src/modules/WPFilesystem.md similarity index 100% rename from docs/src/modules/WPFilesystem.md rename to docs_src/modules/WPFilesystem.md diff --git a/docs/src/modules/WPLoader.md b/docs_src/modules/WPLoader.md similarity index 100% rename from docs/src/modules/WPLoader.md rename to docs_src/modules/WPLoader.md diff --git a/docs/src/modules/WPQueries.md b/docs_src/modules/WPQueries.md similarity index 100% rename from docs/src/modules/WPQueries.md rename to docs_src/modules/WPQueries.md diff --git a/docs/src/modules/WPWebDriver.md b/docs_src/modules/WPWebDriver.md similarity index 100% rename from docs/src/modules/WPWebDriver.md rename to docs_src/modules/WPWebDriver.md diff --git a/docs/src/v3/README.md b/docs_src/v3/README.md similarity index 100% rename from docs/src/v3/README.md rename to docs_src/v3/README.md diff --git a/docs/src/v3/advanced/run-in-separate-process.md b/docs_src/v3/advanced/run-in-separate-process.md similarity index 100% rename from docs/src/v3/advanced/run-in-separate-process.md rename to docs_src/v3/advanced/run-in-separate-process.md diff --git a/docs/src/v3/codeception-4-support.md b/docs_src/v3/codeception-4-support.md similarity index 100% rename from docs/src/v3/codeception-4-support.md rename to docs_src/v3/codeception-4-support.md diff --git a/docs/src/v3/codeception-phpunit-and-wpbrowser.md b/docs_src/v3/codeception-phpunit-and-wpbrowser.md similarity index 100% rename from docs/src/v3/codeception-phpunit-and-wpbrowser.md rename to docs_src/v3/codeception-phpunit-and-wpbrowser.md diff --git a/docs/src/v3/commands.md b/docs_src/v3/commands.md similarity index 100% rename from docs/src/v3/commands.md rename to docs_src/v3/commands.md diff --git a/docs/src/v3/configuration.md b/docs_src/v3/configuration.md similarity index 100% rename from docs/src/v3/configuration.md rename to docs_src/v3/configuration.md diff --git a/docs/src/v3/events-api.md b/docs_src/v3/events-api.md similarity index 100% rename from docs/src/v3/events-api.md rename to docs_src/v3/events-api.md diff --git a/docs/src/v3/extensions.md b/docs_src/v3/extensions.md similarity index 100% rename from docs/src/v3/extensions.md rename to docs_src/v3/extensions.md diff --git a/docs/src/v3/faq.md b/docs_src/v3/faq.md similarity index 100% rename from docs/src/v3/faq.md rename to docs_src/v3/faq.md diff --git a/docs/src/v3/images/codecept-init-wpbrowser-01.png b/docs_src/v3/images/codecept-init-wpbrowser-01.png similarity index 100% rename from docs/src/v3/images/codecept-init-wpbrowser-01.png rename to docs_src/v3/images/codecept-init-wpbrowser-01.png diff --git a/docs/src/v3/images/codecept-init-wpbrowser-02.png b/docs_src/v3/images/codecept-init-wpbrowser-02.png similarity index 100% rename from docs/src/v3/images/codecept-init-wpbrowser-02.png rename to docs_src/v3/images/codecept-init-wpbrowser-02.png diff --git a/docs/src/v3/images/codecept-run.png b/docs_src/v3/images/codecept-run.png similarity index 100% rename from docs/src/v3/images/codecept-run.png rename to docs_src/v3/images/codecept-run.png diff --git a/docs/src/v3/images/initial-setup.png b/docs_src/v3/images/initial-setup.png similarity index 100% rename from docs/src/v3/images/initial-setup.png rename to docs_src/v3/images/initial-setup.png diff --git a/docs/src/v3/installation.md b/docs_src/v3/installation.md similarity index 100% rename from docs/src/v3/installation.md rename to docs_src/v3/installation.md diff --git a/docs/src/v3/levels-of-testing.md b/docs_src/v3/levels-of-testing.md similarity index 100% rename from docs/src/v3/levels-of-testing.md rename to docs_src/v3/levels-of-testing.md diff --git a/docs/src/v3/migration/from-version-2-to-version-3.md b/docs_src/v3/migration/from-version-2-to-version-3.md similarity index 100% rename from docs/src/v3/migration/from-version-2-to-version-3.md rename to docs_src/v3/migration/from-version-2-to-version-3.md diff --git a/docs/src/v3/modules/WPBrowser.md b/docs_src/v3/modules/WPBrowser.md similarity index 100% rename from docs/src/v3/modules/WPBrowser.md rename to docs_src/v3/modules/WPBrowser.md diff --git a/docs/src/v3/modules/WPCLI.md b/docs_src/v3/modules/WPCLI.md similarity index 100% rename from docs/src/v3/modules/WPCLI.md rename to docs_src/v3/modules/WPCLI.md diff --git a/docs/src/v3/modules/WPDb.md b/docs_src/v3/modules/WPDb.md similarity index 100% rename from docs/src/v3/modules/WPDb.md rename to docs_src/v3/modules/WPDb.md diff --git a/docs/src/v3/modules/WPFilesystem.md b/docs_src/v3/modules/WPFilesystem.md similarity index 100% rename from docs/src/v3/modules/WPFilesystem.md rename to docs_src/v3/modules/WPFilesystem.md diff --git a/docs/src/v3/modules/WPLoader.md b/docs_src/v3/modules/WPLoader.md similarity index 100% rename from docs/src/v3/modules/WPLoader.md rename to docs_src/v3/modules/WPLoader.md diff --git a/docs/src/v3/modules/WPQueries.md b/docs_src/v3/modules/WPQueries.md similarity index 100% rename from docs/src/v3/modules/WPQueries.md rename to docs_src/v3/modules/WPQueries.md diff --git a/docs/src/v3/modules/WPWebDriver.md b/docs_src/v3/modules/WPWebDriver.md similarity index 100% rename from docs/src/v3/modules/WPWebDriver.md rename to docs_src/v3/modules/WPWebDriver.md diff --git a/docs/src/v3/modules/WordPress.md b/docs_src/v3/modules/WordPress.md similarity index 100% rename from docs/src/v3/modules/WordPress.md rename to docs_src/v3/modules/WordPress.md diff --git a/docs/src/v3/requirements.md b/docs_src/v3/requirements.md similarity index 100% rename from docs/src/v3/requirements.md rename to docs_src/v3/requirements.md diff --git a/docs/src/v3/setting-up-minimum-wordpress-installation.md b/docs_src/v3/setting-up-minimum-wordpress-installation.md similarity index 100% rename from docs/src/v3/setting-up-minimum-wordpress-installation.md rename to docs_src/v3/setting-up-minimum-wordpress-installation.md diff --git a/docs/src/v3/tutorials/automatically-change-db-in-tests.md b/docs_src/v3/tutorials/automatically-change-db-in-tests.md similarity index 100% rename from docs/src/v3/tutorials/automatically-change-db-in-tests.md rename to docs_src/v3/tutorials/automatically-change-db-in-tests.md diff --git a/docs/src/v3/tutorials/images/local-flywheel-adminer.png b/docs_src/v3/tutorials/images/local-flywheel-adminer.png similarity index 100% rename from docs/src/v3/tutorials/images/local-flywheel-adminer.png rename to docs_src/v3/tutorials/images/local-flywheel-adminer.png diff --git a/docs/src/v3/tutorials/images/local-flywheel-codecept-version.png b/docs_src/v3/tutorials/images/local-flywheel-codecept-version.png similarity index 100% rename from docs/src/v3/tutorials/images/local-flywheel-codecept-version.png rename to docs_src/v3/tutorials/images/local-flywheel-codecept-version.png diff --git a/docs/src/v3/tutorials/images/local-flywheel-composer-init.png b/docs_src/v3/tutorials/images/local-flywheel-composer-init.png similarity index 100% rename from docs/src/v3/tutorials/images/local-flywheel-composer-init.png rename to docs_src/v3/tutorials/images/local-flywheel-composer-init.png diff --git a/docs/src/v3/tutorials/images/local-flywheel-create-database.png b/docs_src/v3/tutorials/images/local-flywheel-create-database.png similarity index 100% rename from docs/src/v3/tutorials/images/local-flywheel-create-database.png rename to docs_src/v3/tutorials/images/local-flywheel-create-database.png diff --git a/docs/src/v3/tutorials/images/local-flywheel-db-export.png b/docs_src/v3/tutorials/images/local-flywheel-db-export.png similarity index 100% rename from docs/src/v3/tutorials/images/local-flywheel-db-export.png rename to docs_src/v3/tutorials/images/local-flywheel-db-export.png diff --git a/docs/src/v3/tutorials/images/local-flywheel-db-import.png b/docs_src/v3/tutorials/images/local-flywheel-db-import.png similarity index 100% rename from docs/src/v3/tutorials/images/local-flywheel-db-import.png rename to docs_src/v3/tutorials/images/local-flywheel-db-import.png diff --git a/docs/src/v3/tutorials/images/local-flywheel-mac-db-creds.png b/docs_src/v3/tutorials/images/local-flywheel-mac-db-creds.png similarity index 100% rename from docs/src/v3/tutorials/images/local-flywheel-mac-db-creds.png rename to docs_src/v3/tutorials/images/local-flywheel-mac-db-creds.png diff --git a/docs/src/v3/tutorials/images/local-flywheel-mac-wpbrowser-init-1.png b/docs_src/v3/tutorials/images/local-flywheel-mac-wpbrowser-init-1.png similarity index 100% rename from docs/src/v3/tutorials/images/local-flywheel-mac-wpbrowser-init-1.png rename to docs_src/v3/tutorials/images/local-flywheel-mac-wpbrowser-init-1.png diff --git a/docs/src/v3/tutorials/images/local-flywheel-mac-wpbrowser-init-2.png b/docs_src/v3/tutorials/images/local-flywheel-mac-wpbrowser-init-2.png similarity index 100% rename from docs/src/v3/tutorials/images/local-flywheel-mac-wpbrowser-init-2.png rename to docs_src/v3/tutorials/images/local-flywheel-mac-wpbrowser-init-2.png diff --git a/docs/src/v3/tutorials/images/local-flywheel-sites-path.png b/docs_src/v3/tutorials/images/local-flywheel-sites-path.png similarity index 100% rename from docs/src/v3/tutorials/images/local-flywheel-sites-path.png rename to docs_src/v3/tutorials/images/local-flywheel-sites-path.png diff --git a/docs/src/v3/tutorials/images/local-flywheel-win-db-creds.png b/docs_src/v3/tutorials/images/local-flywheel-win-db-creds.png similarity index 100% rename from docs/src/v3/tutorials/images/local-flywheel-win-db-creds.png rename to docs_src/v3/tutorials/images/local-flywheel-win-db-creds.png diff --git a/docs/src/v3/tutorials/images/local-flywheel-win-wpbrowser-init-1.png b/docs_src/v3/tutorials/images/local-flywheel-win-wpbrowser-init-1.png similarity index 100% rename from docs/src/v3/tutorials/images/local-flywheel-win-wpbrowser-init-1.png rename to docs_src/v3/tutorials/images/local-flywheel-win-wpbrowser-init-1.png diff --git a/docs/src/v3/tutorials/images/local-flywheel-win-wpbrowser-init-2.png b/docs_src/v3/tutorials/images/local-flywheel-win-wpbrowser-init-2.png similarity index 100% rename from docs/src/v3/tutorials/images/local-flywheel-win-wpbrowser-init-2.png rename to docs_src/v3/tutorials/images/local-flywheel-win-wpbrowser-init-2.png diff --git a/docs/src/v3/tutorials/images/local-lite-mac-db-creds.png b/docs_src/v3/tutorials/images/local-lite-mac-db-creds.png similarity index 100% rename from docs/src/v3/tutorials/images/local-lite-mac-db-creds.png rename to docs_src/v3/tutorials/images/local-lite-mac-db-creds.png diff --git a/docs/src/v3/tutorials/images/local-my-plugin-shows.png b/docs_src/v3/tutorials/images/local-my-plugin-shows.png similarity index 100% rename from docs/src/v3/tutorials/images/local-my-plugin-shows.png rename to docs_src/v3/tutorials/images/local-my-plugin-shows.png diff --git a/docs/src/v3/tutorials/images/mac-codecept-version.png b/docs_src/v3/tutorials/images/mac-codecept-version.png similarity index 100% rename from docs/src/v3/tutorials/images/mac-codecept-version.png rename to docs_src/v3/tutorials/images/mac-codecept-version.png diff --git a/docs/src/v3/tutorials/images/mac-composer-init.png b/docs_src/v3/tutorials/images/mac-composer-init.png similarity index 100% rename from docs/src/v3/tutorials/images/mac-composer-init.png rename to docs_src/v3/tutorials/images/mac-composer-init.png diff --git a/docs/src/v3/tutorials/images/mamp-create-db.png b/docs_src/v3/tutorials/images/mamp-create-db.png similarity index 100% rename from docs/src/v3/tutorials/images/mamp-create-db.png rename to docs_src/v3/tutorials/images/mamp-create-db.png diff --git a/docs/src/v3/tutorials/images/mamp-db-export.png b/docs_src/v3/tutorials/images/mamp-db-export.png similarity index 100% rename from docs/src/v3/tutorials/images/mamp-db-export.png rename to docs_src/v3/tutorials/images/mamp-db-export.png diff --git a/docs/src/v3/tutorials/images/mamp-db-import.png b/docs_src/v3/tutorials/images/mamp-db-import.png similarity index 100% rename from docs/src/v3/tutorials/images/mamp-db-import.png rename to docs_src/v3/tutorials/images/mamp-db-import.png diff --git a/docs/src/v3/tutorials/images/mamp-mac-dirs.png b/docs_src/v3/tutorials/images/mamp-mac-dirs.png similarity index 100% rename from docs/src/v3/tutorials/images/mamp-mac-dirs.png rename to docs_src/v3/tutorials/images/mamp-mac-dirs.png diff --git a/docs/src/v3/tutorials/images/mamp-mac-ports.png b/docs_src/v3/tutorials/images/mamp-mac-ports.png similarity index 100% rename from docs/src/v3/tutorials/images/mamp-mac-ports.png rename to docs_src/v3/tutorials/images/mamp-mac-ports.png diff --git a/docs/src/v3/tutorials/images/mamp-my-plugin-shows.png b/docs_src/v3/tutorials/images/mamp-my-plugin-shows.png similarity index 100% rename from docs/src/v3/tutorials/images/mamp-my-plugin-shows.png rename to docs_src/v3/tutorials/images/mamp-my-plugin-shows.png diff --git a/docs/src/v3/tutorials/images/mamp-wp-installation-1.png b/docs_src/v3/tutorials/images/mamp-wp-installation-1.png similarity index 100% rename from docs/src/v3/tutorials/images/mamp-wp-installation-1.png rename to docs_src/v3/tutorials/images/mamp-wp-installation-1.png diff --git a/docs/src/v3/tutorials/images/mamp-wpbrowser-init-1.png b/docs_src/v3/tutorials/images/mamp-wpbrowser-init-1.png similarity index 100% rename from docs/src/v3/tutorials/images/mamp-wpbrowser-init-1.png rename to docs_src/v3/tutorials/images/mamp-wpbrowser-init-1.png diff --git a/docs/src/v3/tutorials/images/mamp-wpbrowser-init-2.png b/docs_src/v3/tutorials/images/mamp-wpbrowser-init-2.png similarity index 100% rename from docs/src/v3/tutorials/images/mamp-wpbrowser-init-2.png rename to docs_src/v3/tutorials/images/mamp-wpbrowser-init-2.png diff --git a/docs/src/v3/tutorials/images/vvv-codecept-version.png b/docs_src/v3/tutorials/images/vvv-codecept-version.png similarity index 100% rename from docs/src/v3/tutorials/images/vvv-codecept-version.png rename to docs_src/v3/tutorials/images/vvv-codecept-version.png diff --git a/docs/src/v3/tutorials/images/vvv-my-plugin-composer-init.png b/docs_src/v3/tutorials/images/vvv-my-plugin-composer-init.png similarity index 100% rename from docs/src/v3/tutorials/images/vvv-my-plugin-composer-init.png rename to docs_src/v3/tutorials/images/vvv-my-plugin-composer-init.png diff --git a/docs/public/v3/tutorials/images/vvv-my-plugins-shows.png b/docs_src/v3/tutorials/images/vvv-my-plugin-shows.png similarity index 100% rename from docs/public/v3/tutorials/images/vvv-my-plugins-shows.png rename to docs_src/v3/tutorials/images/vvv-my-plugin-shows.png diff --git a/docs/src/v3/tutorials/images/vvv-ssh.png b/docs_src/v3/tutorials/images/vvv-ssh.png similarity index 100% rename from docs/src/v3/tutorials/images/vvv-ssh.png rename to docs_src/v3/tutorials/images/vvv-ssh.png diff --git a/docs/src/v3/tutorials/images/vvv-up.png b/docs_src/v3/tutorials/images/vvv-up.png similarity index 100% rename from docs/src/v3/tutorials/images/vvv-up.png rename to docs_src/v3/tutorials/images/vvv-up.png diff --git a/docs/src/v3/tutorials/images/vvv-wp-browser-init-1.png b/docs_src/v3/tutorials/images/vvv-wp-browser-init-1.png similarity index 100% rename from docs/src/v3/tutorials/images/vvv-wp-browser-init-1.png rename to docs_src/v3/tutorials/images/vvv-wp-browser-init-1.png diff --git a/docs/src/v3/tutorials/images/vvv-wp-browser-init-2.png b/docs_src/v3/tutorials/images/vvv-wp-browser-init-2.png similarity index 100% rename from docs/src/v3/tutorials/images/vvv-wp-browser-init-2.png rename to docs_src/v3/tutorials/images/vvv-wp-browser-init-2.png diff --git a/docs/src/v3/tutorials/images/vvv-wp-db-backup.png b/docs_src/v3/tutorials/images/vvv-wp-db-backup.png similarity index 100% rename from docs/src/v3/tutorials/images/vvv-wp-db-backup.png rename to docs_src/v3/tutorials/images/vvv-wp-db-backup.png diff --git a/docs/src/v3/tutorials/images/wamp-codecept-version.png b/docs_src/v3/tutorials/images/wamp-codecept-version.png similarity index 100% rename from docs/src/v3/tutorials/images/wamp-codecept-version.png rename to docs_src/v3/tutorials/images/wamp-codecept-version.png diff --git a/docs/src/v3/tutorials/images/wamp-composer-init.png b/docs_src/v3/tutorials/images/wamp-composer-init.png similarity index 100% rename from docs/src/v3/tutorials/images/wamp-composer-init.png rename to docs_src/v3/tutorials/images/wamp-composer-init.png diff --git a/docs/src/v3/tutorials/images/wamp-create-db.png b/docs_src/v3/tutorials/images/wamp-create-db.png similarity index 100% rename from docs/src/v3/tutorials/images/wamp-create-db.png rename to docs_src/v3/tutorials/images/wamp-create-db.png diff --git a/docs/src/v3/tutorials/images/wamp-db-export.png b/docs_src/v3/tutorials/images/wamp-db-export.png similarity index 100% rename from docs/src/v3/tutorials/images/wamp-db-export.png rename to docs_src/v3/tutorials/images/wamp-db-export.png diff --git a/docs/src/v3/tutorials/images/wamp-db-import.png b/docs_src/v3/tutorials/images/wamp-db-import.png similarity index 100% rename from docs/src/v3/tutorials/images/wamp-db-import.png rename to docs_src/v3/tutorials/images/wamp-db-import.png diff --git a/docs/src/v3/tutorials/images/wamp-my-plugin-shows.png b/docs_src/v3/tutorials/images/wamp-my-plugin-shows.png similarity index 100% rename from docs/src/v3/tutorials/images/wamp-my-plugin-shows.png rename to docs_src/v3/tutorials/images/wamp-my-plugin-shows.png diff --git a/docs/src/v3/tutorials/images/wamp-virtualhost-creation-1.png b/docs_src/v3/tutorials/images/wamp-virtualhost-creation-1.png similarity index 100% rename from docs/src/v3/tutorials/images/wamp-virtualhost-creation-1.png rename to docs_src/v3/tutorials/images/wamp-virtualhost-creation-1.png diff --git a/docs/src/v3/tutorials/images/wamp-virtualhost-creation-2.png b/docs_src/v3/tutorials/images/wamp-virtualhost-creation-2.png similarity index 100% rename from docs/src/v3/tutorials/images/wamp-virtualhost-creation-2.png rename to docs_src/v3/tutorials/images/wamp-virtualhost-creation-2.png diff --git a/docs/src/v3/tutorials/images/wamp-wp-installation-1.png b/docs_src/v3/tutorials/images/wamp-wp-installation-1.png similarity index 100% rename from docs/src/v3/tutorials/images/wamp-wp-installation-1.png rename to docs_src/v3/tutorials/images/wamp-wp-installation-1.png diff --git a/docs/src/v3/tutorials/images/wamp-wpbrowser-init-1.png b/docs_src/v3/tutorials/images/wamp-wpbrowser-init-1.png similarity index 100% rename from docs/src/v3/tutorials/images/wamp-wpbrowser-init-1.png rename to docs_src/v3/tutorials/images/wamp-wpbrowser-init-1.png diff --git a/docs/src/v3/tutorials/images/wamp-wpbrowser-init-2.png b/docs_src/v3/tutorials/images/wamp-wpbrowser-init-2.png similarity index 100% rename from docs/src/v3/tutorials/images/wamp-wpbrowser-init-2.png rename to docs_src/v3/tutorials/images/wamp-wpbrowser-init-2.png diff --git a/docs/src/v3/tutorials/images/wp-installation-2.png b/docs_src/v3/tutorials/images/wp-installation-2.png similarity index 100% rename from docs/src/v3/tutorials/images/wp-installation-2.png rename to docs_src/v3/tutorials/images/wp-installation-2.png diff --git a/docs/src/v3/tutorials/local-flywheel-setup.md b/docs_src/v3/tutorials/local-flywheel-setup.md similarity index 100% rename from docs/src/v3/tutorials/local-flywheel-setup.md rename to docs_src/v3/tutorials/local-flywheel-setup.md diff --git a/docs/src/v3/tutorials/mamp-mac-setup.md b/docs_src/v3/tutorials/mamp-mac-setup.md similarity index 100% rename from docs/src/v3/tutorials/mamp-mac-setup.md rename to docs_src/v3/tutorials/mamp-mac-setup.md diff --git a/docs/src/v3/tutorials/vvv-setup.md b/docs_src/v3/tutorials/vvv-setup.md similarity index 100% rename from docs/src/v3/tutorials/vvv-setup.md rename to docs_src/v3/tutorials/vvv-setup.md diff --git a/docs/src/v3/tutorials/wamp-setup.md b/docs_src/v3/tutorials/wamp-setup.md similarity index 100% rename from docs/src/v3/tutorials/wamp-setup.md rename to docs_src/v3/tutorials/wamp-setup.md diff --git a/docs/mkdocs.yml b/mkdocs.yml similarity index 98% rename from docs/mkdocs.yml rename to mkdocs.yml index 38c8a60aa..144f577b1 100644 --- a/docs/mkdocs.yml +++ b/mkdocs.yml @@ -1,7 +1,11 @@ site_name: 'wp-browser docs' site_url: 'https://wpbrowser.wptestkit.dev/' repo_url: 'https://github.com/lucatume/wp-browser/' -edit_uri: 'blob/main/docs/src' +edit_uri: 'blob/main/docs_src' +docs_dir: docs_src +site_dir: docs +watch: + - docs_src site_description: 'Documentation for the wp-browser WordPress testing framework.' site_author: 'Luca Tumedei' nav: @@ -79,10 +83,6 @@ theme: palette: primary: teal -docs_dir: src -site_dir: public -watch: - - src use_directory_urls: true plugins: - search